# [solved] installing grub failed

## midway

 *Quote:*   

> emerge --sync

  works fine.

 *Quote:*   

> emerge -avuDN --with-bdeps=y system

   says No outdated packages were found. 

However,  *Quote:*   

> emerge --update --newuse --deep @world

  finds 2 new updates one of which is grub and it fails to install. Here is the ouput:

```

make[2]: Leaving directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97/docs'

make[1]: Leaving directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97/docs'

make[1]: Entering directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97'

make[2]: Entering directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97'

make[2]: Nothing to be done for `install-exec-am'.

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97'

make[1]: Leaving directory `/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97'

 * PT PaX marking -m

 *      /var/tmp/portage/sys-boot/grub-0.97-r12/image//sbin/grub

>>> Completed installing grub-0.97-r12 into /var/tmp/portage/sys-boot/grub-0.97-r12/image/

strip: i686-pc-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line

   bin/mbchk

   sbin/grub

ecompressdir: bzip2 -9 /usr/share/doc

ecompressdir: bzip2 -9 /usr/share/man

ecompressdir: bzip2 -9 /usr/share/info

>>> Installing (1 of 2) sys-boot/grub-0.97-r12

 *

 * To avoid automounting and auto(un)installing with /boot,

 * just export the DONT_MOUNT_BOOT variable.

 *

mount: special device /dev/sda1 does not exist

 *

 * Cannot automatically mount your /boot partition.

 * Your boot partition has to be mounted rw before the installation

 * can continue. grub needs to install important files there.

 *

 * ERROR: sys-boot/grub-0.97-r12 failed (preinst phase):

 *   Please mount your /boot partition manually!

 *

 * Call stack:

 *     ebuild.sh, line   85:  Called pkg_preinst

 *   environment, line 3630:  Called mount-boot_pkg_preinst

 *   environment, line 3306:  Called mount-boot_mount_boot_partition

 *   environment, line 3286:  Called die

 * The specific snippet of code:

 *                   die "Please mount your /boot partition manually!";

 *

 * If you need support, post the output of `emerge --info '=sys-boot/grub-0.97-r12'`,

 * the complete build log and the output of `emerge -pqv '=sys-boot/grub-0.97-r12'`.

 * The complete build log is located at '/var/tmp/portage/sys-boot/grub-0.97-r12/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/sys-boot/grub-0.97-r12/temp/environment'.

 * Working directory: '/var/tmp/portage/sys-boot/grub-0.97-r12'

 * S: '/var/tmp/portage/sys-boot/grub-0.97-r12/work/grub-0.97'

!!! FAILED preinst: 1

>>> Failed to install sys-boot/grub-0.97-r12, Log file:

>>>  '/var/tmp/portage/sys-boot/grub-0.97-r12/temp/build.log'

 * Messages for package sys-boot/grub-0.97-r12:

 *

 * To avoid automounting and auto(un)installing with /boot,

 * just export the DONT_MOUNT_BOOT variable.

 *

 *

 * Cannot automatically mount your /boot partition.

 * Your boot partition has to be mounted rw before the installation

 * can continue. grub needs to install important files there.

 *

 * ERROR: sys-boot/grub-0.97-r12 failed (preinst phase):

 *   Please mount your /boot partition manually!

 *

 * Call stack:

 *     ebuild.sh, line   85:  Called pkg_preinst

 *   environment, line 3630:  Called mount-boot_pkg_preinst

 *   environment, line 3306:  Called mount-boot_mount_boot_partition

 *   environment, line 3286:  Called die

 * The specific snippet of code:

 *                   die "Please mount your /boot partition manually!";

 *

 * GNU info directory index is up-to-date.

```

More info

```

~ # emerge -pqv '=sys-boot/grub-0.97-r12'

[ebuild     U ] sys-boot/grub-0.97-r12 [0.97-r10] USE="ncurses -custom-cflags -netboot -static"

!!! The following installed packages are masked:

- sys-apps/chpax-0.7::gentoo (masked by: package.mask)

/usr/portage/profiles/package.mask:

# Anthony G. Basile <blueness@gentoo.org> (26 Jul 2012)

# Removal in 30 days, bug #365825

~ # emerge --info '=sys-boot/grub-0.97-r12'

Portage 2.1.11.9 (hardened/linux/x86, gcc-4.5.3, glibc-2.15-r2, 2.6.28-hardened-r9 i686)

=================================================================

                        System Settings

=================================================================

System uname: Linux-2.6.28-hardened-r9-i686-Intel-R-_Xeon-R-_CPU_X5450_@_3.00GHz-with-gentoo-2.1

Timestamp of tree: Sun, 12 Aug 2012 23:15:01 +0000

app-shells/bash:          4.2_p20

dev-lang/python:          2.7.3-r2, 3.2.3

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.1

sys-devel/binutils:       2.22-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 3.1 (virtual/os-headers)

sys-libs/glibc:           2.15-r2

Repositories: gentoo x-portage

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /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"

CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-march=i686 -O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-march=i686 -O2 -pipe"

GENTOO_MIRRORS="http://ftp.fi.muni.cz/pub/linux/gentoo/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ http://gentoo.mirrors.tera-byte.com/ http://gentoo.mirror.dkm.cz/pub/gentoo/ rsync://mirror.cambrium.nl/gentoo/ http://mirror.datapipe.net/gentoo ftp://mirror.datapipe.net/gentoo"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j8"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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="/opt/portage"

SYNC="rsync://abc.co.uk/gentoo-portage"

USE="acl apache2 berkdb bzip2 cli cracklib crypt cups curl cxx dri gd gdbm gpm hardened iconv imap ipv6 jpeg modules mudflap mysql ncurses nls nptl nptlonly openmp pam pax_kernel pcre pic png pppd readline session snmp spell ssl tcpd tiff truetype unicode urandom x86 xml2 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 asis auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http rewrite setenvif speling status unique_id userdir usertrack vhost_alias cgi cgid" CALLIGRA_FEATURES="kexi words flow plan sheets 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware 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"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

Last edited by midway on Wed Sep 05, 2012 10:08 am; edited 1 time in total

----------

## mvaterlaus

hi

```

mount: special device /dev/sda1 does not exist

 *

 * Cannot automatically mount your /boot partition.

 * Your boot partition has to be mounted rw before the installation

 * can continue. grub needs to install important files there.

 *

 * ERROR: sys-boot/grub-0.97-r12 failed (preinst phase):

 *   Please mount your /boot partition manually!

 *

 * Call stack:

 *     ebuild.sh, line   85:  Called pkg_preinst

 *   environment, line 3630:  Called mount-boot_pkg_preinst

 *   environment, line 3306:  Called mount-boot_mount_boot_partition

 *   environment, line 3286:  Called die

 * The specific snippet of code:

 *                   die "Please mount your /boot partition manually!"; 

```

apperantly, emerge does not find the device /dev/sda1 and therefore can not mount it to install some important grub files. have you tried mounting the partition manually (it must be mounted rw) and then rerun the installation?

----------

## midway

```

~ # cat /proc/mounts

rootfs / rootfs rw 0 0

/dev/sda3 / xfs rw,noatime,attr2,noquota 0 0

none /proc proc rw 0 0

tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0

rc-svcdir /lib/rc/init.d tmpfs rw,nosuid,nodev,noexec,size=1024k,mode=755 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0

securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec 0 0

debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec 0 0

configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec 0 0

udev /dev tmpfs rw,nosuid,size=10240k,mode=755 0 0

fusectl /sys/fs/fuse/connections fusectl rw 0 0

devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0

none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0

usbfs /proc/bus/usb usbfs rw,nosuid,noexec,devgid=85,devmode=664 0 0

rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

nfsd /proc/fs/nfsd nfsd rw,nosuid,nodev,noexec 0 0

```

```

 ~ # cat /etc/fstab

/dev/sda1 /boot xfs defaults,noatime 1 2

/dev/sda2 swap swap sw 0 0

/dev/sda3 / xfs noatime 0 1

/dev/cdrom /mnt/cdrom auto defaults,noauto 0 0

none /proc proc defaults 0 0

none /dev/shm tmpfs nodev,nosuid,noexec,rw 0 0

```

```

 dev # ls

2:0:0:0          event3   megadev0            psaux     tgt    tty17  tty27  tty37  tty47  tty57  ttyS0    vcs3    vcsa12

agpgart          event4   mem                 ptmx      tty    tty18  tty28  tty38  tty48  tty58  ttyS1    vcs4    vcsa2

char             fb0      mice                pts       tty0   tty19  tty29  tty39  tty49  tty59  ttyS2    vcs5    vcsa3

console          fd       mouse0              random    tty1   tty2   tty3   tty4   tty5   tty6   ttyS3    vcs6    vcsa4

core             full     mouse1              rtc0      tty10  tty20  tty30  tty40  tty50  tty60  urandom  vcs7    vcsa5

cpu_dma_latency  fuse     network_latency     sg0       tty11  tty21  tty31  tty41  tty51  tty61  vcs      vcs8    vcsa6

dac960_gam       hpet     network_throughput  shm       tty12  tty22  tty32  tty42  tty52  tty62  vcs1     vcs9    vcsa7

device-mapper    initctl  null                snapshot  tty13  tty23  tty33  tty43  tty53  tty63  vcs10    vcsa    vcsa8

event0           kmem     oldmem              stderr    tty14  tty24  tty34  tty44  tty54  tty7   vcs11    vcsa1   vcsa9

event1           kmsg     parport0            stdin     tty15  tty25  tty35  tty45  tty55  tty8   vcs12    vcsa10  zero

event2           log      port                stdout    tty16  tty26  tty36  tty46  tty56  tty9   vcs2     vcsa11

```

Do you mean, mounting my sda1 to boot?

~ # mount /dev/sda1 /boot

----------

## mvaterlaus

yes, thats what i meant. after you mounted it, re-run the emerge of grub

----------

## midway

mvaterlaus, i have already tried that but it says that this drive doesn't exist. 

```

~ # mount /dev/sda1 /boot

mount: special device /dev/sda1 does not exist

```

----------

## mvaterlaus

ok, thats odd. there is an other possibilitie: maybe you have created the boot partition on the root filesystem, which i do not assume, since you have an entry in /etc/fstab for the boot partition

please post the output of following commands

```

fdisk -l /dev/sda

dmesg | grep sda

```

[edit]got rid of typos[/edit]

----------

## midway

both commands doesn't return anything.

----------

## mvaterlaus

thats very strange. I noticed something in your output of cat /proc/mounts and cat /etc/fstab

```

none /proc proc rw 0 0

none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0

```

```

none /proc proc defaults 0 0

none /dev/shm tmpfs nodev,nosuid,noexec,rw 0 0 

```

i checked it on my system and the entries in /etc/fstab are not included. maybe you can comment them out and reboot the system, or try to change them to the following:

```

proc /proc proc defaults 0 0

shm /dev/shm tmpfs nodev,nosuid,noexec,rw 0 0 

```

----------

## eccerr0r

Is this a virtual machine?

After mucking with them I frequently ran into this case where there is no /dev/sda* for some reason...

You could remove the /boot entry in your fstab to get past it and install the files on your root partition and then later deal with installing it on your boot partition once you get that resolved...

Also:  Kernel version/Udev version?

What kernel are you running and do you have the correct version of udev running that goes along with that kernel?  If it's really 2.6.28 in your emerge --info that's fairly old, you'll need to update that with a version of udev that matches (or downgrade udev)...

Udev 171 will work together with 2.6.38 and at least through 3.2.12 kernels...

----------

## midway

eccerr0r: yes this is on vmware and I am using kernel (Linux 2.6.36-hardened-r9) - Gentoo Base System release 2.1

I do not want to upgrade this kernel atm. How do I downgrade to a compatible udev (if 171 is not compatible with 2.6.36)?Last edited by midway on Tue Aug 21, 2012 9:07 am; edited 2 times in total

----------

## eccerr0r

Bah... virtual... sigh... oh don't mind me, just venting about virtuals... heh.

Anyway, according to the ebuild, 2.6.32 and newer should work with 171.  But if want to try downgrading, you can mask the latest version by adding 

>sys-fs/udev-1.64-r2

in /etc/portage/package.mask

and see if you can emerge the world.  However there are issues with downgrading udev, there are many packages out there that require newer udevs, so this could be bad.

Also one more thing is to make sure all kernel options are enabled...though I think that emerging udev does warn when you don't have all options enabled.

----------

## midway

thx eccerr0r, masking the package have solved the problem.

----------

