Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 526754 - sys-apps/util-linux: libmount does not handle kernel command line options specified more than once
Summary: sys-apps/util-linux: libmount does not handle kernel command line options spe...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo's Team for Core System packages
URL: http://thread.gmane.org/gmane.linux.u...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-25 14:27 UTC by Ulenrich
Modified: 2015-03-12 03:49 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
strace-output.log (mount.log,29.09 KB, text/x-log)
2014-10-29 08:34 UTC, Ulenrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulenrich 2014-10-25 14:27:57 UTC
Using the output of /bin/mount to find the root partition 
gives me nonsense:
$ mount |grep sda
/dev/sda7 on / type ext4 (rw,relatime,data=ordered)
/dev/sda3 on /media/debian type ext4 (rw,relatime,data=ordered)
/dev/sda8 on /common type ext4 (rw,relatime,data=ordered)
---
The first root=/dev/sda occurence given at /usr/src/.config hardcoded is
root=/dev/sda7 , the second given from gummiboot (efi grub like starter)
in cmdline is:
$ cat /proc/cmdline
rootfstype=ext4 init=/sbin/systemd root=/dev/sda7 net.ifnames=0  systemd.unit=default.target init=/sbin/systemd root=/dev/sda4 rootfstype=ext4 net.ifnames=0 quiet systemd.show_status=1 systemd.log_level=3 acpi_backlight=vendor acpi_osi=Linux
---
My /etc/mtab is a link to ../proc/self/mounts on a systemd 
# cat /etc/mtab
rootfs / rootfs rw 0 0
---
$ mountpoint -d /
8:4
---
which is actual root=/dev/sda4
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-25 16:55:13 UTC
1 ) Please post your `emerge --info' output in a comment.

2 ) Please describe exactly:
2a) what mount output /should/ look like and

2b) what mount output /does/ look like.
Comment 2 Ulenrich 2014-10-26 17:19:52 UTC
It looks like it finds the root partition:
$ mount
/dev/sda7 on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=1886824k,nr_inodes=471706,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/f...
----
But it just out puts the first of /proc/cmdline root= occurence. This is an upstream bug. This phenomenon shows up also using Debian-unstable.

mount
should do something I found googling:
# cat /usr/local/bin/myroot
#!/bin/bash
R=$(stat -c '%04D' / )
for f in $(find /dev -type b 2>/dev/null) ; do
    C=$(stat -c '%02t%02T' $f )
    [ "$C" = "$R" ] && ROOTDEVICE="$f" && break
done
echo $ROOTDEVICE
---
which exactly shows the root partition. Even a chroot partition.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-26 23:01:50 UTC
(In reply to Jeroen Roovers from comment #1)
> 1 ) Please post your `emerge --info' output in a comment.
Comment 4 Ulenrich 2014-10-27 09:19:59 UTC
# emerge --info
Portage 2.2.14 (python 3.4.2-final-0, unavailable, gcc-4.8.3, glibc-2.19-r1, 3.17-1.towo.2-siduction-amd64 x86_64)                                                                             
=================================================================                                                                                                                              
System uname: Linux-3.17-1.towo.2-siduction-amd64-x86_64-Intel-R-_Core-TM-2_Duo_CPU_P8700_@_2.53GHz-with-gentoo-2.2                                                                            
KiB Mem:     3790692 total,   1601096 free                                                                                                                                                     
KiB Swap:    5242876 total,   5242876 free                                                                                                                                                     
Timestamp of tree: Mon, 27 Oct 2014 08:45:01 +0000                                                                                                                                             
ld GNU ld (GNU Binutils) 2.24                                                                                                                                                                  
app-shells/bash:          4.2_p53                                                                                                                                                              
dev-java/java-config:     2.2.0                                                                                                                                                                
dev-lang/perl:            5.18.2-r2                                                                                                                                                            
dev-lang/python:          2.7.8, 3.4.2                                                                                                                                                         
dev-util/cmake:           2.8.12.2-r1                                                                                                                                                          
dev-util/pkgconfig:       0.28-r2                                                                                                                                                              
sys-apps/baselayout:      2.2                                                                                                                                                                  
sys-apps/sandbox:         2.6-r1                                                                                                                                                               
sys-devel/autoconf:       2.13, 2.69                                                                                                                                                           
sys-devel/automake:       1.11.6, 1.14.1                                                                                                                                                       
sys-devel/binutils:       2.24-r3                                                                                                                                                              
sys-devel/gcc:            4.8.3                                                                                                                                                                
sys-devel/gcc-config:     1.8                                                                                                                                                                  
sys-devel/libtool:        2.4.2-r1                                                                                                                                                             
sys-devel/make:           4.1-r1                                                                                                                                                               
sys-kernel/linux-headers: 3.16 (virtual/os-headers)                                                                                                                                            
sys-libs/glibc:           2.19-r1
Repositories:

gentoo
    location: /common/portdir
    sync-type: rsync
    sync-uri: rsync://rsync11.de.gentoo.org/gentoo-portage
    priority: 5

pmaci
    location: /common/pmaci
    masters: gentoo
    priority: 7

ABI="amd64"
ABI_X86="32 64"
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Broadcom google-chrome FraunhoferFDK googleearth NVIDIA-CUDA"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ALSA_CARDS="hda-intel"
ANT_HOME="/usr/share/ant"
APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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"
ARCH="amd64"
AUTOCLEAN="yes"
BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_3 python_targets_python2_7 multilib"
CALLIGRA_FEATURES="braindump flow karbon sheets stage words krita"
CBUILD="x86_64-pc-linux-gnu"
CDPATH=".:/common:/portable:"
CFLAGS="   -march=native -O3 "
CFLAGS_amd64="-m64"
CFLAGS_x32="-mx32"
CFLAGS_x86="-m32"
CHOST="x86_64-pc-linux-gnu"
CHOST_amd64="x86_64-pc-linux-gnu"
CHOST_x32="x86_64-pc-linux-gnux32"
CHOST_x86="i686-pc-linux-gnu"
CLEAN_DELAY="5"
COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
COLLISION_IGNORE="/lib/modules/* *.py[co] *$py.class */dropin.cache"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
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"
CXXFLAGS=" -march=native -O3 "
DEFAULT_ABI="amd64"
DISPLAY=":0"
DISTDIR="/common/distfiles"
DRACUT_MODULES="crypt systemd dmsquash-live"
DVB_CARDS="af9005 bcm3510 cx18 cx231xx cx23885 dibusb-usb2 mpc718 nxt200x opera1 or51132 or51211 pvrusb2 sp8870 sp887x tda10045 tda10046 tda10046lifeview ttpci ttusb-dec usb-a800 usb-af9015 usb-bluebird usb-dib0700 usb-dtt200u usb-dw2104 usb-umt usb-vp702x usb-vp7045 usb-wt220u vp7041"
EDITOR="/bin/nano"
ELIBC="glibc"
EMERGE_DEFAULT_OPTS="    --quiet-build=y --binpkg-respect-use=y --with-bdeps=y --verbose-conflicts --verbose --color=y --alphabetical --ask-enter-invalid --jobs=1 --ask=y --nospinner"
EMERGE_WARNING_DELAY="10"
ENLIGHTENMENT_MODULES="clock comp conf-applications conf-dialogs conf-edgebindings conf-interaction conf-intl conf-keybindings conf-menus conf-paths conf-performance conf-shelves conf-theme conf-window-manipulation conf-window-remembers cpufreq dropshadow everything fileman fileman-opinfo gadman ibar ibox illume2 mixer msgbus notification pager quickaccess start syscon systray tasks temperature tiling winlist wizard"
EPREFIX=""
EROOT="/"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
FETCHCOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""
FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; eval \"declare -a ssh_opts=(\${3})\" ; exec sftp -P \${port} \"\${ssh_opts[@]}\" \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port=22 ; exec rsync --rsh=\"ssh -p\${port} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FFLAGS="-O2 -pipe"
GCC_SPECS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
Comment 5 SpanKY gentoo-dev 2014-10-28 02:24:13 UTC
what does `cat /proc/self/mountinfo` show ?

post the output of `ls -l /dev/sda*`

run this command and attach the log file:
  strace -v -o log mountpoint -d /
Comment 6 Ulenrich 2014-10-28 19:38:39 UTC
# cat /proc/self/mountinfo
13 0 8:4 / / rw,relatime shared:1 - ext4 /dev/root rw,data=ordered
14 13 0:5 / /dev rw,relatime shared:2 - devtmpfs devtmpfs rw,size=1886824k,nr_inodes=471706,mode=755
15 13 0:13 / /sys rw,nosuid,nodev,noexec,relatime shared:5 - sysfs sysfs rw
16 13 0:3 / /proc rw,nosuid,nodev,noexec,relatime shared:11 - proc proc rw
17 15 0:14 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:6 - securityfs securityfs rw
18 14 0:15 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw
19 14 0:10 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
20 13 0:16 / /run rw,nosuid,nodev shared:12 - tmpfs tmpfs rw,mode=755
21 15 0:17 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:7 - tmpfs tmpfs ro,mode=755
22 21 0:18 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd
23 15 0:19 / /sys/fs/pstore ro,nosuid,nodev,noexec,relatime shared:9 - pstore pstore ro
24 15 0:20 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:10 - efivarfs efivarfs rw
25 21 0:21 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,cpuset
26 21 0:22 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,memory
27 21 0:23 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,devices
28 21 0:24 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,freezer
29 21 0:25 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,net_cls
30 21 0:26 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,blkio
31 21 0:27 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,perf_event
32 16 0:28 / /proc/sys/fs/binfmt_misc rw,relatime shared:20 - autofs systemd-1 rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
33 14 0:29 / /dev/hugepages rw,relatime shared:21 - hugetlbfs hugetlbfs rw
34 14 0:12 / /dev/mqueue
---
# mount
/dev/sda7 on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=1886824k,nr_inodes=471706,mode=755)                           
sysfs on /sys type sysfs 
...
---
my script of above found googling outputs:
# myroot 
/dev/sda4
---
You are likely to reproduce the bug, if you put via grub command 'e' in your 
cmdline something like in this specific order:
root=/dev/sdaY  root=/dev/sdaN
where Y is a wrong phantasie number and N is your real root.
Comment 7 SpanKY gentoo-dev 2014-10-28 20:56:36 UTC
do you have a /dev/root symlink ?

run `strace -o log -s 4096 -v mount` and attach the log file here
Comment 8 Ulenrich 2014-10-28 22:36:02 UTC
$ vdir /dev/roo*
Press any key to continue..
---
nothing.
Comment 9 SpanKY gentoo-dev 2014-10-29 04:20:38 UTC
(In reply to Ulenrich from comment #8)

you really should post all the commands requested and not just the first one
Comment 10 Ulenrich 2014-10-29 08:34:18 UTC
Created attachment 387704 [details]
strace-output.log

Can you reproduce the but by adding to the cmdline from grub?
Comment 11 Ulenrich 2014-10-29 14:42:21 UTC
I just saw:
http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/10110
that patch of Mike Frysinger applying works for me:
# mount
/dev/sda4 on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,rel ....
---
As I understand the patch it looks at the last occurence of root=xxx in
/proc/cmdline
as like the kernel does to take the desired root partition.
(What if we are in a chroot?)
Comment 12 Ulenrich 2014-10-29 19:22:03 UTC
That is cool:
The patch works when I chrooted from Debian sda3 to Gentoo sda4:
# mount
/dev/sda4 on / type ext4 (rw,relatime,data=ordered)
---
Comment 13 SpanKY gentoo-dev 2014-10-31 16:12:44 UTC
upstream has merged my patch.  next time there's a rev/ver bump i'll include it, but otherwise i don't plan on adding one specifically for this.  the impact is pretty low and trivial to work around.
Comment 14 SpanKY gentoo-dev 2015-03-12 03:49:53 UTC
fix is in 2.26 which is in the tree now