I have an HP Spectre x360 convertible laptop and I'm running Ubuntu 18.04. Every time I turn the screen sideways or in tablet mode and back, 'Airplane Mode' is activated. In fact, when I boot up and login, I have to manually turn off 'Airplane Mode' and turn wifi back on. I don't want to disable the gnome rfkill plugin like so: 'gsettings set org.gnome.settings-daemon.plugins.rfkill active false' because then I can no longer use bluetooth. Also, for some godforsaken reason, even when I DO disable the plugin, the gnome shell turns on 'Airplane Mode' anyway, which means that I have to go turn wifi back on EVERY time I log in. This is so annoying, I really liked where 18.04 was going but this is seriously breaking the whole gnome shell experience.
Ubuntu – Why does “Airplane Mode” keep toggling on the HP laptop in Ubuntu 18.04
18.04airplane-modebluetoothgnome-shellhp
Related Solutions
My new HP computer also had some problems with wi-fi under Ubuntu. Slightly different model and problems, and I managed to fix the most of them, though.
I'm using an HP 15-bs048ns. Maybe you can try these methods, ordered by increasing desperation ‒ hope it helps.
(Please excuse me if you already tried some of them or they're really obvious. I don't know how knowledgeable are you at Linux, and it could help other users out there. I'll try to add links to related answers and pages, too.)
Try not holding the Fn key
You probably have already tried this, but, is your airplane key Fn + F12 or just F12? Some laptops, by default, require that you hold Fn for the F1...F12 keys and not for the special keys.
In my laptop, F12 is airplane, and Fn+F12 is F12. You can set your Fn key to work the traditional way from the BIOS, though. (F12 = F12, Fn+F12 = airplane)
(No matter what the setting, modifier keys work normally with function keys: Shift+F10 will never press the Play/Pause key.)
Airplane key won't work in a GUI - try from the text console
I have an airplane key in F12, but for some reason, it doesn't work under X or Wayland. But it works from the text console (TTY)
If I want to use the Airplane key, I need to:
- Press Ctrl+Alt+F3 (no need to worry for the Fn key).
- Type my username and password
- Press the Airplane key
- Press Ctrl+Alt+F2 to return to the GUI.
If my keyboard shortcuts to move between the TTY and the GUI don't work, just try different function keys (F1, F2... through F7)
Install a different module for your wi-fi
My computer didn't even have drivers for my wireless. Yours appears to, but they might not be working properly.
If you need to install new drivers, you'll need first to disable the Secure Boot in shim:
sudo mokutil --disable-validation
It will ask you for a one-time password. Don't bother using a good one, it only works until the next reboot.
You reboot, and when you encounter a blue screen reading “Press any KEY to perform MOK management”, press a key and follow the instructions. You'll probably need to type three separate characters from the password, suppose you used abcdefgh
as password:
Type character 4 of password: d
Type character 8 of password: h
Type character 1 of password: a
Press Enter after every letter. Yes, these instructions look too detailed, but it's pretty common to screw up the first time (I did).
I don't know where you can find better modules for your computer. Mine works with lwfinger's drivers (my problems were only with the wi-fi; you'll probably need modules for both bluetooth and wifi).
In any case, if you find your module, it needs to be recompiled every time you upgrade the kernel (or else, the wireless interface and the wireless menus at Ubuntu disappear on your next boot.). You can set up DKMS to recompile them automatically every kernel upgrade ‒ I'm still testing this so I can't give you detailed instructions.
Reprogram your keyboard
I read somewhere (I'll link it if I find it) I could use the showkey
command under the TTY to read key events straight from the kernel. And showkey -s
to find the address of the pressed key.
Looking at the showkey man page, it doesn't directly read them from the kernel anymore, and the airplane key doesn't output any key event for me... even though it clearly works.
But my computer manages its wireless differently (I'm not sure I even have a hard lock), so it might work for you. If it sends some key event, you can reprogram the key to a different function ― maybe it will work.
You can read at the answer NicoTho that posted how to reprogram a key.
Best Answer
In the gnome shell, "Airplane Mode" is automatically activated on boot for many HP laptops, when the screen is tilted sideways, or when the lid is opened/closed. The following is a fix for HP laptops running Linux and using the gnome shell. Keycode 240 is defined as KEY_UNKNOWN (a kind of no-op key) in /usr/include/linux/input-event-codes.h. Also your syslog will no longer prompt you to define the HP e057 and e058 codes, which can be remarkably annoying.
First is a fix using a classic SysV init script, placed in the init.d directory and symlinked accordingly (Basically, we want it to run regardless of runlevel on anything except halt (0) or reboot (6)). Second is a systemd service that is far more reliable and perhaps present with recent systemd changes, which also happens to work on Fedora 28 and other distribution platforms. On Fedora in particular, you will find an almost complete absence of scripts in the /etc/init.d directory, along with a little README detailing the transition from SysV to systemd. The first method will work, but the second method is much more "future friendly" especially considering where Ubuntu is heading, and will also work in a slightly less...annoying way. Systemd init scripts are actually quite handy, and fully implemented and used frequently in Ubuntu 18.04.
Old SysV method:
New Recommended Systemd Method:
Paste the following lines or type them into the file:
Save and confirm the filename with ctrl-x, y.
And that's it, no more annoying weird stuff when you tilt your screen or close/open the laptop lid!