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

Bug 493546

Summary: sys-apps/openrc-0.12.4 cleans /run from root partition without checking /run is really on tmpfs
Product: Gentoo Hosted Projects Reporter: Honza <hkmaly>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Honza 2013-12-07 17:46:46 UTC
/etc/init.d/bootmisc script from sys-apps/openrc-0.12.4 cleans /run from root partition (by using mount --bind) without checking /run is really on tmpfs, meaning it can clean used /run by mistake.

Note that I did installed openrc-0.11 before (sys-apps/openrc-0.11.8) which was supposed to do some transition and still have no idea who is supposed to mount tmpfs on /run. Am I supposed to write it manually in /etc/fstab? Or is initramfs (which I'm not using) doing it? udev? pulseaudio :-)?

Reproducible: Always

Steps to Reproduce:
1. boot system :-)

Actual Results:  
bootmisc will remove live /run/openrc, leading to bug #493544

Expected Results:  
bootmisc should either mount tmpfs on /run itself, or check it was done before cleaning /run from root partition.

Note that few lines after "clean_run", there is similar line
mountinfo -q -f tmpfs /var/run || cleanup_var_run_dir
... I didn't looked what the mountinfo actually does, but it feels like just the check we need.

Portage 2.2.7 (hardened/linux/amd64, gcc-4.6.3-hardenednopie, glibc-2.11.2-r3, 3.0.6-gentoo-64 x86_64)
=================================================================
System uname: Linux-3.0.6-gentoo-64-x86_64-AMD_Athlon-tm-_64_Processor_3000+-with-gentoo-2.2
KiB Mem:     3296612 total,    375368 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Sat, 30 Nov 2013 12:45:02 +0000
ld GNU ld (GNU Binutils) 2.20.1.20100303
app-shells/bash:          4.2_p45
dev-java/java-config:     1.3.7-r1, 2.1.12-r1
dev-lang/python:          2.6.8-r3, 2.7.5-r3
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13::<unknown repository>, 2.68
sys-devel/automake:       1.4_p6-r1, 1.5-r1, 1.6.3-r1, 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.16.1-r3::<unknown repository>, 2.18-r3, 2.20.1-r1
sys-devel/gcc:            3.4.6-r2, 4.3.4, 4.4.6-r1, 4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.11.2-r3
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -mtune=athlon64"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /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 -pipe -mtune=athlon64"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo http://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo/ http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/ http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowex X Xaw3d aalib acl acpi alsa amd64 apache2 apm audiofile avi berkdb browserplugin bzip2 bzlib caps cdr cli cracklib crypt curl cxx dbase dbm dbx dga directfb divx4linux doc dri dvd dvdr encode esd ethereal exif fbcon flac flash gd gdbm ggi gif gpm gtk hardened iconv imagemagick imlib innodb ipv6 java jpeg justify lcms lesstif libcaca libwww lirc lzma lzo mad mailwrapper mbox mcal memlimit mhash mikmod mime ming mmap mmx mmx2 mng modules motif mozilla mp3 mpeg mudflap multilib multislot mysql ncurses nls nptl offensive oggvorbis openal opengl openmp oss pam pax_kernel pcntl pcre pdflib perl php plotutils png posix python qt quicktime readline real rtc samba sdl session shared sharedmem slang sndfile snmp sockets spell sqlite sse sse2 ssl sysvipc tcpd tetex theora tiff truetype unicode urandom usb v4l v4l2 vhosts videos wmf xinerama xml xosd xpm xsl xv xvid zip zlib" ABI_X86="64" 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" APACHE2_MODULES="access auth auth_dbm auth_anon auth_digest alias file-cache echo charset-lite cache disk-cache mem-cache ext-filter case_filter case-filter-in deflate mime-magic cern-meta expires headers usertrack unique-id proxy proxy-connect proxy-ftp proxy-http info include cgi cgid dav dav-fs vhost-alias speling rewrite log_config logio env setenvif mime status autoindex asis negotiation dir imap actions userdir so filter unique_id authz_host auth_basic authn_dbd authn_file authz_owner authz_user charset_lite dbd mem_cache" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" 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 ublox ubx" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en cs en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_6 python2_7" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="nv vesa r128 fbdev radeon nouveau" 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"
USE_PYTHON="2.6 2.7"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 William Hubbs gentoo-dev 2013-12-11 06:11:06 UTC
I am unable to reproduce this. Here is a little more explanation of
clean_run and why it shouldn't happen.

1. The bind mount mounts / to a temporary directory which I will call
tmpdir for the sake of discussion.
2. Bind mounts are not recursive, so /tmpdir/run is not the same as
/run. It is what would be under the tmpfs mounted at /run.
3. There should be nothing in /tmpdir/run/*, so that is what we remove,
not /run/*, so I'm uncertain how /run/* ended up empty.
Comment 2 Honza 2013-12-11 09:56:03 UTC
I already explained that there is no tmpfs mounted on my /run. I'm not sure why, might've been because I didn't do the transition to openrc/baselayout-2 correctly or because I have hand-compiled kernel. I'm saying that instead of assuming that the tmpfs is mounted it would be better to check before starting something so destructive.