You are not logged in.
Hi,
I use the net-auto-wireless service, and I kept losing wireless roaming when I put my laptop to sleep. Apparently it happens because wpa_actiond gets killed when the included /usr/lib/pm-utils/sleep.d/50netcfg script suspends all active profiles. I tried disabling the 50netcfg script, and I seem to get roaming back.
I'm curious, what is the use of 50netcfg? Is it needed to re-establish connections on wake if one isn't using net-auto-wireless? If so, would it make sense to have 50netcfg run conditionally on if net-auto-wireless is inactive?
And/or, perhaps related, I see this bug report: FS#26927 ...suggesting, that perhaps instead or in addition to above, netcfg shouldn't end up killing wpa_actiond when changing/stopping wireless networks... though I wonder how that works without the two fighting for control...
I guess the short question here is, should I file a bug report / feature request to have the 50netcfg script be aware of net-auto-wireless?
Thanks...
Offline
I just upgraded netcfg to 2.8.8-1, and while wpa_actiond is no longer killed on suspend, I still seem to lose roaming once I wake up the computer. Or at least, if I wake up in a place where a new network must be connected to, wpa_actiond doesn't do it.
Again, disabling 50netcfg allows wpa_actiond to connect me to a network. It seems that without 50netcfg suspending the current profile, wpa_actiond is able to see that the wireless interface goes down, and thus tries to find a network to connect to on wake.
Offline
I don't think that disabling 50netcfg completely is the right thing to do. Indeed, from the point of view of the AP you just disappear, while with 50netcfg you cleanly disconnect.
While I need to do some more testing, I would suggest dropping a custom 50netcfg into /etc/pm/sleep.d which instead of suspending profiles, simply restarts net-auto-wireless (stops before suspend/hibernate and resumes on resume/thaw). This way, you'll gain automatic reconnection to the correct network whatever you location is.
I also wonder if this way is more secure when dealing with RADIUS networks.
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
I would suggest dropping a custom 50netcfg into /etc/pm/sleep.d which instead of suspending profiles, simply restarts net-auto-wireless (stops before suspend/hibernate and resumes on resume/thaw)
Okay, I tried this, and it seems to be working for at least my particular case of changing networks while the laptop sleeps. Cool.
Would it be good to have this functionality in the netcfg package's sleep.d script? I'd try to make+submit a patch, but I'm not sure the best way to handle systemd vs init script based launching of net-auto-wireless, as I'm rather naive about systemd.
Last edited by dabrado (2012-07-26 16:47:08)
Offline
Good to hear
Opening a bug report/feature request is probably a good idea... Regarding systemd/initscripts -- perhaps the best thing to do is leaving 50netcfg as a skeleton with commented calls like:
# /etc/rc.d/net-auto-wireless restart
# systemctl restart netcfg.service
so the user will be able to choose his/her init system. Or, since arch still oficially does not use systemd, maybe initscripts call should be uncommented.
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
Good to hear
Opening a bug report/feature request is probably a good idea... Regarding systemd/initscripts
What about this?
if grep -q '\binit=\S*bin/systemd\b' /proc/cmdline; then
systemctl restart netcfg.service
else
/etc/rc.d/net-auto-wireless restart
fi
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Sorry for a delay
Good idea but what does "\S*" do? It seems to match everything -- did you mean "\s"? Also, why not simply grep for "systemd"?
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
There are actually nice looking functions included with pm-utils called "stopservice" and "restartservice" that would do the trick, except that the pm-utils service script is a little broken for Arch, as reported in this (old) bug:
https://bugs.freedesktop.org/show_bug.cgi?id=40048
If that were fixed, either on the freedesktop side, or via having a patch applied in the Arch package of pm-utils, then one could simply add "stopservice net-auto-wireless" and "restartservice net-auto-wireless" to 50netcfg, like so:
#!/bin/bash
. /usr/lib/pm-utils/functions
suspend_netcfg() {
stopservice net-auto-wireless
netcfg all-suspend
}
resume_netcfg() {
netcfg all-resume
restartservice net-auto-wireless
}
if type netcfg > /dev/null; then
case "$1" in
hibernate|suspend)
suspend_netcfg
;;
thaw|resume)
resume_netcfg
;;
*)
;;
esac
fi
exit $?
The nice thing about the stopservice/restartservice functions is that they take care of remembering whether or not the given service was running or not, so it won't be restarted on thaw/resume if it wasn't running during hibernate/suspend.
Offline
Right, but why do you need to suspend all profiles after net-auto-wireless has been stopped?
Regarding pm-utils, it has an impressive list of open bugs... so one patch may not be enough.
Edit: BTW whether the service was started before suspend can be tested using arch's native /usr/sbin/rc.d:
if /usr/sbin/rc.d list --started net-auto-wireless &>/dev/null; then
...
else
...
fi
Last edited by Leonid.I (2012-08-02 00:34:49)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
Right, but why do you need to suspend all profiles after net-auto-wireless has been stopped?
This is in case net-auto-wireless wasn't running in the first place, since stopservice would always be called. Also, even if net-auto-wireless was running, theoretically there could be active wired profiles, I think.
Regarding pm-utils, it has an impressive list of open bugs... so one patch may not be enough.
From what I tested, the linked bug seemed to be the only one in the way of using stopservice/restartservice.
Edit: BTW whether the service was started before suspend can be tested using arch's native /usr/sbin/rc.d
Though I believe /usr/sbin/rc.d will not list a service as started if gets stopped during the suspend step, which I thought was the goal, i.e. to stop wireless cleanly versus just disappearing.
Offline
Ah, agreed. I lost sight of the original problem... I just never had an active profile outside net-auto-wireless. Suspending all profiles is bening if none of them exists.
But I sitll don't like pm-utils scripts not relying on initscripts for the status checks and hardcoding /var/run/daemons path. I mean, there is a status function ck_daemon() in /etc/rc.d/functions. Or at least, the check should be in /run/daemons because one day /var/run may no longer be a symlink to /run... Perhaps the patch should look like this:
--- /usr/lib/pm-utils/bin/service 2012-05-24 04:44:19.000000000 -0500
+++ /tmp/service 2012-08-02 10:26:45.696198298 -0500
@@ -20,8 +20,8 @@
case $rel in
*slackware*) svc="/etc/rc.d/rc.$1";;
*arch*) svc="/etc/rc.d/$1"
- status() { [ -e "/var/run/daemons/$1" ] && echo "$1 running"; }
- ;;
+ . /etc/rc.d/functions
+ status() { ck_daemon $1 || echo "$1 running" ; } ;;
esac
break
done
@@ -29,9 +29,8 @@
exists || { echo "$1: unrecognized service or non-LSB Linux distro"; exit 1; }
case $2 in
- start|stop|status) "$2" ;;
+ start|stop|status) "$2" "$1" ;;
restart) stop; start ;;
*) echo "$2: Unrecognized service command"
exit 1 ;;
esac
-
\ No newline at end of file
So... who should file a bug?
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
So it turns out that I'm not the only one having this bug, and independently came up with the same "stop at suspend, start at resume" solution I will file a report, but I think we shouldn't worry about pm-utils and file against netcfg only, since the 50netcfg file is owned by netcfg.
[edit] Bug filed: https://bugs.archlinux.org/task/31037. Also, thanks for all the good info in this thread; I incorporated most of it. [/edit]
Last edited by garaden (2012-08-06 23:13:28)
Offline
Ok, looks like they're not interested in making 50netcfg any more complicated, which is fair (see the bug for more details). Apparently there's a file called /usr/share/doc/netcfg/contrib/pm-utils.handler that is much more powerful than 50netcfg, though it uses the broken restartservice stuff. Probably a good starting point for figuring out the best script to write for our own situations, until the restartservice stuff is fixed?
Offline
Probably a good starting point for figuring out the best script to write for our own situations, until the restartservice stuff is fixed?
Ship our own restartservice with fixed sysvinit and systemd support? I suppost scrapping the whole file and using this as a base is good enough:
https://wiki.archlinux.org/index.php/Sy … _Shortcuts
#!/bin/sh
# ... here code from wiki ...
#add for rc.d:
. /etc/rc.d/functions
status() { ck_daemon $1 || echo "$1 running" ; }
#end add
case $2 in
start|stop|status) "$2" ;;
restart) stop; start ;;
*) echo "$2: Unrecognized service command"
exit 1 ;;
esac
Last edited by progandy (2012-08-09 23:42:26)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
I have a similar problem - when I resume the system from suspend, net-auto-wireless doesn't get resumed, I have to start it manually. I've tried and failed to fix the problem with the following /etc/pm/sleep.d/50netcfg:
#!/bin/bash
. /usr/lib/pm-utils/functions
suspend_netcfg() {
# stop net-auto-wireless if it's running (is-active returns 0)
if [ ! `systemctl is-active net-auto-wireless.service --quiet` ]; then
systemctl stop net-auto-wireless.service
fi
netcfg all-suspend
}
resume_netcfg() {
netcfg all-resume
# start net-auto-wireless if it's set to be autostarted (is-enabled returns 0)
if [ ! `systemctl is-enabled net-auto-wireless.service --quiet` ]; then
systemctl start net-auto-wireless.service
fi
}
if type netcfg > /dev/null; then
case "$1" in
hibernate|suspend)
suspend_netcfg
;;
thaw|resume)
resume_netcfg
;;
*)
;;
esac
fi
exit $?
Does anyone know why it doesn't work?
And what about the /usr/share/doc/netcfg/contrib/pm-utils.handler file? What does it do and can it help me?
Offline