LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-27-2016, 01:46 AM   #1
navigium
Member
 
Registered: Aug 2014
Location: Switzerland
Distribution: Slackware, FreeBSD
Posts: 119

Rep: Reputation: 58
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?)
 
Old 05-27-2016, 05:09 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,369

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
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.
 
Old 05-27-2016, 05:37 AM   #3
navigium
Member
 
Registered: Aug 2014
Location: Switzerland
Distribution: Slackware, FreeBSD
Posts: 119

Original Poster
Rep: Reputation: 58
Quote:
Originally Posted by business_kid View Post
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.
 
Old 05-28-2016, 04:30 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,369

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
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
 
Old 05-28-2016, 10:27 AM   #5
navigium
Member
 
Registered: Aug 2014
Location: Switzerland
Distribution: Slackware, FreeBSD
Posts: 119

Original Poster
Rep: Reputation: 58
Quote:
Originally Posted by business_kid View Post
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.
 
Old 05-29-2016, 02:32 PM   #6
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,407
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
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 ?
 
Old 05-30-2016, 01:01 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,369

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifications to rc.inet1, rc.inet1.conf and rc.wireless hba Slackware 1 12-07-2014 03:57 AM
[SOLVED] Why do nVida drivers hose suspend/resume or hibernate/resume? taylorkh Linux - Hardware 3 06-23-2011 01:09 PM
Networking issues/problems in 9.3 is my config correct? A6Quattro SUSE / openSUSE 9 07-12-2005 11:36 PM
rc.inet1 and rc.inet1.conf edafe Slackware 0 02-16-2005 09:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration