[SOLVED] WLAN interface -how to disable auto activation

Hi

Check this post:

Thanks! Looks like thats the info I was looking for!

I tried:
/etc/default/tlp
DEVICES_TO_DISABLE_ON_STARTUP="wifi"
this also disabled the wifi-button
I tried ip link set wlp0 up what gives error ("not possible due to RF-kill")

I removed the line
DEVICES_TO_DISABLE_ON_STARTUP="wifi"
again and did a reboot. Wifi stays now disabled.
I tried ip link set wlp0 up what gives error ("not possible due to RF-kill")

That's not what I wanted =D

Next I wanted to try the .desktop file solution from the post, but first I should restore it to a working state. What could have went wrong?

Check the current state with

rfkill list

and "unblock" with

rfkill unblock NUMBER-OF-INTERFACE-FROM-ABOVE-COMMAND

Thank you! Just found that solution from rfkill docs!

Now I'll check (after another cold-reboot) the .desktop-file solution

If that's not working for you, a service can be written to turn off your adapter at boot, but I may have an even easier way.

Create a script to disable wifi:

#!/bin/bash
nmcli r wifi off

Make the script executable, then add it as a start up script.

To turn your wifi back on simply create a desktop file using "Exec=/usr/bin/nmcli r wifi on" as the exec command.

Ok, still no success:
the edit of
/etc/default/tlp
disabled the wifi-button
the .desktop-file solution from https://archived.forum.manjaro.org/t/solved-networkmanager-choose-when-to-enable-wifi-on-reboot/63810/2?u=phrosgone
disabled the wifi-button...

I think I need a script that simulates the key-press of the wifi-button but I fear it has no scancode. I think the button invokes an internal routine that is detected by linux and dis-/enables the wifi-interface. I fear I need access to this routine to make it work as I want it?
I'll do a search with this in mind but am still hoping for suggestions and ideas!

I tried this
(see my post, ".desktop-file solution and the link from Phrosgone where you posted this possibility)
unfortunately this disabled the wifi-button

Then you need to write a service that can execute the lowering of your adapter at login. It needs to be a service because it must be executed as root.

"write a service" sounds crazy (in my virgin-manjaro-ears =D )
I'll do a search on how to do this, but if you have hints and advice you're very welcome!

EDIT:
I'll start here:
https://superuser.com/questions/663989/how-to-create-a-custom-service-that-will-autostart-on-boot-on-archlinux

For what you are attempting to do a service would be very simple. You are only looking to run one command after all.

No shortage of information:

There are many posts on this topic if you search the forum.

https://archived.forum.manjaro.org/t/kernel-4-19-0-3-not-network-after-suspending-gnome-edition/63544/2

https://archived.forum.manjaro.org/t/wifi-adapter-tp-link-tl-wn823n-must-be-reconnected-for-it-to-work/52968/19

https://archived.forum.manjaro.org/t/surface-pro-1796-wifi-not-resuming-after-suspend/48133/47

https://archived.forum.manjaro.org/t/thinkpad-x230t-wont-suspend-under-kernel-419rc4-4-18-4-17-4-14-4-9/59798/21

Here are some external links with excellent systemd reference material:

The ArchWiki - systemd

Red Hat - systemd-targets

Red Hat - systemd unit files

Systemd manpage

Try your best to figure it out. If you need assistance give a holler.

1 Like

Good that I love learning things about linux! I'll post my solution later! For now (and the next hours?) I've something to read!

2 Likes

That's great, that's exactly the type of attitude I like to see on the forum.

To restart you will need a desktop file that needs to execute as root. I've figured out a great new way to do that, so let me know when you get to that part.

1 Like

Well, this was much simpler than expected!

Had some problems to figure out the values for Wants/After/WantedBy but the logs and this command

systemctl list-units --type target --all

helped to build this working result:

 #/etc/systemd/system/wlan_link_down_at_boot.service

 [Unit]
 Descrition=set WLAN interface link down at boot
 Wants=network-online.target
 After=network-online.target
 
 [Service]
 Type=oneshot
 ExecStart=/usr/bin/ip link set wlp2s0 down
 
 [Install]
 WantedBy=graphical.target

Thanks for the input!!

1 Like

Very nicely done. Most people never figure it out without a little help the first time writing a service.

Try this procedure for your start up desktop file. This is a really slick way of starting a script or terminal program that needs root privileges. Usually this method forces open a full size terminal window that disrupts your workflow until after you have input your root password and the process completes.

This improved method will only open a mini password prompt window and all the other processes are run in the background. The first step is to install a very small terminal multiplexing program named "tmux".

sudo pacman -S tmux

Then, create your desktop file:

WiFi Restart Desktop Launcher

Create a file named "wifi-restart.desktop" with a text editor to start your WiFi connection.

The desktop file should have the following contents:

[Desktop Entry]
Comment=Restart WiFi
Exec=pkexec tmux -c /usr/bin/ip link set wlp2s0 up; sleep2 & exit
GenericName=Root Required
Icon=network-wireless-connected-100
Categories=Internet;Network;
Name=Restart WiFi
NoDisplay=true
Path=
StartupNotify=true
Terminal=false
Type=Application

That's it. I didn't get a chance to test it, but I'm pretty sure that should work for you. You may find you need to restart network manager as well, but that is an easy addition.

1 Like

Thank you for sharing this!

The idea to get a less intrusive pw-prompt is nice!
I'll write my remote-mount scripts and other commands I use often to such desktop files.

1 Like

I did a fair bit of searching to try to accomplish the mini pkexec prompt without any terminal window present. It actually turned out to have very few ways of accomplishing that. Then the idea popped into my head to try tmux and after some experimenting it worked perfectly. I was rather proud of myself for coming up with that idea. It results in a nice clean unobtrusive way of launching a root script.

Regarding your remote mounts. You can have them automatically mounted and unmounted as a service as well. The service method of mounting remote shares works extremely well. See post 28 regarding that method here:

1 Like

I have only 2 permanent remote-mounts defined in fstab, both to PCs in the same room.
But the service method is an idea worth thinking about! To learn about services makes it worth for me to try it as a proof of concept and maybe I will feel better with it or find situations where services will suit best - I'm sure about this!

Meanwhile the .desktop-file method ("on-off-buttons") is the best solution and saves much time: I could easily 'port' the scripts to .desktop-files, easy navigation to different files from GUI, no "disturbing-konsole-fiddling" (can watch movies while typing passwords =D ). no root editor required for changes or new mounts, flawless integration into graphical environment - I'm really happy about this and happy I asked you about it - thanks!

(btw.: in my .bashrc I found a way to detect from what/where it's invoked and can skip the huge parts and still keep e.g. the aliases)

1 Like

Your very welcome, and I'm happy you have expanded the boundaries of your Linux knowledge and systemd.

If you are unfamiliar with the systemd mount methods you should research its usage. You do not have to keep the remote shares permanently mounted using systemd. You can have them mount on demand. They can be set to only mount when you access them through your file manager. You can set a predetermined time out and the share will then be unmounted if it is not being used. All automatic and requiring no intervention on your part.

BTW, tmux is a really cool program. Now that you have it installed do a little research on all the cool things tmux can do.

PS. when someone solves your problem on the forum it is a nice gesture to give them credit for the solve. You can do that by adding the check mark to the post that contributed the most to solving your problem. You can click the 3 dots at the bottom of the post and apply the check mark.

1 Like

Thanks for the hint on the check-mark! It didn't fetch my focus before.

The on-demand-feature was the main reason why I felt it's not what I want but I misunderstood the meaning of timeout-value. I'll rethink my approach and do some testing!

I used some 'googles' to see what tmux can do...it's on my things-I-want-to-do-with-linux list now!

(I'm not a rlly bloody new linux user - was using (k)ubuntu for around 3 years (since ~2014) but ... it became too limited and canonical too restrictive in my eyes ... after some research I found arch and manjaro and since this day I love it more each day and as it is with a real love: I want to know what's behind and do the most awesome things with it! I installed arch with architect and read "linux from scratch" but it was a total information overflow (touched systemd in the progress but didn't really know what I'm doing) and I came back to my top-down-approach. The last weeks opened my eyes - again - and I can't get enough. My motto is "Whinedo$e is made to sell - Linux is made to work!"-but I better not open this book further at this point :wink: )

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by