Config: Laptop, standard working wifi card, Ubuntu 14.04

At every boot, Wifi/Wlan is off/SoftBlocked, I can get it to work with the command sudo rfkill unblock wifi

but after every reboot I have to re-issue that command again (actually that's not entirely true, sometimes (5%) it seems to "stick" through a reboot).

Is there a way to tell rfkill to never block wifi, without having to tell it so explicitly every time?

share|improve this question
2  
possible duplicate: askubuntu.com/questions/356622/… – mikewhatever Sep 14 '15 at 8:41

You can make a service to do this. Execute the following command:

sudo nano /etc/systemd/system/rfkill-unblock-wifi.service

then, copy and paste the following into the file:

[Unit]
Description=RFKill-Unblock WiFi Devices

[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill unblock wifi
ExecStop=
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Press CTRL + o and then press ENTER to save the file. Press CTRL + x to exit nano.

Finally, execute the following command to enable start up the service:

sudo systemctl enable rfkill-unblock-wifi.service
sudo systemctl start rfkill-unblock-wifi.service

Hopefully this doesn't start before wifi is blocked.

source

share|improve this answer
    
Thank you. I have been interested in the way you way you do it, I did it in another service of mine, but this didnt work cause NetworkManager blocks it back - I dont know when -. I solved my problem with writting rfkill unblock wifi in rc.local to ensure it is unblocked at the very end of boot. It works ok. It block def' after it is blocked. – 3pic Sep 14 '15 at 9:50
1  
Actually, there are already an init script for storing and restoring rfkill: /etc/init/rfkill-store.conf and /etc/init/rfkill-restore.conf – senz Mar 10 '16 at 13:41
    
@senz It seems that script simply "restores" the previous state. If this ends up "restoring" to an incorrect state, you can always edit those files accordingly to explicitly unblock instead. I used to be a sysvinit guy myself but I really like the systemd ability to enable, disable, and mask services. – mchid Mar 15 '16 at 22:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.