Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 260272 - mount-boot.eclass sed for read-only /boot broken
Summary: mount-boot.eclass sed for read-only /boot broken
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 17:31 UTC by Joe User
Modified: 2009-02-27 01:53 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe User 2009-02-25 17:31:36 UTC
The sed to detect if /boot is mounted read-only breaks if the errors-option is set.


Reproducible: Always

Steps to Reproduce:
1. gentoo-hardened-unstable hostsystem


2. installing gentoo-hardened-stable in chroot
mkdir -p /mnt/gentoo
mount -t xfs -o noatime /dev/sda4 /mnt/gentoo
mkdir -p /mnt/gentoo/boot
mount -t ext2 -o noatime /dev/sda1 /mnt/gentoo/boot
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
[[ -e /proc/sys/kernel/grsecurity ]] && for i in /proc/sys/kernel/grsecurity/chroot_deny_*; do echo 0 > ${i}; done
chroot /mnt/gentoo /bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' PATH=/sbin:/bin:/usr/sbin:/usr/bin /bin/bash +h
grep -v rootfs /proc/mounts > /etc/mtab
env-update
source /etc/profile
awk '{ print $2, $4 }' /proc/mounts | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }'
/boot rw,noatime,errors=continue


3. installing grub
gcc-config 5
source /etc/profile
emerge grub


Actual Results:  
The sed in the following line in mount-boot.eclass breaks the grub install:
local proc_ro=$(awk '{ print $2, $4 }' /proc/mounts | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )

Leading to this error-message:
 * Your boot partition, detected as being mounted as /boot, is read-only.
 * Remounting it in read-write mode ...
 *
mount: permission denied
 *
 * Unable to remount in rw mode. Please do it manually!
 *
 *
 * ERROR: sys-boot/grub-0.97-r6 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called pkg_preinst
 *             environment, line 2739:  Called mount-boot_pkg_preinst
 *             environment, line 2575:  Called mount-boot_mount_boot_partition
 *             environment, line 2541:  Called die
 * The specific snippet of code:
 *                   die "Can't remount in rw mode. Please do it manually!";
 *  The die message:
 *   Can't remount in rw mode. Please do it manually!
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/sys-boot/grub-0.97-r6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-boot/grub-0.97-r6/temp/environment'.
 *
!!! FAILED preinst: 1


Expected Results:  
Correct detection of read-only mounted /boot

emerge --info
Portage 2.1.6.7 (hardened/linux/x86/2008.0, gcc-3.4.6-vanilla, glibc-2.6.1-r0, 2.6.28-hardened i686)
=================================================================
System uname: Linux-2.6.28-hardened-i686-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_5600+-with-glibc2.3.2
Timestamp of tree: Wed, 25 Feb 2009 15:15:01 +0000
app-shells/bash:     3.2_p39
dev-lang/python:     2.5.2-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -mtune=i686 -fomit-frame-pointer -fforce-addr"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -mtune=i686 -fomit-frame-pointer -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl bcmath bzip2 caps cgi crypt exif expat fam fastcgi ftp gd gdbm gmp graphviz hardened iconv idn imap jpeg libwww mhash mime mysql mysqli nocxx nptl pcre perl pic png posix python readline sasl session sharedmem sockets spl sse ssl svg symlink tcl tcpd threads tiff tokenizer truetype unicode x86 xattr xml xmlrpc xsl zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1        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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt intel       mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage      siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware    voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-02-26 14:54:35 UTC
Reassigning to base-system herd.
Comment 2 SpanKY gentoo-dev 2009-02-27 01:53:45 UTC
should be fixed now, thanks for the report

http://sources.gentoo.org/eclass/mount-boot.eclass?r1=1.15&r2=1.16