Another observation:
Turn off all three settings under 'power', check wifi setting -> airplane mode has been enabled.
Turn airplane mode off, go back to power settings -> Everything except WIFI is turned on.
I start to wonder what the thought process was when programming this...
Hi,
i can confirm the this problem is present also on PostmarketOS Edge after the Megi's kernel. If i'm not wrong i got the same problem when i was using PostmarketOS Stable preinstalled on Pinephone before Megi's kernel introduction, so probably has nothing to do with the kernel.
Yes, I've seen this since I got the device. I boot it daily and always have to manually turn off BT. Nothing changed with kernel 5.9.1 as far as I can tell.
I suspect it's a problem in the settings application but it might also be something underlying. I don't know how to debug this any further.
Thanks for the detailed report, @hollunder! I've created an upstream bug report based on your information to figure out whether there is desire to resolve this in Phosh, or if we should add something downstream (e.g. a service that checks the state on shutdown and re-applies it on reboot).
Okay, as pointed out in the upstream issue, phosh does all of these power settings with the rfkill API (verified with quick git grep rfkill: it's used for bluetooth, wifi and the airplane mode button). Distributions should use systemd-rfkill to load and save the state between reboots:
https://www.freedesktop.org/software/systemd/man/systemd-rfkill.service.html
In postmarketOS, we use openrc instead of systemd. It seems that there is no such service for openrc (searched openrc source code, gentoo wiki, ..). But it should be pretty easy to write our own service, and then upstream that to Alpine.
The great thing is, that this should not only work with Phosh, but with all UIs.
TODO:
write rfkill openrc service (model it after the similar alsa openrc service)
test that it works
upstream it to Alpine. the "rfkill" command line program is in "util-linux", so maybe a "util-linux-openrc" subpackage (like "alsa-utils-openrc") would be a good place, especially if the implementation of the openrc service relies on the "rfkill" command line program (not sure if that is needed). When in doubt, ask Alpine about where to package this best once you're there.
put the link to the upstream MR here :)
once it's merged, let's enable the service per default in postmarketos-base
(after some testing, we can backport the openrc service and postmarketos-base change to the v20.05 branch)
@murks, @uniformbuffer, or dear reader: do you want to give it a try?
Thanks Oliver!
I read the upstream response but didn't make an account there (yet another account on yet another issue tracker).
Since he explicitly said that this service is used to restore state "across reboots" that makes me wonder whether he read the bit about enabling airplane mode as that doesn't involve a reboot and I don't know whether that is also covered by that service.
I wonder whether you want to bring that up (or whether I should do that).
But I guess either way we will need something for the reboot case.
I can sure try to write such a service but it will take some time. It's still entirely unclear to me how the entire project is organised (pmos, pinephone, various upstreams, code flows, processes), let alone where and how to contribute code.
that makes me wonder whether he read the bit about enabling airplane mode as that doesn't involve a reboot and I don't know whether that is also covered by that service.
I've also missed that bit, but yes, that sounds like a different issue. It would be great if we could verify that this is not a postmarketOS specific issue first, e.g. by booting another Linux distribution that uses phosh and runs on your phone (pureos for pinephone, mobian, manjaro, ...) from SD card and trying it there.
If it's also present in another distro, especially in PureOS, then it would be great to file another upstream bug report for that. (And yes, that requires an account. But it's worth it, if you care about the Phosh UI, all upstream Phosh related development is in that gitlab instance.)
But I guess either way we will need something for the reboot case.
yep
I can sure try to write such a service but it will take some time. It's still entirely unclear to me how the entire project is organised (pmos, pinephone, various upstreams, code flows, processes), let alone where and how to contribute code.
Hop on #postmarketOS (matrix and IRC) to get such questions answered. The gist is:
postmarketOS is a Linux distribution targeting mobile phones, around since 2017.
pinephone is a Linux"/BSD" targeted phone by the pine64 company. They don't develop an operating system for it, but work with lots of communities, like postmarketOS, to port their existing operating systems.
for the postmarketOS community edition, we've shipped with the Phosh UI, which is developed by Purism for their own phone, the Librem 5. postmarketOS can also be used with other UIs, such as Plasma Mobile.
upstream of postmarketOS packaging is Alpine Linux. We only do the mobile specific stuff in pmOS, everything else goes to Alpine.
The init script's stop/start are not called on suspend/resume.. which means that for this to run on suspend/resume, there needs to be an elogind hook too that does rc-service stop rfkill on suspend, and rc-service start rfkill on resume. Unless there's something I am missing?
Actually, after a bit of testing, it seems like suspend/resume don't have any affect on rfkill state. Radios that are 'blocked' before a suspend are still 'blocked' after a resume. So my upstream MR seems to be the only thing required here.
Thanks for the explanation Oliver.
Sorry for the very late response. I intended to respond after I tested the behavior on a different OS which I couldn't do (because I still haven't purchased a microSD card and I don't know what to watch out for with these things).
Can someone else test this behavior on PureOS?
Thanks for taking care of the reboot bit meanwhile Clayton.
PureOS is based on Debian, and uses systemd. The fix I made for pmOS (which uses Alpine Linux) is specific to the OpenRC init system and won't work for systemd. I think (but could be wrong, since I didn't verify..) that Purism has something in PureOS to restore radio config on reboot..