Issue #6 new

Support Boot Loader Specification

poncho
created an issue

Boot Loader Specification

I switched my system to boot with gummiboot and install the kernels with kernel-install (part of systemd). It would be nice if eclean-kernel could support this kind of setup.

6a9857a393724b7a981ebb5b8495b9ea

is the machine-id from /etc/machine-id

The initrd and the kernel are located at

/boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/linux
/boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/initrd

The entries are drop in files in

/boot/loader/entries/

for example

6a9857a393724b7a981ebb5b8495b9ea-3.12.6.conf

looks like this:

title      Gentoo/Linux
version    3.12.6
machine-id 6a9857a393724b7a981ebb5b8495b9ea
options    init=/usr/lib/systemd/systemd root=/dev/dm-2
linux      /6a9857a393724b7a981ebb5b8495b9ea/3.12.6/linux
initrd     /6a9857a393724b7a981ebb5b8495b9ea/3.12.6/initrd

Comments (16)

  1. Michał Górny repo owner

    I've just installed gummiboot on my laptop, so I'll probably work on that soon. That is, when I have some time, so it may get delayed till February.

  2. poncho reporter

    kernel-install doesn't replace make install and make modules_install from the kernel source directory.

    System.map, config and vmlinuz are still at their usual location:

    /boot/config-3.12.6
    /boot/config-3.12.6.old
    /boot/System.map-3.12.6
    /boot/vmlinuz-3.12.6
    
  3. Michał Górny repo owner

    So, to sum up, eclean-kernel would have to find the extra loader config file and directory and remove them along with the kernel, correct?

    Out of curiosity, do you run kernel-install manually? I don't see anything in kernel tree using it.

  4. poncho reporter

    On my system, the relevant files for kernel 3.12.6 are:

    /boot/config-3.12.6
    /boot/config-3.12.6.old
    /boot/System.map-3.12.6
    /boot/vmlinuz-3.12.6
    
    /boot/loader/entries/6a9857a393724b7a981ebb5b8495b9ea-3.12.6.conf
    
    /boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/initrd
    /boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/linux
    

    To generate the boot loader entries and the dracut initramfs I use kernel-install add 3.12.6 /boot/vmlinuz-3.12.6

    kernel-install is more designed as kernel-postinstall-for-binary-packages see http://pkgs.fedoraproject.org/cgit/kernel.git/tree/kernel.spec#n1971

  5. poncho reporter

    Also note that on my system /boot is the EFI system partition

    I think the files

    /boot/loader/entries/6a9857a393724b7a981ebb5b8495b9ea-3.12.6.conf
    
    /boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/initrd
    /boot/6a9857a393724b7a981ebb5b8495b9ea/3.12.6/linux
    

    are located relative to the ESP and not necessarily in /boot

  6. Michał Górny repo owner

    Now that I think about it, it should be enough for eclean-kernel to call something like:

    kernel-install remove $VERSION $VMLINUZ
    

    when removing a kernel, correct?

  7. Michał Górny repo owner

    e737832 adds support for calling kernel-install.

    I don't think that's actually enough to be fully compliant. It likely would be better if I made eclean-kernel machine-id aware and either avoid removing kernels belonging to other systems or make -nX keep X newest kernels for each system.

  8. poncho reporter

    I've switched to eclean-kernel-9999. I will use it for a while and let you now how it works. Here are some first impressions:

    systemd-efi-boot-generator mounts /boot with umask=0077. It would be nice if eclean-kernel would print something like /boot: Permission denied instead of just [None] if run as unprivileged user.

    eclean-kernel -p -l -D
    3.12.7 [None]:
    - modules: /lib64/modules/3.12.7
    - build: /usr/src/linux-3.12.7
    - last modified: 2014-01-14 09:24:44
    

    Currently, eclean-kernel detects the bootloader as symlinks:

    eclean-kernel -p -D -a
    * Trying bootloader lilo
    * Trying bootloader grub2
    * Trying bootloader grub
    * Trying bootloader yaboot
    * Trying bootloader symlinks
    * In get_removal_list()
    Preserving currently running kernel (3.12.7)
    These are the kernels which would be removed:
    - 3.12.6.old: vmlinuz does not exist, not referenced by bootloader (symlinks)
    - 3.12.7.old: not referenced by bootloader (symlinks)
    - 3.12.6: not referenced by bootloader (symlinks)
    kernel-install will be called to perform prerm tasks.
    

    Maybe you can parse the output of bootctl status to show the correct bootloader.

  9. poncho reporter

    when I removed kernel 3.12.7.old, the bootloader entry for kernel 3.12.7 was removed... :(

    eclean-kernel -a -A -D
    * Trying bootloader lilo
    * Trying bootloader grub2
    * Trying bootloader grub
    * Trying bootloader yaboot
    * Trying bootloader symlinks
    * In get_removal_list()
    Preserving currently running kernel (3.12.7)
    Remove 3.12.6.old (vmlinuz does not exist, not referenced by bootloader (symlinks))? [Yes/No]n
    Remove 3.12.8 (not referenced by bootloader (symlinks))? [Yes/No]n
    Remove 3.12.6 (not referenced by bootloader (symlinks))? [Yes/No]n
    Remove 3.12.7.old (not referenced by bootloader (symlinks))? [Yes/No]y
    * Removing kernel 3.12.7.old (not referenced by bootloader (symlinks))
    - /boot/vmlinuz-3.12.7.old
    - /boot/System.map-3.12.7.old
    - /boot/config-3.12.7.old
    Removed 1 kernels
    
  10. Michał Górny repo owner

    Yeah, I can guess it did that. I guess the Fedora folk didn't predict that someone could actually have more than one kernel with the same version. Not sure if it's worth reporting upstream, or if I should just work-around it by triggering removal only when /lib/modules gets removed.

  11. Log in to comment