"emerge grub" does not install grub files if these allready exist in "/lib/grub" or "/usr/lib/grub". Thus any update will return the old grub installed before. The files in "/lib/grub" will only be copied if they do not exist allready in "/boot/grub". Same for "/usr/lib/grub": if the files exist in "/boot/grub" they are not copied. If you clean "/boot/grub" ("rm /boot/grub/*stage* nbgrub pxegrub") "emerge grub" will only copy the files in "/lib/grub". Emerging again, the files in "/usr/lib/grub" are installed. Emerging a third time nothing is copied. This bug seems to exist a longer time unseen. I have tried: - grub-0.92 - grub-0.94 - grub-0.95 - grub-0.96 - grub-0.96-r1 - grub-0.96-r2 - grub-0.96-r3 I didn't came to test "grub-0.97", but I am quite sure this bug is there too! Reproducible: Always Steps to Reproduce: 1. Install an older grub (or have an older version already installed). 2. emerge grub (or if you wish "emerge -u grub") 3. reboot Actual Results: The older version of grub remained. Expected Results: The just emerged, new version being active. Portage 2.0.51.22-r2 (default-linux/x86/2005.1, gcc-3.4.3, glibc-2.3.5-r0, 2.6.11-gentoo-r9 i686) ================================================================= System uname: 2.6.11-gentoo-r9 i686 Pentium II (Deschutes) Gentoo Base System version 1.6.13 dev-lang/python: 2.3.5 sys-apps/sandbox: 1.2.11 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5 sys-devel/binutils: 2.15.92.0.2-r10 sys-devel/libtool: 1.5.18-r1 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium2 -O3 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=pentium2 -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks fixpackages notitles sandbox sfperms strict" GENTOO_MIRRORS="http://hazel.tps/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j1" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/home/tps/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X alsa apache2 apm arts avi bitmap-fonts browserplugin cdr crypt cups curl eds emboss encode esd fam flac foomaticdb fortran gd gdbm gif gpm gstreamer gtk gtk2 imagemagick imlib ipv6 java jpeg junit kde ldap libg++ libwww linguas_de linguas_en linguas_fr mad mikmod motif mozcalendar mozdevelop mozilla mozsvg mozxmlterm mp3 mpeg ncurses netboot nls nptl ogg oggvorbis opengl oss pam pdflib perl png python qt quicktime readline ruby sdl slang snmp softmmu speex spell ssl svga tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts vorbis xine xml xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Workaround: before emergeing grub: rm -rf /lib/grub/* rm -rf /usr/lib/grub/* rm -rf /boot/grub/*stage* nbgrub pxegrub then emerge grub: emerge grub copy missing files: cp /usr/lib/grub/* /boot/grub chmod 0644 /boot/grub/* Install grub to your hd: /sbin/grub --batch \ --device-map=/boot/grub/device.map \ < /boot/grub/grub.conf BTW: shouldn't files in "/usr/lib/grub" be installed with permission bits set to "0644"? AFAIK there is no neccessity to make them executable!
the files are copied in the pkg_postinst stage: >>> /boot/grub/splash.xpm.gz * Linking from new grub.conf name to menu.lst * Copying files from /lib/grub and /usr/lib/grub to /boot >>> Regenerating /etc/ld.so.cache...
Yes, it tells us, but there isn't anything copied, if these files already exist. Any program can print anything. It must not mean it is doing it! This doesn't work as expected: einfo "Copying files from /lib/grub and /usr/lib/grub to /boot" for x in /lib/grub/*/* /usr/lib/grub/*/* ; do [[ -f ${x} ]] && cp -p ${x} /boot/grub done For testing I changed, assuming execution by "sh": #! /bin/sh for x in /lib/grub/*/* /usr/lib/grub/*/* ; do [[ -f ${x} ]] && ls -la ${x} done Now here is what is exausted: yew grub # ~/test -rw-r--r-- 1 root root 8052 Aug 19 21:55 /lib/grub/i386-pc/e2fs_stage1_5 -rw-r--r-- 1 root root 7812 Aug 19 21:55 /lib/grub/i386-pc/fat_stage1_5 -rw-r--r-- 1 root root 7092 Aug 19 21:55 /lib/grub/i386-pc/ffs_stage1_5 -rw-r--r-- 1 root root 7124 Aug 19 21:55 /lib/grub/i386-pc/iso9660_stage1_5 -rw-r--r-- 1 root root 8576 Aug 19 21:55 /lib/grub/i386-pc/jfs_stage1_5 -rw-r--r-- 1 root root 7284 Aug 19 21:55 /lib/grub/i386-pc/minix_stage1_5 -rw-r--r-- 1 root root 9556 Aug 19 21:55 /lib/grub/i386-pc/reiserfs_stage1_5 -rw-r--r-- 1 root root 512 Aug 19 21:55 /lib/grub/i386-pc/stage1 -rw-r--r-- 1 root root 105576 Aug 19 21:55 /lib/grub/i386-pc/stage2 -rw-r--r-- 1 root root 105576 Aug 19 21:55 /lib/grub/i386-pc/stage2_eltorito -rw-r--r-- 1 root root 7368 Aug 19 21:55 /lib/grub/i386-pc/ufs2_stage1_5 -rw-r--r-- 1 root root 6708 Aug 19 21:55 /lib/grub/i386-pc/vstafs_stage1_5 -rw-r--r-- 1 root root 9404 Aug 19 21:55 /lib/grub/i386-pc/xfs_stage1_5 And here is what is in "/lib/grub": yew grub # ls -lA /lib/grub/i386-pc/ total 312 -rw-r--r-- 1 root root 8052 Aug 19 21:55 e2fs_stage1_5 -rw-r--r-- 1 root root 7812 Aug 19 21:55 fat_stage1_5 -rw-r--r-- 1 root root 7092 Aug 19 21:55 ffs_stage1_5 -rw-r--r-- 1 root root 7124 Aug 19 21:55 iso9660_stage1_5 -rw-r--r-- 1 root root 8576 Aug 19 21:55 jfs_stage1_5 -rw-r--r-- 1 root root 7284 Aug 19 21:55 minix_stage1_5 -rw-r--r-- 1 root root 9556 Aug 19 21:55 reiserfs_stage1_5 -rw-r--r-- 1 root root 512 Aug 19 21:55 stage1 -rw-r--r-- 1 root root 105576 Aug 19 21:55 stage2 -rw-r--r-- 1 root root 105576 Aug 19 21:55 stage2_eltorito -rw-r--r-- 1 root root 7368 Aug 19 21:55 ufs2_stage1_5 -rw-r--r-- 1 root root 6708 Aug 19 21:55 vstafs_stage1_5 -rw-r--r-- 1 root root 9404 Aug 19 21:55 xfs_stage1_5 And here what "/usr/lib/grub" holds: yew grub # ls -lA /usr/lib/grub total 600 -rwxr-xr-x 1 root root 197444 Aug 19 21:55 nbgrub -rwxr-xr-x 1 root root 198468 Aug 19 21:55 pxegrub -rwxr-xr-x 1 root root 198020 Aug 19 21:55 stage2.netboot Your error: you are assuming *one* subdirectory. This assumtion isn't true for "/usr/lib/grub". A better way copying the files would be: for d in /lib/grub /usr/lib/grub; do find d -type f -exec cp -p {} /boot/grub \; done or if find permits it (it should since we are on an GNU system ;-) ): find /lib/grub /usr/lib/grub -type f -exec cp -p {} /boot/grub \;
not really the bug is that the netboot files are installed into /usr/lib/grub instead of /usr/lib/grub/<an arch dir>/ fixed in cvs
The copy routine is a bad idea IMHO. I had a bad morning today: compiling grub for three architectures I noticed this routine copying the files for "alpha", then for "i386", overwriting what was just copied, then copying for "ppc" again overwriting what was just copied. Afterwards I wondered why grub installed perfectly, but a reboot failed! It just had to fail, since a PII can't interpret ppc code. With this "little" problem I would prefer to copy grub *including* the <arch>-directory or, alternatively only copy the files related to the given <arch>. Modifying the copy procedure to be: cp -R /lib/grub/* /boot/grub cp -R /usr/lib/grub/* /boot/grub or (I'd prefer): cp -R /lib/grub/$( uname -m )/*
i dont think anyone has attempted cross-grub builds before sanest thing would prob to modify the grub build to install into /lib/grub/$(tc-arch)/ and then we'd copy files from there