Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 485090 - app-admin/eclean-kernel-0.4 does not rebuild grub.cfg w/ new default grub2 directory -> /boot/grub
Summary: app-admin/eclean-kernel-0.4 does not rebuild grub.cfg w/ new default grub2 di...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 11:28 UTC by Derk W te Bokkel
Modified: 2013-10-15 19:47 UTC (History)
2 users (show)

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 Derk W te Bokkel 2013-09-16 11:28:36 UTC
Running eclean-kernel -n 2 should remove old kernels and then rebuild grub.cfg
but since update to sys-boot/grub-2.00_p5107-r1 this no longer works properly

e.g.

 linux-3.11.1-gentoo # eclean-kernel -n 2
* Removing kernel 3.10.9-gentoo (not referenced by bootloader (symlinks))
- /boot/vmlinuz-3.10.9-gentoo
- /boot/System.map-3.10.9-gentoo
- /boot/config-3.10.9-gentoo
- /lib64/modules/3.10.9-gentoo
- /usr/src/linux-3.10.9-gentoo
Removed 1 kernels
zlink1 linux-3.11.1-gentoo # ls -l /boot/grub
total 40
drwxr-xr-x 2 root root  4096 Sep  9 10:26 fonts
-rw------- 1 root root 11417 Sep  9 14:17 grub.cfg
-rw-r--r-- 1 root root  1024 Sep  9 10:26 grubenv
drwxr-xr-x 2 root root 12288 Sep  9 14:16 i386-pc
drwxr-xr-x 2 root root  4096 Sep  9 10:26 locale
drwxr-xr-x 3 root root  4096 Sep  9 10:26 themes
zlink1 linux-3.11.1-gentoo # ls -l boot
ls: cannot access boot: No such file or directory
zlink1 linux-3.11.1-gentoo # ls -l /boot
total 18356
-rw-r--r-- 1 root root 3329527 Sep  7 11:37 System.map-3.11.0-gentoo
-rw-r--r-- 1 root root 3329527 Sep 16 07:12 System.map-3.11.1-gentoo
lrwxrwxrwx 1 root root       1 Aug 26  2011 boot -> .
-rw-r--r-- 1 root root  102037 Sep  7 11:37 config-3.11.0-gentoo
-rw-r--r-- 1 root root  102037 Sep 16 07:12 config-3.11.1-gentoo
drwxr-xr-x 6 root root    4096 Sep  9 14:17 grub
-rw-r--r-- 1 root root 5939776 Sep  7 11:37 vmlinuz-3.11.0-gentoo
-rw-r--r-- 1 root root 5939712 Sep 16 07:12 vmlinuz-3.11.1-gentoo
zlink1 linux-3.11.1-gentoo # grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.11.1-gentoo
Found linux image: /boot/vmlinuz-3.11.0-gentoo
Found Gentoo Base System release 2.2 on /dev/sda1
done
zlink1 linux-3.11.1-gentoo # ls -l /boot/grub
total 40
drwxr-xr-x 2 root root  4096 Sep  9 10:26 fonts
-rw------- 1 root root 10096 Sep 16 07:15 grub.cfg
-rw-r--r-- 1 root root  1024 Sep  9 10:26 grubenv
drwxr-xr-x 2 root root 12288 Sep  9 14:16 i386-pc
drwxr-xr-x 2 root root  4096 Sep  9 10:26 locale
drwxr-xr-x 3 root root  4096 Sep  9 10:26 themes
zlink1 linux-3.11.1-gentoo # 



emerge --info not included as it is irrelevant in this case


script needs an update to check for correct grub/grub2 directory before issuing config (grub.cfg) rebuild command internally.

Reproducible: Always
Comment 1 Derk W te Bokkel 2013-09-16 11:37:15 UTC
note: earlier testing showed if the /boot/grub2 directory is present it gets updated .. but not the new /boot/grub directory used by
 >=sys-boot/grub-2.00_p5107-r1 
.. thus we boot only old kernels   .. until they are removed and then .. 

unless manually running 
"grub2-mkconfig -o /boot/grub/grub.cfg"

because we noticed the script not showing the grub.cfg rebuild happening as it did previously
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-09-17 14:46:58 UTC
I don't use grub, so you need to help me a bit understand what's going on. Do I understand correctly that starting with sys-boot/grub-2.00_p5107-r1, /boot/grub is the correct location?

What happens with the old directory? Does it get removed, or...? Could you suggest a way of finding out the correct directory without checking installed package version?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-09-17 14:48:43 UTC
(CC-ing grub2 maint)
Comment 4 Derk W te Bokkel 2013-09-17 15:28:50 UTC
The old directory still exists by default but .. the newversion of grub looks at the newer version only? I think .. On my own machines I've removed the old grub2 directories and all runs fine perhaps removal of the grub2 directory and generation of a symlink from /boot/grub2-> /boot/grub (real directory) could be used as a work arround until all versions of grub have migrated to the "new standard"
Comment 5 Mike Gilbert gentoo-dev 2013-09-17 15:48:51 UTC
(In reply to Michał Górny from comment #2)
> I don't use grub, so you need to help me a bit understand what's going on.
> Do I understand correctly that starting with sys-boot/grub-2.00_p5107-r1,
> /boot/grub is the correct location?
> 

Yes. Renaming it wasn't necessary, and actually broke some third party tools.

> What happens with the old directory? Does it get removed, or...? Could you
> suggest a way of finding out the correct directory without checking
> installed package version?

The old grub2 directory remains; it isn't safe to remove it until the user has run grub2-install with >=sys-boot/grub-2.00_p5107-r1.

I would probably just check for the existence /boot/grub/grub.cfg, followed by /boot/grub2/grub.cfg, and regenerate the first one you find.

Also, I should point out that grub2-mkconfig is not always called grub2-mkconfig. If you disable the "mulitslot" use flag, it becomes grub-mkconfig (the default upstream name). Any chance you could implement similar logic for that?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-09-17 15:53:03 UTC
(In reply to Mike Gilbert from comment #5)
> I would probably just check for the existence /boot/grub/grub.cfg, followed
> by /boot/grub2/grub.cfg, and regenerate the first one you find.

I do, but then I assume grub1 is installed. Now I guess I need a better check for grub2.

> Also, I should point out that grub2-mkconfig is not always called
> grub2-mkconfig. If you disable the "mulitslot" use flag, it becomes
> grub-mkconfig (the default upstream name). Any chance you could implement
> similar logic for that?

This is something secondary, so there should be no issue with with trying grub2-mkconfig first and falling back to grub-mkconfig.
Comment 7 Mike Gilbert gentoo-dev 2013-09-17 15:57:29 UTC
(In reply to Michał Górny from comment #6)
> (In reply to Mike Gilbert from comment #5)
> > I would probably just check for the existence /boot/grub/grub.cfg, followed
> > by /boot/grub2/grub.cfg, and regenerate the first one you find.
> 
> I do, but then I assume grub1 is installed. Now I guess I need a better
> check for grub2.
> 

grub:0 reads /boot/grub/menu.lst and/or /boot/grub/grub.conf
grub:2 reads /boot/grub/grub.cfg
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-09-17 21:40:36 UTC
  08440a1 Update the list of grub & grub2 configuration paths.

Could you try -9999?
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-14 19:53:47 UTC
Ping. Can I get a confirmation that the fix works?
Comment 10 Derk W te Bokkel 2013-10-14 20:24:47 UTC
so far it does not seem to create a new grub.cfg file .. at least it does not show that is doing so as it did before ..  did you make it silent ..? I did not check for the files directly at this last upgrade to kernel 3.11.5 .. but a quick change to the kernel and a reinstall .. running eclean-kernel-9999 does not regenerate grub.cfg ..
Comment 11 poncho 2013-10-15 10:04:22 UTC
it does detect the correct bootloader and config file, but doesn't run "grub2-mkconfig -o /boot/grub/grub.cfg"

eclean-kernel --all --exclude=config --ask --debug
* Trying bootloader lilo
* Trying bootloader grub2
** /boot/grub/grub.cfg found
* Trying bootloader grub
* Trying bootloader yaboot
* Trying bootloader symlinks
* In get_removal_list()
Preserving currently running kernel (3.11.5)
Remove 3.11.3 (not referenced by bootloader (symlinks))? [Yes/No]y
* Removing kernel 3.11.3 (not referenced by bootloader (symlinks))
- /boot/vmlinuz-3.11.3
- /boot/System.map-3.11.3
- /boot/initramfs-3.11.3.img
- /lib64/modules/3.11.3
- /usr/src/linux-3.11.3
Remove 3.11.4 (not referenced by bootloader (symlinks))? [Yes/No]n
Remove 3.10.14 (not referenced by bootloader (symlinks))? [Yes/No]n
Removed 1 kernels

app-admin/eclean-kernel-9999 was built with the following:
USE="" PYTHON_TARGETS="python2_7 python3_2 -pypy2_0 -python2_6 -python3_3"
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-15 16:25:21 UTC
Thanks for the debug output. Commit d9ec90f should fix the issue now, please re-test.
Comment 13 Derk W te Bokkel 2013-10-15 17:43:32 UTC
yes it now generates /boot/grub/grub.cfg .. thank you for your work on this issue.
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-15 18:20:27 UTC
@poncho, could you confirm as well? I will wrap up a release afterwards.
Comment 15 poncho 2013-10-15 19:17:13 UTC
(In reply to Michał Górny from comment #14)
> @poncho, could you confirm as well? I will wrap up a release afterwards.

yes, /boot/grub/grub.cfg gets updated.

eclean-kernel --all --exclude=config --ask --debug
* Trying bootloader lilo
* Trying bootloader grub2
** /boot/grub/grub.cfg found
* In get_removal_list()
** Config is autogenerated, ignoring
Preserving currently running kernel (3.11.5)
Remove 3.11.5.old (not referenced by bootloader (grub2))? [Yes/No]yes
* Removing kernel 3.11.5.old (not referenced by bootloader (grub2))
- /boot/vmlinuz-3.11.5.old
- /boot/System.map-3.11.5.old
Remove 3.10.14 (not referenced by bootloader (grub2))? [Yes/No]no
Remove 3.11.4 (not referenced by bootloader (grub2))? [Yes/No]no
Removed 1 kernels
* Calling grub2-mkconfig
Generating grub.cfg ...
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6394: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6394: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6401: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6401: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6406: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6406: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6416: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6416: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6427: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6427: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6458: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6458: /usr/sbin/grub2-probe
Found linux image: /boot/vmlinuz-3.11.5
Found initrd image: /boot/initramfs-3.11.5.img
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6545: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6545: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6551: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6551: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6557: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6557: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6563: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6563: /usr/sbin/grub2-probe
Found linux image: /boot/vmlinuz-3.11.4
Found initrd image: /boot/initramfs-3.11.4.img
Found linux image: /boot/vmlinuz-3.10.14
Found initrd image: /boot/initramfs-3.10.14.img
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6897: /usr/sbin/grub2-probe
File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6897: /usr/sbin/grub2-probe
done


the "File descriptor 3 (/root/.config/eclean-kernel.rc) leaked on vgs invocation. Parent PID 6394: /usr/sbin/grub2-probe" messages are new though. either related to the new grub or the eclean-kernel git version.

cat /root/.config/eclean-kernel.rc
--exclude=config --all --ask
Comment 16 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-15 19:47:18 UTC
+  15 Oct 2013; Michał Górny <mgorny@gentoo.org> +eclean-kernel-0.4.1.ebuild:
+  Version bump. The new version fixes finding grub & grub2 configuration files,
+  bug #485090.