LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-14-2021, 10:03 AM   #31
vulcan59
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 14.2 & Current
Posts: 96

Original Poster
Rep: Reputation: 30

Quote:
Originally Posted by igadoter View Post
So login. Switch to run level 0. But before list all active processes and mounts. If shutting down system in run level 1 works - then I think problem is somewhere else. Besides what do you do to shutdown system? From inside GUI, session manager, switching run level or directly by shutdown command?
telinit 0 hangs as I would expect. I don't go anywhere near a gui. Simple boot the system into the shell, mount the NFS share and do "shutdown -h now"
Looking back, telinit 1 worked. That runs rc.K.
telinit 0 or "shutdown -h" runs rc.0.
Both rc.K and rc.0 run the "fuser -k -m -M" in the background. The significant difference is that rc.0 has the wait command which hangs and rc.K has no wait command.
 
Old 07-14-2021, 10:16 AM   #32
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
So test all your mounts. Try in run level 1 to free mounts to find one responsible. In run level 1 there are too few process to cause shutdown hang. So probably it is unfinished transaction on some file system.
 
Old 07-14-2021, 11:42 AM   #33
vulcan59
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 14.2 & Current
Posts: 96

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by igadoter View Post
So test all your mounts. Try in run level 1 to free mounts to find one responsible. In run level 1 there are too few process to cause shutdown hang. So probably it is unfinished transaction on some file system.
First of all, there is no network available in runlevel 1. Any NFS mounts prior to switching to runlevel 1 are not there anymore. Anyway, I booted directly to runlevel 1. No network available so I started it. I did the mount of my NFS filesystem. Instantly I did a "shutdown -h now" and the machine shutdown.

Regarding an unfinished transaction. This is a single user machine. I don't see how that can be the case. I have only one NFS mount.

Also, let's not lose sight of the fact this all works ok on Slackware 14.2 which uses fuser -k in the background in the same way and has the wait conmmand.

If I am understanding all this, running rc.0 from runlevel 3 with an NFS mount hangs at the wait during shutdown. Running rc.0 from runlevel 1 with an NFS mount does not hang. This points to some process in runlevel 3 which is not executing in runlevel 1 causing the hang. Is that correct or an I confused!
 
Old 07-14-2021, 11:12 PM   #34
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by vulcan59 View Post
If I am understanding all this, running rc.0 from runlevel 3 with an NFS mount hangs at the wait during shutdown. Running rc.0 from runlevel 1 with an NFS mount does not hang. This points to some process in runlevel 3 which is not executing in runlevel 1 causing the hang. Is that correct or an I confused!
Try adding the wait command to rc.K and see if it still hangs. I imagine the only reason that works is because it's missing the wait command. I'd bet the fuser command is still hanging, but since rc.K is missing wait, it's probably just pushing through it and gets you back to your terminal.

I'd be curious to see if jobs shows the fuser command after you're at init 1 or if the killall5 command manages to kill it.
 
Old 07-15-2021, 05:05 AM   #35
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Do kind of bisection on rc.* services in /etc/rc.d. This way you may have a chance to find responsible service. Disable half of them and another half till you find which service may cause that issue.

Last edited by igadoter; 07-15-2021 at 05:06 AM.
 
Old 07-15-2021, 07:17 AM   #36
vulcan59
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 14.2 & Current
Posts: 96

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by bassmadrigal View Post
Try adding the wait command to rc.K and see if it still hangs. I imagine the only reason that works is because it's missing the wait command. I'd bet the fuser command is still hanging, but since rc.K is missing wait, it's probably just pushing through it and gets you back to your terminal.
I added a wait in rc.K after the fuser command but the system still shut down ok. jobs shows nothing.

Last edited by vulcan59; 07-15-2021 at 07:18 AM.
 
Old 07-15-2021, 10:11 AM   #37
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by vulcan59 View Post
I added a wait in rc.K after the fuser command but the system still shut down ok. jobs shows nothing.
That's definitely interesting! That means there is either something causing the issue in rc.0 or something preventing it in rc.K. You could try running the individual commands from one and running fuser after each one (without backgrounding it) each time to see if you can find what.
 
Old 09-15-2021, 11:30 AM   #38
vulcan59
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 14.2 & Current
Posts: 96

Original Poster
Rep: Reputation: 30
Hi again. Other priorities stopped me looking at this but I am now back and think I have found the problem.

First of all, it doesn't matter whether the fuser command is backgrounded or not, the shutdown still hangs.

The problem is that for fuser to kill a process holding an NFS mount open it needs access to the network. However, in rc.6 we stop D-Bus just before the fuser and this takes down my wireless network access causing fuser to hang.
 
Old 09-15-2021, 04:23 PM   #39
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
If you swap the stopping of D-Bus to after the fuser command, do you get a successful shutdown?
 
Old 09-16-2021, 11:53 AM   #40
vulcan59
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 14.2 & Current
Posts: 96

Original Poster
Rep: Reputation: 30
I have to move the stopping of D-Bus to after the following unmount of remote filesyatems as well then I get a clean shutdown.

So, the relevant part of rc.6 now looks like this.

Code:
# Stop the haveged entropy daemon:
if [ -x /etc/rc.d/rc.haveged ]; then
  /etc/rc.d/rc.haveged stop
fi

# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
unset FUSER_DELAY
for dir in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do
  echo "Killing processes holding NFS mount $dir open..."
  # Background this to prevent fuser from also blocking shutdown:
  /usr/bin/fuser -k -M -m "$dir" &
  FUSER_DELAY=5
done
# If fuser was run, let it have some delay:
if [ ! -z "$FUSER_DELAY" ]; then
  sleep $FUSER_DELAY
fi

# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems:"
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"

# Stop D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
  /etc/rc.d/rc.messagebus stop
fi

# Try to shut down pppd:
PS="$(ps ax)"
if echo "$PS" | /bin/grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi
 
4 members found this post helpful.
  


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
what is the default powerstate (e.g. S3,S4,S5) for the command 'shutdown -hP' or 'shutdown -hH' or 'shutdown -h' badbetty Slackware 6 11-12-2017 12:18 AM
LXer: How to use and make the most of fuser command in Linux LXer Syndicated Linux News 0 12-05-2016 02:50 PM
Install Realtek ALC3223 drivers: X hangs on start, shutdown/reboot hangs? RatCorpseKing Slackware - Installation 1 04-27-2015 11:26 PM
fuser command imprise Linux - Newbie 3 06-06-2009 04:59 AM
Fuser command Gins Linux - General 3 08-09-2005 01:15 PM

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

All times are GMT -5. The time now is 06:57 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