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

Bug 381783

Summary: sys-apps/openrc-0.9.2: doesn't remount read-only root on shutdown
Product: Gentoo Hosted Projects Reporter: i.Dark_Templar <idarktemplar>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: RESOLVED WORKSFORME    
Severity: major CC: 1i5t5.duncan, 7v5w7go9ub0o, b.brachaczek, b.buschinski, carlphilippreh, dv, idarktemplar, julien.enche, klaus.kusche, krinpaus, kripton, kuba.iluvatar, l33tmmx, marduk, ondrej.kozina, orangewarrior, pandu, polynomial-c, rdalek1967, slashbeast, tpfaff
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: localmount initscript fix
Fixed mount-ro initscript
Fixed localmount initscript, with realpath
Fixed mount-ro initscript, with realpath
Patch to resolve symlinks inside regexps in mountinfo
openrc-0.9.3-r1.ebuild.patch
0001-Fix-regex-pattern-for-umounts-during-shutdown.patch

Description i.Dark_Templar 2011-09-04 13:53:48 UTC
After upgrading openrc-0.8.3 to openrc-0.9.2 rootfs doesn't remount read-only. So every boot i get messages saying that root wasn't cleanly unmounted and requires check. Then it says it's recovered. After that boot continues.
After downgrading openrc back to 0.8.3 bug disappeared.

Reproducible: Always

Steps to Reproduce:
1. Get root over dm-crypt
2. Get openrc-0.9.3
3. reboot
4. After that on boot probably you'll get message about checking and recovering root
Actual Results:  
Boots with messages about root corrupted fs and it's recovery.

Expected Results:  
Must boot cleanly.

I got root on dm-crypt. For booting i made initrd with custom boot script which does:
1. decrypt root key with gnupg2
2. opens root tome with crypt setup
3. mounts root tome read-only
4. prepares for switch_root and execs switch_root
5. after that normal gentoo boot continues
I get error messages about not clean root filesystem at step 3.
Comment 1 i.Dark_Templar 2011-09-04 13:55:27 UTC
# emerge --info

Portage 2.1.10.11 (default/linux/amd64/10.0/no-multilib, gcc-4.4.5, glibc-2.12.2-r0, 2.6.39-gentoo-r3.34 x86_64)
=================================================================
System uname: Linux-2.6.39-gentoo-r3.34-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.0.3
Timestamp of tree: Sun, 04 Sep 2011 10:15:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.7.1-r1
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo enlightenment-niifaq lcd-filtering templar
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/local/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --buildpkg --binpkg-respect-use=y"
FEATURES="binpkg-logs distlocks ebuild-locks fakeroot fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.bloodhost.ru/ http://ftp.ing.umu.se/linux/gentoo/ ftp://mirror.qubenet.net/mirror/gentoo/ ftp://mirror.bytemark.co.uk/gentoo/ ftp://91.121.124.139/gentoo-distfiles/"
LANG="ru_RU.UTF-8"
LC_ALL=""
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="ru en"
MAKEOPTS="-j3"
PKGDIR="/usr/local/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/enlightenment-niifaq /var/lib/layman/lcd-filtering /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 amr apm ares bash-completion bidi bluetooth bzip2 cairo caps cdda cdio cdr cleartype cli consolekit cracklib crypt cue cups custom-cflags custom-optimization cxx dbus dga dirac dri dts dvd dvdr encode exif faad fam ffmpeg flac fluidsynth fontconfig fontforge freetype gcrypt gif gmp gnutls gpm gtk iconv icu idn imlib inotify ipv6 jadetex jpeg kde lcms libass libdvdcss lzma lzo mad matroska midi mmap mmx mng modules mp3 mp4 mpeg mplayer mtp mudflap ncurses network nls nptl nptlonly offensive ogg openal opengl openmp pango pch pcmcia pcntl pcre pdf pic plasma png policykit posix postproc ppds pppd private-headers projectm qt3support qt4 raw readline schroedinger session sftp sndfile sockets spell sse sse2 ssl ssse3 startup-notification svg sysfs system-sqlite tcpd tga theora threads tiff truetype udev unicode usb utils v4l v4l2 vaapi vdpau vlc vorbis vpx wavpack wicd wifi wma wxwidgets x264 xcb xcomposite xft xine xorg xpm xscreensaver xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="vesa vga nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Francisco J. Vazquez 2011-09-05 06:31:49 UTC
Happens to me too, but I don't have dmcrypt. At shutdown I see something like "localmount: received SIGTERM", and the shutdown process halts. At boot, the root filesystem is fsck'd.


emerge --info:

Portage 2.2.0_alpha53 (default/linux/amd64/10.0/desktop, gcc-4.6.1, glibc-2.13-r4, 3.0.4-gentoo x86_64)
=================================================================
System uname: Linux-3.0.4-gentoo-x86_64-Genuine_Intel-R-_CPU_U4100_@_1.30GHz-with-gentoo-2.0.3
Timestamp of tree: Sun, 04 Sep 2011 06:00:01 +0000
app-shells/bash:          4.2_p10
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r2, 3.2-r2
dev-util/cmake:           2.8.5-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.2
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.6.1-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo x11 local-overlay
Installed sets: 
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/local/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/local/portage/tree"
PORTDIR_OVERLAY="/var/lib/layman/x11 /usr/local/portage/overlay"
SYNC="rsync://quadserv/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cjk cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fbcon firefox flac fortran gdbm gdu gif gnome-keyring gpm gtk gtk3 iconv imap ipv6 joystick jpeg lcms libnotify mad mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support readline sdl session spell sse sse2 ssl startup-notification subversion svg symlink sysfs tcpd threads tiff truetype udev unicode usb v4l2 vorbis x264 xcb xml xorg xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 i.Dark_Templar 2011-09-05 10:43:53 UTC
Then I rename bug, exclude "on dm-crypt".
Comment 4 Tomasz Figa 2011-09-05 12:31:19 UTC
(In reply to comment #2)
> Happens to me too, but I don't have dmcrypt. At shutdown I see something like
> "localmount: received SIGTERM", and the shutdown process halts. At boot, the
> root filesystem is fsck'd.
> 

Same here. Happens to me on every shutdown or reboot. I will try to attach some more information later.
Comment 5 Johannes Hirte 2011-09-05 17:29:18 UTC
Can confirm this with a fresh installed amd64 system. It seems that localmount and rc are killed with a SIGTERM on shutdown/reboot.

 emerge --info
Portage 2.2.0_alpha53 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.13-r4, 3.1.0-rc5 x86_64)
=================================================================
System uname: Linux-3.1.0-rc5-x86_64-AMD_Athlon-tm-_II_P320_Dual-Core_Processor-with-gentoo-2.0.3
Timestamp of tree: Mon, 05 Sep 2011 11:30:01 +0000
app-shells/bash:          4.2_p10
dev-lang/python:          2.7.2-r2, 3.2-r2
dev-util/cmake:           2.8.5-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.2
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.6-r1, 4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo x11 kde mysql local
Installed sets: 
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=amdfam10 -ftree-vectorize -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=amdfam10 -ftree-vectorize -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C"                                                                                                                                                                
LDFLAGS="-Wl,-O1 -Wl,--as-needed"                                                                                                                                       
LINGUAS="de en"                                                                                                                                                         
MAKEOPTS="-j3"                                                                                                                                                          
PKGDIR="/usr/portage/packages"                                                                                                                                          
PORTAGE_CONFIGROOT="/"                                                                                                                                                  
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"                                                                                                                                                  
PORTAGE_TMPDIR="/var/tmp"                                                                                                                                               
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/x11 /usr/local/portage/layman/kde /usr/local/portage/layman/mysql /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl alsa amd64 amr apng assistant berkdb bluetooth bzip2 cairo caps chm cli consolekit cracklib crypt cups cvs cxx dbus declarative device-mapper dirac djvu dri dvd embedded encode exif faac faad ffmpeg fftw flac fontconfig fortran fpx gdbm gif git gmp gpm graphviz gs hdri iconv icu imagemagick inotify ipv6 jpeg jpeg2k kate kde kipi kpathsea lame latex lcms libffi lzma lzo mad mjpeg mmap mmx mng modules mp3 mpeg mudflap multilib mysql ncurses networkmanager nls nptl nptlonly ogg okteta openexr opengl openmp oscar otr pam pcre perl plasma png policykit pppd python python2 python3 qt3support qt4 quicktime raw readline rle schroedinger semantic-desktop session sndfile spell sqlite sqlite3 sse sse2 sse3 ssl subversion svg sysfs system-sqlite tcpd theora threads tiff truetype udis86 unicode usb vorbis vpx webkit wmf x264 xattr xcomposite xetex xine xml xorg xscreensaver xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" SANE_BACKENDS="snapscan" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 6 i.Dark_Templar 2011-09-05 17:46:49 UTC
I think it's a problem with mount-ro, but not sure.
Comment 7 Jonathan Heaney 2011-09-05 19:16:00 UTC
I'm also seeing this since updating to openrc-0.9.x on ~amd64, both native Gentoo and also running as a VirtualBox guest.

At reboot/shutdown, I get

(some other fs's unmount ok then-)
Unmounting /lib64/rc/init.d
localmount: caught SIGTERM
rc: caught SIGTERM

The only thing I could find in the forums was this thread -

http://forums.gentoo.org/viewtopic-t-877375-start-0-postdays-0-postorder-asc-highlight-.html

Although that seems to be about /lib or /lib64 being a symlink to the other, so I'm not sure how relevant it is.
Comment 8 Klaus Kusche 2011-09-06 09:05:05 UTC
Same here, analyzed this.

The problem appears twice, in localmount *and* in mount-ro.

Both should exclude RC_SVCDIR from the list of filesystems being unmounted
or remounted ro.
However, excluding RC_SVCDIR fails as described below,
and when trying to un/remount RC_SVCDIR, all processes using it get killed,
which includes the rc process and its localmount or mount-ro child.

As far as I can tell, the reason is that RC_SVCDIR is "/lib/rc/init.d",
but on pure 64 bit systems, /lib is a symlink to /lib64,
and the actual rc_svcdir mountpoint is "/lib64/rc/init.d",
which does not match any of the patterns to be excluded
and hence gets unmounted.

When I change no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}" to
no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}|/lib64/rc/init.d"
in localmount (and similarly in mount_ro), the problem goes away.
Comment 9 Johannes Hirte 2011-09-06 10:33:02 UTC
(In reply to comment #8)
> Same here, analyzed this.
> 
> The problem appears twice, in localmount *and* in mount-ro.
> 
> Both should exclude RC_SVCDIR from the list of filesystems being unmounted
> or remounted ro.
> However, excluding   fails as described below,
> and when trying to un/remount RC_SVCDIR, all processes using it get killed,
> which includes the rc process and its localmount or mount-ro child.
> 
> As far as I can tell, the reason is that RC_SVCDIR is "/lib/rc/init.d",
> but on pure 64 bit systems, /lib is a symlink to /lib64,
> and the actual rc_svcdir mountpoint is "/lib64/rc/init.d",
> which does not match any of the patterns to be excluded
> and hence gets unmounted.
> 
> When I change no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}" to
> no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}|/lib64/rc/init.d"
> in localmount (and similarly in mount_ro), the problem goes away.

Sounds reasonable. In openrc-0.8.3 RC_SVCDIR was defined as:
#define RC_SVCDIR               RC_LIBEXECDIR "/init.d"

with:
#define RC_LIBEXECDIR           "/lib64/rc"

now in 0.9.2 we have:
#define RC_LIBEXECDIR           "/lib/rc"

The question is, why was this changed?
Comment 10 i.Dark_Templar 2011-09-06 11:20:42 UTC
Maybe RC_LIBEXECDIR (and RC_SVCDIR) should be determined at runtime (or at least at configure stage), not just hardcoded?
Comment 11 Klaus Kusche 2011-09-06 11:34:20 UTC
The problem is not that it's hardcoded.
The problem is that in the presence of symbolic links,
the directory specified in the mount command on mounting 
is not necessarily the actual mount point you see when scanning the mounts later.

I think there are several ways to have that fixed:
1.) Use some directory path which will never contain a symbolic link
(hard to find).
2.) Resolve the given path to the actual directory before mounting
(by using "realpath" or "cd" followed by "/bin/pwd -P").
3.) Mount and read back the actual mount point.
Comment 12 William Hubbs gentoo-dev 2011-09-06 17:55:11 UTC
There is also another option.

The parts of openrc that are installed in /lib/rc, technically, should
be in /libexec/rc, because they are platform-agnostic.

This is the default for openrc's build system, but gentoo forces it to
/lib. If we changed our installation to match the default, this bug
would go away.

I am currently attempting to research why we are using /lib instead of
/libexec, especially when we have /usr/libexec.
Comment 13 Mike Gilbert gentoo-dev 2011-09-06 20:45:24 UTC
*** Bug 382081 has been marked as a duplicate of this bug. ***
Comment 14 William Hubbs gentoo-dev 2011-09-06 23:09:56 UTC
Vapier suggested that we use /run for this, so I am making this bug
depend on the bug for getting baselayout to install /run.
Comment 15 i.Dark_Templar 2011-09-07 05:25:15 UTC
/run ? No way. It won't fix a thing if /run will still be a symlink to /var/run or something else. It doesn't matter so much which directory to use. It matters to do a symlink resolving I think. Like Klaus Kusche said. I vote for his resolve type 2 or 3.
>2.) Resolve the given path to the actual directory before mounting
>(by using "realpath" or "cd" followed by "/bin/pwd -P").
>3.) Mount and read back the actual mount point.
Comment 16 William Hubbs gentoo-dev 2011-09-07 07:15:37 UTC
/run will be a directory. /var/run will be a symbolic link to /run.

If we use something like /run/openrc/init.d as rc_svcdir on linux
systems, that should resolve the issue. Also, this is a better place to
put the runtime data than in /lib*/rc.
Comment 17 i.Dark_Templar 2011-09-07 08:25:51 UTC
And is there is any point in use of /run instead of /var/run? Don't even mention systemd (or any other Lennart's piece of... buggy code). There is no way for them in my gentoo installation.
And assuming something stupid like "no symlinks in this path" is always stupid, no matter if this is /lib*/rc or /run. Fix a bug, not a symptom of bug.
Let users decide where to make RC_LIBEXECDIR. If mainstream gentoo goes as /run, I should always be able to make my overlay where OpenRC has RC_LIBEXECDIR as legacy "/lib*/rc" or even "/var/lib/openrc".
Comment 18 Klaus Kusche 2011-09-07 08:49:02 UTC
Another vote for fixing the cause, not the symptoms.

My system doesn't have /run, and /var/run is a tmpfs mount point here
which gets mounted much later than the first access to RC_SVCDIR
(and is also unmounted too early on shutdown).

So don't make assumptions about the directory, link and filesystem structure
of the target system...
Comment 19 William Hubbs gentoo-dev 2011-09-07 17:39:00 UTC
(In reply to comment #17)
> And is there is any point in use of /run instead of /var/run? Don't even
> mention systemd (or any other Lennart's piece of... buggy code). There is no
> way for them in my gentoo installation.

Udev, dracut and many other tools are adopting /run. It is becoming expected by multiple linux distros as well (fedora, debian and archlinux to name a few).
For more info, take a look at the lwn article referred to in the bug this bug depends on.

> And assuming something stupid like "no symlinks in this path" is always stupid,
> no matter if this is /lib*/rc or /run. Fix a bug, not a symptom of bug.
> Let users decide where to make RC_LIBEXECDIR. If mainstream gentoo goes as
> /run, I should always be able to make my overlay where OpenRC has RC_LIBEXECDIR
> as legacy "/lib*/rc" or even "/var/lib/openrc".

Actually, it is not RC_LIBEXECDIR that we are dealing with, but RC_SVCDIR, which is currently stored under RC_LIBEXECDIR. This is a good example of why /run was created, because there has been no standard place to store runtime data for applications that run during early boot.

(In reply to comment #18)
> Another vote for fixing the cause, not the symptoms.
> 
> My system doesn't have /run, and /var/run is a tmpfs mount point here
> which gets mounted much later than the first access to RC_SVCDIR
> (and is also unmounted too early on shutdown).

You will have /run as soon as the bug this bug depends on is fixed. Openrc has code which will mount a tmpfs on /run, but it only happens when /run exists.

The existence of /run is becoming a requirement for all linux systems, not just gentoo.
Comment 20 i.Dark_Templar 2011-09-07 18:01:11 UTC
Ok. Make a /run directory. But first fix this bug. As I said, I'll just make openrc in my overlay without /run.
This bug isn't about /run directory, it's about incorrect behavior of shutdown scripts if RC_SVCDIR contains symlinks. Make a symlink resolving.
I talked about RC_LIBEXECDIR earlier because RC_SVCDIR is based on value of RC_LIBEXECDIR (at least currently).
Comment 21 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-09-08 09:26:53 UTC
*** Bug 382249 has been marked as a duplicate of this bug. ***
Comment 22 i.Dark_Templar 2011-09-08 10:48:14 UTC
I still insist that getting /run for RC_SVCDIR is a workaround, not a bug fix. So, i'm removing #361349 from dependencies. Getting RC_SVCDIR as /run worth another bug. This bug is about incorrect shutdown.
Comment 23 William Hubbs gentoo-dev 2011-09-08 15:48:00 UTC
I looked this over in more detail yesterday and found more information.

(In reply to comment #11)
> The problem is that in the presence of symbolic links,
> the directory specified in the mount command on mounting 
> is not necessarily the actual mount point you see when scanning the mounts
> later.

This part of the analysis is correct. I verified this on my system by doing the following as root:

cd /
ln -s mnt mnt1
mount /dev/sda1 /mnt1/floppy
# the above mounts my boot device under /mnt1/floppy
grep sda1 /proc/mounts
# this shows sda1 mounted under /boot and /mnt/floppy (NOT /mnt1/floppy)
/lib/rc/bin/mountinfo /mnt1/floppy
# This is openrc's builtin that checks to see if a path is a mount point.
# in this case it fails because /mnt1/floppy is not listed in /proc/mounts as a # mount point.
/lib/rc/bin/mountinfo /mnt/floppy
# This passes because /mnt/floppy is listed in /proc/mounts

Basically, mountinfo does not check the file system, it just looks things up in /proc/mounts. Whether or not this is an issue could be argued both ways, so I want to know what others on the team think.

> I think there are several ways to have that fixed:
> 1.) Use some directory path which will never contain a symbolic link
> (hard to find).

Not really. /run will solve this issue, because it will not be a symbolic link.

> 2.) Resolve the given path to the actual directory before mounting
> (by using "realpath" or "cd" followed by "/bin/pwd -P").

As shown above, mount already does this.

> 3.) Mount and read back the actual mount point.

The actual mount point is stored in /proc/mounts, and as shown above, is not the symbolic link, so I'm not sure what you mean here.
Comment 24 William Hubbs gentoo-dev 2011-09-08 16:02:53 UTC
I just checked the mountpoint command's behaviour, per idl0r, and
mountpoint handles this correctly.

So, it seems that this is an argument for making mountinfo resolv
symbolic links.
Comment 25 Klaus Kusche 2011-09-08 16:26:46 UTC
> > 2.) Resolve the given path to the actual directory before mounting
> > (by using "realpath" or "cd" followed by "/bin/pwd -P").
> 
> As shown above, mount already does this.
> 
> > 3.) Mount and read back the actual mount point.
> 
> The actual mount point is stored in /proc/mounts, and as shown above, is not
> the symbolic link, so I'm not sure what you mean here.

The problem is in the code which decides what to unmount (or remount readonly)
at shutdown in localmount and mount-ro. This code walks through all mount points
(the actual mount points, as in /proc/mounts, with symlinks resolved),
pattern-matches them with a list of directories not to be unmounted,
and unmounts everything which does not match.

However, this list is static and contains the names of the original directories
given to the mount command for mounting (with symlinks *not* resolved),
RC_SVCDIR in our specific case, not the actual mount points.

Hence, if there was a symbolic link, the original directory pattern in the list
"no_umounts_r" and the acutal mount point will not match (even if they should!),
and the directory will be unmounted (which causes trouble in case of RC_SVCDIR)
even when it is intended to be in the exclude pattern list.

To fix the problem, the list no_unmounts_r must contain the *resolved* names
(i.e. the actual mount points) and not the original names
(two places to fix: localmount *and* mount-ro).

Hence, RC_SVCDIR must have its symlinks resolved before adding it to the list.
Comment 26 William Hubbs gentoo-dev 2011-09-08 20:09:42 UTC
(In reply to comment #25)
> The problem is in the code which decides what to unmount (or remount readonly)
> at shutdown in localmount and mount-ro. This code walks through all mount
> points
> (the actual mount points, as in /proc/mounts, with symlinks resolved),
> pattern-matches them with a list of directories not to be unmounted,
> and unmounts everything which does not match.
> 
> However, this list is static and contains the names of the original directories
> given to the mount command for mounting (with symlinks *not* resolved),
> RC_SVCDIR in our specific case, not the actual mount points.

That is correct, and looking a little deeper, you will find that the code that does the checking is in /lib/rc/sh/rc-mount.sh, in the function do_unmount. This is called both in localmount and mount-ro.

It uses the program "mountinfo", which is in /lib/rc/bin, to check the static path to make sure that is a path to a mountpoint.

> To fix the problem, the list no_unmounts_r must contain the *resolved* names
> (i.e. the actual mount points) and not the original names
> (two places to fix: localmount *and* mount-ro).

Or, mountinfo can be  fixed so that it uses the realpath function to make sure that it is looking at a real directory instead of a symbolic link before it tries to match it against /proc/mounts.

This is the fix we have in commit e2f1464.

I will be releasing 0.9.3 with this fix shortly.
Comment 27 William Hubbs gentoo-dev 2011-09-08 21:59:01 UTC
Please test with openrc-0.9.3 and let me know if you still have the
issue.

Thanks,

William
Comment 28 i.Dark_Templar 2011-09-09 09:21:53 UTC
Didn't work for me. But I finally got a fix. Maybe not a clean, but worked for me. Requires "readlink" from "sys-apps/coreutils" (at least at Gentoo/Linux).
Comment 29 i.Dark_Templar 2011-09-09 09:23:09 UTC
Created attachment 285919 [details]
localmount initscript fix

diff -u:
--- /etc/init.d/localmount.backup	2011-09-09 12:22:24.000000000 +0400
+++ /etc/init.d/localmount	2011-09-09 13:05:49.000000000 +0400
@@ -34,7 +34,7 @@
 stop()
 {
 	# We never unmount / or /dev or $RC_SVCDIR
-	local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
+	local x= no_umounts_r="/|/dev|/dev/.*|`readlink -e ${RC_SVCDIR}`"
 	no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
 	# RC_NO_UMOUNTS is an env var that can be set by plugins
 	local IFS="$IFS:"
Comment 30 i.Dark_Templar 2011-09-09 09:24:18 UTC
Created attachment 285921 [details]
Fixed mount-ro initscript

diff -u:
--- /etc/init.d/mount-ro.backup	2011-09-09 12:22:24.000000000 +0400
+++ /etc/init.d/mount-ro	2011-09-09 12:57:39.000000000 +0400
@@ -19,7 +19,7 @@
 	# We need the do_unmount function
 	. "$RC_LIBEXECDIR"/sh/rc-mount.sh
 	eindent
-	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
+	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|`readlink -e ${RC_SVCDIR}`" x= fs=
 	m="$m|/bin|/sbin|/lib|/libexec"
 	# RC_NO_UMOUNTS is an env var that can be set by plugins
 	local IFS="$IFS:"
Comment 31 i.Dark_Templar 2011-09-09 09:48:18 UTC
As I said, this 2 fixed scripts solved problem for me. Requires sys-apps/coreutils for "readlink" utility. I saw freebsd version of "readlink", it doesn't support required readlink options, but i found app called "realpath", which could fit too, and it's present at freebsd. Remaking initscripts soon.
Comment 32 Klaus Kusche 2011-09-09 09:51:52 UTC
(In reply to comment #26)
> Or, mountinfo can be  fixed so that it uses the realpath function to make sure
> that it is looking at a real directory instead of a symbolic link before it
> tries to match it against /proc/mounts.
> 
> This is the fix we have in commit e2f1464.
> 
> I will be releasing 0.9.3 with this fix shortly.

Just wondering (haven't looked at the code):

What mountinfo gets is a list of arbitrary grep regular expressions, 
not a pathname.
How do you apply realpath to a regex list 
(containing ".*", "|" and potentially other regex special chars)???
Comment 33 Klaus Kusche 2011-09-09 09:59:01 UTC
(In reply to comment #31)
> As I said, this 2 fixed scripts solved problem for me. Requires
> sys-apps/coreutils for "readlink" utility. I saw freebsd version of "readlink",
> it doesn't support required readlink options, but i found app called
> "realpath", which could fit too, and it's present at freebsd. Remaking
> initscripts soon.

`( cd ${RC_SVCDIR} ; /bin/pwd -P )` should give the same result without readlink,
at least in linux.
Comment 34 i.Dark_Templar 2011-09-09 10:00:13 UTC
Created attachment 285925 [details]
Fixed localmount initscript, with realpath

diff -u:
--- /etc/init.d/localmount.backup	2011-09-09 12:22:24.000000000 +0400
+++ /etc/init.d/localmount	2011-09-09 13:54:32.000000000 +0400
@@ -34,7 +34,7 @@
 stop()
 {
 	# We never unmount / or /dev or $RC_SVCDIR
-	local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
+	local x= no_umounts_r="/|/dev|/dev/.*|`realpath ${RC_SVCDIR}`"
 	no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
 	# RC_NO_UMOUNTS is an env var that can be set by plugins
 	local IFS="$IFS:"
Comment 35 i.Dark_Templar 2011-09-09 10:01:16 UTC
Created attachment 285927 [details]
Fixed mount-ro initscript, with realpath

diff -u:
--- /etc/init.d/mount-ro.backup	2011-09-09 12:22:24.000000000 +0400
+++ /etc/init.d/mount-ro	2011-09-09 13:53:51.000000000 +0400
@@ -19,7 +19,7 @@
 	# We need the do_unmount function
 	. "$RC_LIBEXECDIR"/sh/rc-mount.sh
 	eindent
-	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
+	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|`realpath ${RC_SVCDIR}`" x= fs=
 	m="$m|/bin|/sbin|/lib|/libexec"
 	# RC_NO_UMOUNTS is an env var that can be set by plugins
 	local IFS="$IFS:"
Comment 36 i.Dark_Templar 2011-09-09 10:22:46 UTC
(In reply to comment #33)
> `( cd ${RC_SVCDIR} ; /bin/pwd -P )` should give the same result without
> readlink,
> at least in linux.

Worked on FreeBSD too (not Gentoo/FreeBSD). I guess one of this versions should be used for final fix:

1) Klaus Kusche:
`( cd ${RC_SVCDIR} ; /bin/pwd -P )` instead of ${RC_SVCDIR}
in localmount and mount-ro scripts
and add sys-apps/coreutils at Gentoo/Linux and (i guess, don't know exactly) sys-freebsd/freebsd-bin at Gentoo/Fbsd as dependencies for OpenRC.

2) i.Dark_Templar:
`realpath ${RC_SVCDIR}` instead of ${RC_SVCDIR}
in localmount and mount-ro scripts
and add app-misc/realpath at Gentoo/Linux and (i guess, don't know exactly) sys-freebsd/freebsd-bin at Gentoo/Fbsd as dependencies for OpenRC.

These two versions of fix are good for me.

However, i guess there is real problem is in parameter '--skip-point-regex "$m"' of function call of "do_unmount", but i don't know how exactly this works to fix it. OpenRC doesn't resolve paths for this parameter '--skip-point-regex "$m"', so two suggested fixes make path resolving before sending this parameter to function. I guess what tried to do William Hubbs was make path resolving inside this function "do_unmount", but somehow it didn't work (or worked in other place, not related to this bug).
Comment 37 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-09-09 14:01:43 UTC
(In reply to comment #11)
> 2.) Resolve the given path to the actual directory before mounting
> (by using "realpath" or "cd" followed by "/bin/pwd -P").

pwd is a shell builtin, too. At least in bash, dash and zsh it can be used without the /bin/pwd from coreutils.
Comment 38 Klaus Kusche 2011-09-09 14:14:28 UTC
(In reply to comment #37)
> (In reply to comment #11)
> > 2.) Resolve the given path to the actual directory before mounting
> > (by using "realpath" or "cd" followed by "/bin/pwd -P").
> 
> pwd is a shell builtin, too. At least in bash, dash and zsh it can be used
> without the /bin/pwd from coreutils.

That's right. But not all shells support -P (bash does).
And without -P, most shell pwd commands just echo $PWD.
Comment 39 i.Dark_Templar 2011-09-09 14:17:16 UTC
My fault for reading comments sometimes superficially. Looks like my way of fixing was proposed by Klaus Kusche in comment #11.
Comment 40 tman 2011-09-09 14:24:24 UTC
wow sometime some bug are heavy then a virus.
Comment 41 Jouni Rinne 2011-09-10 04:03:38 UTC
Openrc-0.9.3 did not, repeat, did *not* solve this. The output on shutdown seems a bit different, but the result is same: root is unmounted uncleanly and needs recovery on next reboot.
Comment 42 jannis 2011-09-10 07:42:23 UTC
One more "I'm affected, too". openrc-0.9.3, SIGTERM on shutdown, fsck of root on reboot.
The desktop-machine where this happens mounts root crypted via initrd and later three partitions via dmcrypt. The laptop that doesn't have the symptoms has only root encrypted and doesn't use dmcrypt.
Comment 43 Jouni Rinne 2011-09-10 07:55:23 UTC
(In reply to comment #41)
> Openrc-0.9.3 did not, repeat, did *not* solve this. The output on shutdown
> seems a bit different, but the result is same: root is unmounted uncleanly and
> needs recovery on next reboot.

Maybe I should clarify somewhat, too: amd64 system here, no encryption, but root is a part of a raid1 array.
Comment 44 Albert W. Hopkins 2011-09-10 16:45:59 UTC
sys-apps/openrc-0.9.3 did not appear to fix this for me, and in fact seems to have made things worse, because before only the rootfs needed fscking on reboot, but since 0.9.3 there are other filesystems that require fscking too.
Comment 45 William Hubbs gentoo-dev 2011-09-10 17:21:35 UTC
(In reply to comment #32)
> Just wondering (haven't looked at the code):
> 
> What mountinfo gets is a list of arbitrary grep regular expressions, 
> not a pathname.
> How do you apply realpath to a regex list 
> (containing ".*", "|" and potentially other regex special chars)???

You don't, and this is the actual underlying issue for this bug, not the scripts.

Mountinfo had two issues. The first was that it wasn't identifying mount points correctly in the presence of symbolic links. This was fixed by the commit mentioned in comment #26.

The issue now is that it compares the regular expressions for the -P option, and possibly others, to the value realpath returns for the link, and this isn't accurate in all situations.

I am not comfortable with the patches to the scripts proposed on this bug, because they do not really address the root cause.
Comment 46 i.Dark_Templar 2011-09-10 17:55:41 UTC
(In reply to comment #45)
> I am not comfortable with the patches to the scripts proposed on this bug,
> because they do not really address the root cause.

Even while I proposed these patches, I strongly agree with that your sentence. As I said earlier, I think the root of bug is that parameter '--skip-point-regex "$m"' of function call 'do_unmount' isn't resolving symlinks inside paths that are contained inside '$m'. These functions calls using that parameter exist in localmount and mount-ro.
Comment 47 Christian Ruppert (idl0r) gentoo-dev 2011-09-10 18:43:27 UTC
Note that the *arg* (only one!) of -P or -p (mountinfo) will never be passed to
realpath() so in any case you have to pick the real/actual-path first.

We "can't" and I'm sure we won't translate the regex first to "guess" which
path you really mean.
Comment 48 i.Dark_Templar 2011-09-10 20:52:09 UTC
Created attachment 286079 [details, diff]
Patch to resolve symlinks inside regexps in mountinfo

I've made patch to resolve symlinks in regexps. But there are some flaws:
1. It supports only simple regexp delimiters (like '|' used in localmount and mount-ro scripts)
2. Currently link resolving enabled for all regexp types. Maybe it should be remade to support only in those regexps, which certainly require path resolving (like only --skip-point-regex or --point-regex).
3. First time I applied this patch I've got some error about regexps at shutdown (and didn't cleanly unmount root because of that), but it never happened again. That's why it needs testing and (probably) improvement.

So, this is a test version and/or proof-of-concept. Please test it, modify (as needed) and then apply (if it's good enough).
Comment 49 i.Dark_Templar 2011-09-10 21:13:45 UTC
Update: Sometimes it still shows error about regexp and [ or ] delimiters, looks like at localmount (not sure where exactly). But still I get work done and clean reboots. I guess it could be fixed with making this symlinks resolving applied only to regexps which certainly require it (as I said earlier, like --skip-point-regex or --point-regex). But first I'd like to know if this way of fixing is good enough or should we search better/cleaner way of fixing this bug?
Comment 50 Robert Cabrera 2011-09-10 23:19:47 UTC
Let me first say that I'm not a programmer. I'm just a 49 year old truck driver / computer hobbyist who's been running Gentoo ~ arches (and posting bug reports) for over 8 years.

As end-user I'm growing increasingly frustrated. I need to vent for a moment.

To me the entire openrc-9.x inclusion into the tree has been a debacle. Every version has introduced some new major or minor bug. Those who updated early last week killed their boxes and had to chroot to get back. Then there is the "deprecated opts" error messages. Now there's the "SIGTERM" on shutdown or reboot. This has become more than annoying. Three versions in a week and still no resolution in sight.

No one looks forward to booting-up and finding their machine fscking any file system and that's what is greeting us at the moment. On top of that I'm now getting clock skew because of the forcible way my machine is shutting down. If I wanted to hose my system I could just push the "off button" and live with the consequences. I don't expect start-up and shut-down scripts to do so.

Why doesn't something as important as the baselayout of a Gentoo system have a dedicated overlay to sort these kinds of issues out before injecting them into the portage tree? It seems like the logical thing to do. Most major packages go through this process with examples being Xorg, KDE, Gnome. Mozilla, and Libre (open) Office, and these aren't nearly as important as the baselayout of the system. Why not do so here?

Regardless of whether one is running a server or desktop machine, nothing is more important than the ability to boot-up or shut-down safely without seriously damaging their system. I don't know nor understand what new features this version includes, but what I do know, is as it stands now, this version is seriously flawed and shouldn't be out in the wild.

For now, I'm going to mask all versions of openrc-9.x until I see these serious problems have been resolved.

PS. I don't need any lectures about "this is what I get for running ~". I know what I'm doing and accept the risks. As I stated, I've been running ~ for many years. Before that I ran Mandrake cooker, I was a beta tester on Compuserve for Windows 95, then on NT, and '98 before I seeing the light and switching to Linux.

Rant over!!!

Have a great day!!! :-)
Comment 51 William Hubbs gentoo-dev 2011-09-11 00:11:21 UTC
Hello Robert,

(In reply to comment #50)
> Let me first say that I'm not a programmer. I'm just a 49 year old truck driver
> / computer hobbyist who's been running Gentoo ~ arches (and posting bug
> reports) for over 8 years.

Just about as long as I have been using the distro, and I have been a developer for 7.

> As end-user I'm growing increasingly frustrated. I need to vent for a moment.
> 
> To me the entire openrc-9.x inclusion into the tree has been a debacle. Every
> version has introduced some new major or minor bug. Those who updated early
> last week killed their boxes and had to chroot to get back. Then there is the
> "deprecated opts" error messages. Now there's the "SIGTERM" on shutdown or
> reboot. This has become more than annoying. Three versions in a week and still
> no resolution in sight.

Yes, the first bug you mentioned was an issue, but it was fixed within hours of the release. I personally do not have a lot of experience with PAM, so we had to get our pam expert involved in that bug.

The deprecation messages are warnings for others to fix their packages; this is not an openrc error. As soon as other developers fix their packages, those messages will disappear. They are just displayed, but the packages still work.

Regarding the third bug you mentioned, if you have been following it, you know that we have been working to get it fixed.  I am about to add a separate comment with my decision just now to show that we did get it taken care of.

> No one looks forward to booting-up and finding their machine fscking any file
> system and that's what is greeting us at the moment. On top of that I'm now
> getting clock skew because of the forcible way my machine is shutting down. If
> I wanted to hose my system I could just push the "off button" and live with the
> consequences. I don't expect start-up and shut-down scripts to do so.
> 
> Why doesn't something as important as the baselayout of a Gentoo system have a
> dedicated overlay to sort these kinds of issues out before injecting them into
> the portage tree? It seems like the logical thing to do. Most major packages go
> through this process with examples being Xorg, KDE, Gnome. Mozilla, and Libre
> (open) Office, and these aren't nearly as important as the baselayout of the
> system. Why not do so here?

All of those that you mention are multiple package systems afaik. There isn't a reason that I can think of to have a separate overlay for a single package. That is why we have ~. There will be bugs in ~ sometimes, some more severe than others. The best we can do is respond as quickly as possible to fix them.

I'm sorry this one took as long as it did and lead to this much frustration for you.

> Regardless of whether one is running a server or desktop machine, nothing is
> more important than the ability to boot-up or shut-down safely without
> seriously damaging their system. I don't know nor understand what new features
> this version includes, but what I do know, is as it stands now, this version is
> seriously flawed and shouldn't be out in the wild.
>
> PS. I don't need any lectures about "this is what I get for running ~". I know
> what I'm doing and accept the risks. As I stated, I've been running ~ for many
> years. Before that I ran Mandrake cooker, I was a beta tester on Compuserve for
> Windows 95, then on NT, and '98 before I seeing the light and switching to
> Linux.

From what I am reading here, It sounds like you are pretty uncomfortable accepting risks for your  baselayout/openrc packages, so I recommend that you run stable for those.

Again, sorry about the frustration. :-)
Comment 52 jannis 2011-09-11 09:19:01 UTC
openrc-0.9.3-r1 fixes it here for me. Thanks for the work :D
Comment 53 Christian Ruppert (idl0r) gentoo-dev 2011-09-11 13:20:05 UTC
Created attachment 286123 [details, diff]
openrc-0.9.3-r1.ebuild.patch

This reverts the last commit by WilliamH to its previous state without the workaround for this bug.

Add PORTDIR_OVERLAY="/usr/local/portage" to your make.conf
mkdir -p /usr/local/portage/sys-apps
cd /usr/local/portage/sys-apps
cp -a /usr/portage/sys-apps/openrc .
cd openrc
wget <patch>
patch -p0 < openrc-0.9.3-r1.ebuild.patch
repoman manifest
Comment 54 Christian Ruppert (idl0r) gentoo-dev 2011-09-11 13:21:30 UTC
Created attachment 286125 [details, diff]
0001-Fix-regex-pattern-for-umounts-during-shutdown.patch

mkdir -p /etc/portage/patches/sys-apps/openrc-0.9.3-r1
wget <patch> -O /etc/portage/patches/sys-apps/openrc-0.9.3-r1/0001-Fix-regex-pattern-for-umounts-during-shutdown.patch

emerge "=sys-apps/openrc-0.9.3-r1"
Verify that 0001-Fix-regex-pattern-for-umounts-during-shutdown.patch has been applied and then reboot.
Comment 55 William Hubbs gentoo-dev 2011-09-11 19:59:45 UTC
(In reply to comment #53)
> Created attachment 286123 [details, diff]
> openrc-0.9.3-r1.ebuild.patch
> 
> This reverts the last commit by WilliamH to its previous state without the
> workaround for this bug.
> 
> Add PORTDIR_OVERLAY="/usr/local/portage" to your make.conf
> mkdir -p /usr/local/portage/sys-apps
> cd /usr/local/portage/sys-apps
> cp -a /usr/portage/sys-apps/openrc .
> cd openrc
> wget <patch>
> patch -p0 < openrc-0.9.3-r1.ebuild.patch
> repoman manifest

I looked this over, and this patch is similar to the ones proposed in the comments above. It doesn't fix what I see as the root cause; it is a workaround.
Comment 56 Christian Ruppert (idl0r) gentoo-dev 2011-09-11 20:36:51 UTC
I think you misunderstood something..
Those two patches belong together. The ebuild patch is to make sure the problem occurs again and the second one is to fix the root cause.
Comment 57 Duncan 2011-09-11 20:42:41 UTC
(In reply to comment #52)
> openrc-0.9.3-r1 fixes it here for me. Thanks for the work :D

I'll leave deciding which patches are proper to others, but FWIW, with 0.9.3-r1 it's working here, too. =:^)
Comment 58 Robert Cabrera 2011-09-12 01:01:05 UTC
@William Hubbs Since I'm not a programmer, I don't understand what this latest revision (0.9.3-r1) does or what it fixes. All I can say is that it works now and thank you for getting it out!!!!

keep up the good work!!!

Ciao
Robert
Comment 59 tman 2011-09-14 07:55:02 UTC
this workaround only work sometimes. i get this problem again. and it show errors again after boot.
Comment 60 Christian Ruppert (idl0r) gentoo-dev 2011-09-14 15:15:09 UTC
(In reply to comment #59)
> this workaround only work sometimes. i get this problem again. and it show
> errors again after boot.

Please try the current -9999 version to see if that fixes your problem.
Comment 61 tman 2011-09-15 22:59:49 UTC
no 9999 ebuild also have problem.

it mount system and tried to repair on every start and delete sth from disc. this bug is so nasty.

after mounting system. kernel seem to be freeze and any action is so slow like a real virus.

can someone confirm it too that the system is often freezing incompare to before? 

in addition to this a downgrade to openrc-8.3 also dont help it reproduce also error on mount. so it must be be sth in the /ect/init.d/ folder which messup the system and let this have this problem
Comment 62 Christian Ruppert (idl0r) gentoo-dev 2011-09-16 17:16:51 UTC
Please attach your rc.log and/or more important would be the console output (If you can setup a serial console for loggin, or netconsole (kernel module, CONFIG_NETCONSOLE))
Comment 63 SpanKY gentoo-dev 2011-09-30 17:26:26 UTC
thinking a bit more, we'll probably want to keep RC_SVCDIR at the same path, but symlink it to /run/openrc.  which means we'll need the symlink resolution logic.  doing a sed on the path with some assumptions about where its installed isn't going to fly (and i suspect it breaks already on other multilib configurations).
Comment 64 i.Dark_Templar 2011-10-20 14:17:55 UTC
What's about bug status? 0.9.4 runs good for me.
Comment 65 William Hubbs gentoo-dev 2012-01-06 23:26:48 UTC
(In reply to comment #64)
> What's about bug status? 0.9.4 runs good for me.

Since there has been no more activity on this bug, and 0.9.4 is stable, I am closing this bug.
Comment 66 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-01-07 02:37:25 UTC
Actually closing
Comment 67 Jacques Landru 2012-02-23 17:04:36 UTC
On a personal amd64 mutlilib arch  liveDVD (built with catalyst) problem still here (with openrc-0.9.4 or 0.9.8.4) when shutting down


...
* Unmounting filesystems
*   Unmounting /mnt/livecd/lib64/rc/init.d ...
* rc: caught SIGTERM, aborting
* localmount: caught SIGTERM, aborting

So unable to terminate cleanly the liveDVD shutdown and then eject the DVD.