Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 11795

Summary: halt.sh freezes on "unmounting filesystems"
Product: Gentoo Linux Reporter: David T. Yorke <davidtyorke>
Component: [OLD] Core systemAssignee: Martin Schlemmer (RETIRED) <azarah>
Status: RESOLVED FIXED    
Severity: major    
Priority: High    
Version: 1.4_rc1   
Hardware: x86   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: The halt.sh script that freezed the system
The return of "cat /proc/mounts"
my /etc/fstab
Output of emerge info

Description David T. Yorke 2002-12-08 15:19:22 UTC
halt.sh is freezing on function "unmounting filesystems ..." from what I have
figured out so far the command:
for x in $(awk '!/(^#|proc|devfs|tmpfs|^none|^\/dev\/root| \/ )/ {print $2}'
/proc/mounts |sort -r) 
is choking on the part of the regex that sys " \/ ".  It just hangs forever. 
Removing that part lets the awk finish but then  "/" gets retuned to the umount
function as part of the loop.  That sounds like a bad thing.

I'm using baselayout 1.8.5.3 and gawk-3.1.1-r1 on an AMD IBM Aptiva 2158-530. 
Bug exists with or without devfs running.

I've marked this as a major bug because without commenting out these lines, I
can't shutdown or reboot normally.

I'll attach a copy of my /proc/mounts and the halt.sh
Comment 1 David T. Yorke 2002-12-08 15:20:44 UTC
Created attachment 6311 [details]
The halt.sh script that freezed the system
Comment 2 David T. Yorke 2002-12-08 15:21:43 UTC
Created attachment 6312 [details]
The return of "cat /proc/mounts"
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-10 13:00:25 UTC
Please include /etc/fstab.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-10 13:44:38 UTC
If I run from command line:

--------------------------
nosferatu mozilla # awk
'!/(^#|^[[:space:]]*$|proc|devfs|tmpfs|^none|^\/dev\/root| \/ )/ {print $2}'
/tmp/mounts 
/mnt/floppy
nosferatu mozilla # awk
'!/(^#|^[[:space:]]*$|proc|devfs|tmpfs|^none|^\/dev\/root)/ {print $2}' /tmp/mounts 
/
/mnt/floppy
nosferatu mozilla # 
---------------------

Which is wrong, as then / will be unmounted premacurely ...

Please include the same info as above.
Comment 5 David T. Yorke 2002-12-14 14:47:41 UTC
Created attachment 6502 [details]
my /etc/fstab

here is my fstab.  sorry it took so long to get back to you on this.
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-14 14:55:39 UTC
No problem.  This is a weird one ... does your gawk/awk work ... can you run
them from command line ?  Also, did you try a vanilla kernel yet ?
Comment 7 David T. Yorke 2002-12-14 17:06:04 UTC
I'm already running a vanilla-sources kernel and awk does work from the command
line,as I stated in my original post, it just chokes on the part of the awk
command that describes the root directory.
Comment 8 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-15 01:21:40 UTC
Err, problem is it is working fine for thousands of other users.  Also,
There is nothing wrong with that regex (syntax wise) ...
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-15 01:41:11 UTC
Please paste output of:

  # emerge info

Comment 10 David T. Yorke 2002-12-15 19:25:23 UTC
Created attachment 6531 [details]
Output of emerge info
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-15 20:21:56 UTC
Change your CFLAGS and CXXFLAGS to:

  CFLAGS="-march=k6-2 -O2 -pipe"
  CXXFLAGS="-march=k6-2 -O2 -pipe"

Remerge gawk, and see if that fixes it.
Comment 12 David T. Yorke 2002-12-15 21:25:05 UTC
how can i do that from the command line without messing with my make.conf?
Comment 13 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-15 22:13:51 UTC
 # CFLAGS="-march=k6-2 -O2 -pipe" CXXFLAGS="-march=k6-2 -O2 -pipe" emerge gawk
Comment 14 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-17 07:33:02 UTC
And ?

Comment 15 David T. Yorke 2002-12-17 19:58:14 UTC
Sorry for the delay. I remerged gawk with -O only and it runs OK, but ...

The plot thickens.  If i run what is in the halt.sh script:
awk '!/(^#|proc|devfs|tmpfs|^none|^\/dev\/root| \/ )/ {print $2}'
/proc/mounts |sort -r

It outputs:
/

if I take out the space at the end of the " \/ " it outputs nothing.  Which is
the correct answer.

So ... it works almost.  Any other ideas/suggestions? Can that trailing space
come out?

Dave Yorke
Comment 16 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-17 22:25:08 UTC
nosferatu root # awk '!/(^#|proc|devfs|tmpfs|^none|^\/dev\/root| \/ )/ {print
$2}' /proc/mounts |sort -r
/space/gentoo/usr/portage
/space
/home
nosferatu root # 


It should actually list all local mounts except rootfs (/), and devfsd, proc,
etc ....

Maybe try it like so:

# awk '!/(^#|proc|devfs|tmpfs|^none|^\/dev\/root|[[:space:]]\/[[:space:]])/
{print $2}' /proc/mounts |sort -r
Comment 17 David T. Yorke 2002-12-17 22:42:42 UTC
In my case, with my system now anyway, I only have devfs, tmpfs,rootfs and proc.
 So it should come back blank.

Btw, you' sugggested code:
# awk '!/(^#|proc|devfs|tmpfs|^none|^\/dev\/root|[[:space:]]\/[[:space:]])/
{print $2}' /proc/mounts |sort -r

Returned nothing as it was supposed to.  Excellent. <<Twiddle fingers ala Monty
Burns>>

One question though, if the awk returns nothing will the for loop skip itself
because x = 0 or will it crash?  I'm only asking because I have very little
experience in shell programming.

David Yorke

Comment 18 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-18 01:40:50 UTC
It should not run the code in the for loop.  Great, ill tweak the code
in halt.sh on cvs.
Comment 19 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-18 09:05:12 UTC
Try masked baselayout-1.8.5.6 please.
Comment 20 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-19 09:16:53 UTC
Open if still problems with 1.8.5.6.