Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#75836 - [netctl] netctl-wait-online.service doesn't wait for a profile to be selected automatically

Attached to Project: Arch Linux
Opened by Yuri Kanivetsky (x-yuri) - Wednesday, 07 September 2022, 07:14 GMT
Last edited by Toolybird (Toolybird) - Thursday, 08 September 2022, 07:12 GMT
Task Type Bug Report
Category Packages: Core
Status Assigned
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Additional info:
* package version(s): netctl 1.28-1, reflector 2021.11-5
* A topic on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=2056120#p2056120

Steps to reproduce:

1. `netctl disable` all profiles.
2. systemctl enable netctl-auto@wlo1
3. systemctl enable netctl-wait-online
4. pacman -Qs reflector
5. systemctl enable reflector
6. reboot
7. journalctl -b -u netctl-auto@wlo1 -u netctl-wait-online -u reflector

What I see:

Sep 07 08:52:46 yuri2 systemd[1]: Starting Wait for the enabled netctl profiles to come online...
Sep 07 08:52:46 yuri2 systemd[1]: Finished Wait for the enabled netctl profiles to come online.
Sep 07 08:52:46 yuri2 systemd[1]: Starting Refresh Pacman mirrorlist with Reflector....
Sep 07 08:52:46 yuri2 reflector[422]: error: failed to retrieve mirrorstatus data: URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
Sep 07 08:52:46 yuri2 systemd[1]: reflector.service: Main process exited, code=exited, status=1/FAILURE
Sep 07 08:52:46 yuri2 systemd[1]: reflector.service: Failed with result 'exit-code'.
Sep 07 08:52:46 yuri2 systemd[1]: Failed to start Refresh Pacman mirrorlist with Reflector..
Sep 07 08:52:48 yuri2 systemd[1]: Starting Automatic wireless network connection using netctl profiles...
Sep 07 08:52:48 yuri2 netctl-auto[619]: Included profile 'wlo1-yuri'
Sep 07 08:52:49 yuri2 systemd[1]: Started Automatic wireless network connection using netctl profiles.
Sep 07 08:52:53 yuri2 dhcpcd[1122]: dhcpcd-9.4.1 starting
Sep 07 08:52:53 yuri2 dhcpcd[1125]: DUID xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Sep 07 08:52:53 yuri2 dhcpcd[1125]: wlo1: connected to Access Point: yuri
Sep 07 08:52:53 yuri2 dhcpcd[1125]: wlo1: IAID xx:xx:xx:xx
Sep 07 08:52:54 yuri2 dhcpcd[1125]: wlo1: rebinding lease of xx.yy.xx.yy
Sep 07 08:52:54 yuri2 dhcpcd[1125]: wlo1: probing address xx.yy.xx.yy/24
Sep 07 08:53:00 yuri2 dhcpcd[1125]: wlo1: leased xx.yy.xx.yy for 600 seconds
Sep 07 08:53:00 yuri2 dhcpcd[1125]: wlo1: adding route to xx.yy.xx.yy/24
Sep 07 08:53:00 yuri2 dhcpcd[1125]: wlo1: adding default route via xx.yy.xx.yy
This task depends upon

Comment by Toolybird (Toolybird) - Thursday, 08 September 2022, 07:06 GMT
Not familiar with netctl myself, but in fairness, the description for netctl-wait-online service says "Wait for the enabled netctl profiles to come online" which means it might only work for enabled profiles and not the automatic ones?

PS - this pkg is currently marked Orphan? Will assign to original author and see what happens.
Comment by Yuri Kanivetsky (x-yuri) - Thursday, 08 September 2022, 07:29 GMT
I'm not an expert at netctl myself, but there doesn't seem to be automatic profiles. It's about the way they are enabled.

Let's say you have a wireless profile. You can enable it with `netctl enable PROFILE`. That will enable netctl@.service that will start (connect) the profile on boot.

The other option is to `systemctl enable netctl-auto@.service`. That will start (connect) one of your profiles on boot (it will choose/decide). To quote the documentation, "Every time the netctl-auto service is started, all available profiles are enabled by default."

https://man.archlinux.org/man/core/netctl/netctl-auto.1.en

The only thing that makes me think about automatic profiles is that netctl-auto probably doesn't work with wired profiles. I'm not sure.

Also, netctl-auto has the enable command. And generally, from user perspective it makes sense for netctl to at least try once to connect to some network before reaching the network-online.target.

At least that's my understanding.
Comment by Jouke Witteveen (jouke) - Thursday, 08 September 2022, 07:31 GMT
Re. P.S.: The package is marked as orphan because I (the current maintainer) am not an official Arch Packager. Despite what some people think, I am still interested in maintaining netctl!

Currently, netctl-wait-online indeed does not work with netctl-auto, because netctl-auto does not (and cannot, really) interact with systemd to retain a proper state for the profile services. It might even not be a very good idea to want to combine the two programs, since in a typical netctl-auto use case, you might not come online at all. Effectively, you then rely on netctl-wait-online to time-out, which feels wrong to me.

That being said, I do think there is room for improvement. The systemd service for netctl-auto is a simple forking service. It could be possible to add some smartness there and either notify of state changes (this necessitates the netctl-auto process to be around for longer than it is now), or to add some control of when the netctl-auto process finishes. We could probably add a conditional wait on wpa_supplicant to connect (but this on its own doesn't guarantee a routable connection).

An easier solution would maybe be to add a netctl-auto-wait-online service that just polls wpa_supplicant. The same caveats as above apply, but everything needed for this should be in place already. Patches are welcome, I'm happy to help in their production!

Loading...