Correct way to resume networking using /etc/rc.d/rc.inet1
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Correct way to resume networking using /etc/rc.d/rc.inet1
Hey all,
I just fixed the problem that my laptop (on which I refuse to use wicd or NetworkManager) doesn't reconnect to the wifi when I resume from suspend. I just copied the file /usr/lib64/pm-utils/55wicd to /etc/pm/sleep.d/55networking and modified it as follows:
Code:
#!/bin/sh
# pm-utils hook to handle suspend/resume properly for wicd
if [ -r "${PM_FUNCTIONS}" ]; then
. "${PM_FUNCTIONS}"
elif [ -r "${FUNCTIONS}" ]; then
. "${FUNCTIONS}"
else
# pm-utils version is too old, or something else is wrong
exit $NA
fi
RETVAL=0 # Set this to 0 initially
net_suspend()
{
# Put wifi interface down
/etc/rc.d/rc.inet1 stop 1>/dev/null 2>/dev/null
RETVAL=$?
}
net_resume()
{
# Bring wifi interface back up
/etc/rc.d/rc.inet1 start 1>/dev/null 2>/dev/null
RETVAL=$?
}
case "$1" in
hibernate|suspend)
net_suspend
;;
thaw|resume)
net_resume
;;
*) exit $NA
;;
esac
# We can't return a nonzero exit code (aside from $NA, $DX, and $NX) to
# to pm-utils or the entire sleep operation will be inhibited, so...
# No matter what we do, the log prefix and message will conflict a bit.
case "$RETVAL" in
0)
exit $RETVAL
;;
*)
echo "Error reconnecting to the network"
exit $NA
;;
esac
Now I've got two questions:
Is this the correct way to solve this problem?
Why doesn't Slackware come with this resume script for rc.inet1? (Or if it does: Where do I find it?)
I'm running Slackware-14.1, and no wicd or NetworkManager, on which I share your views.
I have to do no fancy work for network resumption. I use XFCE - No time for high cholesterol WMs. Have you discovered pm-suspend & pm-hibernate?
There are minor irrations around usb disks on resuming, but that's because I'm lazy.
I'm running Slackware-14.1, and no wicd or NetworkManager, on which I share your views.
I have to do no fancy work for network resumption. I use XFCE - No time for high cholesterol WMs. Have you discovered pm-suspend & pm-hibernate?
There are minor irrations around usb disks on resuming, but that's because I'm lazy.
Oh, I thought this would be a problem for everyone. According to my ACPI scrip I run pm-suspend when I close my laptop lid. According to its documentation, pm-suspend then runs the scripts in /etc/pm/sleep.d with the parameter "suspend" and again when resuming with the parameter "resume". At least that's how I think it works.
I run i3wm without a DE. Maybe XFCE might do some magic to resume your network connection. Are you on wifi using wpa_supplicant? If not this might be the reason for my problem and I might be able to tell wpa_supplicant to reconnect somehow.
I've a Samsung laptop, and the Bios are fairly sound in power management, but teetotally OTT in UEFI. UEFI is disabled, & disk replaced with ssd formatted with fdisk, not gdisk. Using gdisk invokes uefi again.
Then the only issue was XFCE'S power manager. The Bios did everything, & XFCE'S power manager did it again, so I suspended/hibernated twice for every button pressed. I chose to neuter XFCE & run on the bios.If your bios are dodgy, you might try disabling them & using the power manager. This is wherte you are really found out if your wm is half-assed because these things are not sorted.
Yes, I have wpa_supplicant & wifi. It deletes the routes on suspend (192.168.178.26 & 192.168.178.0/24) & rebinds the leases on resume. That's all. cfg80211 seems to get a lot of mention in the logs
I've a Samsung laptop, and the Bios are fairly sound in power management, but teetotally OTT in UEFI. UEFI is disabled, & disk replaced with ssd formatted with fdisk, not gdisk. Using gdisk invokes uefi again.
Then the only issue was XFCE'S power manager. The Bios did everything, & XFCE'S power manager did it again, so I suspended/hibernated twice for every button pressed. I chose to neuter XFCE & run on the bios.If your bios are dodgy, you might try disabling them & using the power manager. This is wherte you are really found out if your wm is half-assed because these things are not sorted.
Yes, I have wpa_supplicant & wifi. It deletes the routes on suspend (192.168.178.26 & 192.168.178.0/24) & rebinds the leases on resume. That's all. cfg80211 seems to get a lot of mention in the logs
I do run XFCE's power manager in the background, this might well be the source of the problem. My BIOS is SeaBIOS on Coreboot (on a Chromebook). There isn't a lot I'm able to change (because I have no clue how to build coreboot with SeaBIOS and bake them into a flashable ROM.) Thanks for the tip, I'll check this out. I don't think it's the wm's fault, it happened with every wm I tried that don't come with a full DE (openbox, fvwm, i3, wmaker) and after all the wm shouldn't interfere with network connectivity anyway.
Correct way to resume networking using /etc/rc.d/rc.inet1
I run i3 without any DE and wicd reconnects on resume (must have the option "connect automatically" on a reachable ap I guess). So You're right, the trouble might come from hardware / bios...
Btw, I have in my todo list "find a good and working script / rule for acpi to suspend or hibernate on low bat". Do you have one you would share ?
I looked into that but since the move of power stuff from /proc to /sys it's not that easy.
XFCE Power manager uses a battery percentage & triggers on it. You can try polling /sys/power/<your-battery>/state for an 'emergency' state, but I never got a reliable script together.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.