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

Bug 92748

Summary: [debianutils] mkboot script unwisely depends upon [util-linux] rdev utility
Product: Gentoo Linux Reporter: kfm
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED UPSTREAM    
Severity: normal CC: infowolfe
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=315303
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: sys-apps/debianutils-1.16.7-r5.ebuild
debianutils-1.16.7-mkboot-nordev.patch

Description kfm 2005-05-15 18:18:44 UTC
The /usr/sbin/mkboot script provided by sys-apps/debianutils uses the following method to determine the root device:

rootpart=$(rdev | cut -d ' ' -f 1)

However, the rdev tool only seems to be provided when sys-apps/util-linux is built upon "intel" (i.e. ia32/x86) platforms. That particular issue was touched upon in bug 35902. I only became aware of this issue because I was privy to the matter as raised by an amd64 user. I think that the method used is poor and propose an alternative as follows:

rootpart=$(grep -o "root=[^ ]*" /proc/cmdline | cut -d= -f2)

I'm not sure whether that's the best way to go about it but it's certainly the more "agnostic" approach. I'll attach the proposed ebuild and patch.
Comment 1 kfm 2005-05-15 18:20:11 UTC
Created attachment 58977 [details]
sys-apps/debianutils-1.16.7-r5.ebuild
Comment 2 kfm 2005-05-15 18:21:19 UTC
Created attachment 58978 [details, diff]
debianutils-1.16.7-mkboot-nordev.patch

This patch implements the alternate method of determining the root device as
mentioned above.
Comment 3 SpanKY gentoo-dev 2005-06-16 17:09:58 UTC
debianutils-2.x has 'better' rdev handling ...

your rootpart grep looks pretty good, could you please e-mail that to the debian
bug site ?
http://www.debian.org/Bugs/Reporting
Comment 4 kfm 2005-06-21 12:02:07 UTC
Thanks SpanKY. I've done exactly that; I'll post back here if anything comes of it.
Comment 5 kfm 2005-06-21 12:17:27 UTC
Here's the BTS link: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=315303
Comment 6 kfm 2005-06-21 20:27:27 UTC
Clint Adams accepted a fix for the package upstream (thanks Clint!). Not sure
how it will propagate in terms of package versions/releases (should probably
read up on their policy one of these days). I presume that the fix will somewhat
resemble the suggestion I made:

if [ $(mount | grep -o "^proc") ] && [ -e /proc/cmdline ]; then
       rootpart=$(grep -o "root=[^ ]*" /proc/cmdline | cut -d = -f 2)
else
       which rdev >/dev/null && rootpart=$(rdev | cut -d ' ' -f 1)
fi

Thus, the existing behaviour is supported as a fallback in the case that it
doesn't appear possible to establish the root device from the /proc filesystem.
Comment 7 SpanKY gentoo-dev 2005-06-21 20:44:35 UTC
we watch http://packages.debian.org/unstable/base/debianutils.html

when that version gets updated, we update the ebuild
Comment 8 kfm 2005-06-21 20:56:01 UTC
Sure thing, thanks. Damn, I just realised that it could have been made to work
in a chroot also:

[ $(mount | grep -Ec "^(none|proc) on /proc type proc") -gt 0 ] && [ -e
/proc/cmdline ]
Comment 9 kfm 2005-07-02 09:11:47 UTC
Bump. It's fixed in >=debianutils-2.14 (where 2.14.1 is currently available). So
this should be closed once it's in portage.
Comment 10 SpanKY gentoo-dev 2005-07-02 10:36:16 UTC
2.14.1 now in portage, thanks