halt.sh does not mount filesystems read-only, beause it uses the -f option during remounting. This options means (from the mount man-page) "fake", as in does not do anything. sys-apps/baselayout-1.8.6.12 Reproducible: Always Steps to Reproduce:
Created attachment 21897 [details] changed halt.sh which solves the problem (for me)
i noticed the not mounting r/o, too. i suffered from massive corruption of my root partition, all others were mounted r/o. but i think that (at least in 1.8.6.12-r2 the problem is another one: if you look at these lines: mount_readonly() { local x= local retval=0 for x in `awk '$1 != "none" { print $2 }' /proc/mounts | sort -r` do mount -n -o remount,ro ${x} &>/dev/null retval=$((${retval} + $?)) done return ${retval} } you see that it in fact doesn't use the -f option, at least in this function which i believe is responsible for mounting read-only. what i did to solve my problem was this: a few lines below there is the procedure for mounting it read-only: ebegin "Remounting remaining filesystems readonly" # Get better results with a sync and sleep sync; sync sleep 1 if ! mount_readonly then killall5 -9 &>/dev/null sync; sync sleep 1 if ! mount_readonly then eend 1 sync; sync [ -f /etc/killpower ] && ups_kill_power /sbin/sulogin -t 10 /dev/console else eend 0 fi else eend 0 fi the comment "# Get better results with a sync and sleep" lead me to the assumption that the problems were possibly just due to the fact that sleep was too short. i changed the two "sleep 1" to "sleep 4" and my problems were gone. Of course it takes three more seconds to shut down my box, but i don't care because from this time i never had any problems with not cleanly unmounted devices anymore. i attach my new halt.sh. revo
I had a couple of computers that failed to shut down cleanly, hanging at the same point with baselayout 1.8.6.13. This making the change from `sleep 1` to `sleep 4` has fixed both boxes.
Created attachment 28642 [details, diff] patch for /etc/init.d/halt.sh baselayout-1.8.6.13-r1 There is another problem with remounting filesystems readonly if the root filesystem is encrypted with loop-AES. The initrd used to enter the passphrase at boottime cannot be unmounted (according to the README in the loop-AES package). Therefore it appears in /proc/mounts at the time mount_readonly() is called. The problem here: /innitrd is (usually) not listed in /etc/fstab, and since the awk commando only returns the directory names of the mounted filesystems, mount exits with an error. This patch tries to fix the situation by letting awk return devicename and directoryname, so no fstab is needed to resolve the device. It works for me.
This makes zero sense. Forget increasing the sleep time, there's no reason that sleep should be necessary between syncing and attempting to remount the filesystems read-only. Of course the sync itself is also silly (nevermind being doubled!), at least prior to attempting to remount the filesystems. There's no reason to apply this patch, it just is masking a deeper problem. Please don't misunderstand; I am sorry to hear about filesystem corruption, and I appreciate the work you have put into debugging the problem. But this approach is not the right one and the problem will just come up again for somebody else. What filesystem are you guys running, and what kernel versions?
Thes patch doesn't mess with sleep times. It addresses another problem when using loop-AES.
Hi, i have the same problem, system hangs when it reaches the remounting remaining filesystem read-only. it happens with kernel 2.6.8-ck8, and in fact since 2.6.7(all, i've tried mm, ck, develloppement, gentoo-dev...) but works perfectly with 2.6.6-rc3-love4, i have not tried on 2.6.6 kernel. My root partition is reiserfs (3.6), boot is in ext2, my baselayout is now in version 1.10.4 with sysvinit-2.85. hope it will help you, Aron
do you guys use prelink ?
ok, i have prelink installed (version 20040317), but my CFLAGS don't call -fPIC nor -DPIC by default. emerge info Portage 2.0.50-r11 (default-x86-1.4, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.6-rc3-love4) ================================================================= System uname: 2.6.6-rc3-love4 i686 Intel(R) Pentium(R) M processor 1700MHz Gentoo Base System version 1.5.3 Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-Os -march=pentium3 -msse2 -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-Os -march=pentium3 -msse2 -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.mirror.sdv.fr/ http://ds.thn.htu.se/linux/gentoo/ http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="X acpi alsa atapi avi berkdb bitmap-fonts cdr crypt cups directfb dvd encode esd fbcon flash foomaticdb gdbm ggi gif gphoto2 gpm gtk gtk2 imlib java jpeg lcms libg++ libwww mad mikmod mmx motif mpeg ncurses nls nvidia oggvorbis opengl oss pam pdflib perl png python quicktime readline reiserfs slang socks5 spell sse ssl svga tcpd tiff video_cards_nvidia x86 xml2 xmms xprint xv zlib"
i have tested if it was a hotplug(running with udev034) issue because i have it on default runlevel) so i put it in boot runlevel and no changes :( but i have noticed this: when it freezes, by pressing return you get a prompt and a ps aux shows these 2 process root ... Ss /bin/bash /sbin/rc shutdown root ... D /bin/bash /sbin/rc shutdown hope it will help
like it is said in bug 58839, i have commented the ligne halt -w &>/dev/null in /etc/init.d/halt.sh and no it works fine.
we have multiple things being thrown around here so i'll resolve a few and punt this bug - use 1.11.x - halt.sh does not call 'mount -f' anymore (if it ever did) ... it does call 'umount -f', but -f means diff things with mount and umount - Aron's comment about sleep times was not directed at the suggested loop-aes fix but rather the original halt.sh patch - the loop-aes patch should have a new bug filed where we can analyze that fix properly (and without all the noise) - Bug 58839 is unrelated to this