Results 1 to 5 of 5

Thread: Old Kernels not getting purged: mkinitrd compiles them, still in boot

  1. #1

    Default Old Kernels not getting purged: mkinitrd compiles them, still in boot

    I'm trying to clean up my Tumbleweed system. I noticed after recent updates (zypper dup) that kernels that should not be installed get compiled, they still show up in the boot menu and I can still find them in the /boot directory and in /lib/modules directory.

    For example,
    Code:
    # rpm -qa kern*
    returns:

    Code:
    kernel-default-devel-4.15.13-2.4.x86_64
    kernel-syms-4.15.13-2.4.x86_64
    kernel-devel-4.15.13-2.4.noarch
    kernel-syms-4.15.13-1.6.x86_64
    kernel-firmware-20180320-1.1.noarch
    kernel-default-4.15.13-2.4.x86_64
    kernel-default-devel-4.15.13-1.6.x86_64
    kernel-devel-4.15.13-1.6.noarch
    kernel-macros-4.15.13-2.4.noarch
    kernel-default-4.15.13-1.6.x86_64
    but
    Code:
    # ls /boot
    returns:
    Code:
    .vmlinuz-4.15.13-1-default.hmac  boot.readme               initrd                         symtypes-4.15.9-1-default.gz   sysctl.conf-4.15.9-1-default  vmlinuz-4.15.13-2-default
    .vmlinuz-4.15.13-2-default.hmac  config-4.15.13-1-default  initrd-4.15.13-1-default       symvers-4.15.13-1-default.gz   vmlinux-4.15.13-1-default.gz  vmlinuz-4.15.9-1-default
    .vmlinuz-4.15.9-1-default.hmac   config-4.15.13-2-default  initrd-4.15.13-2-default       symvers-4.15.13-2-default.gz   vmlinux-4.15.13-2-default.gz
    System.map-4.15.13-1-default     config-4.15.9-1-default   initrd-4.15.9-1-default        symvers-4.15.9-1-default.gz    vmlinux-4.15.9-1-default.gz
    System.map-4.15.13-2-default     efi                       symtypes-4.15.13-1-default.gz  sysctl.conf-4.15.13-1-default  vmlinuz
    System.map-4.15.9-1-default      grub2                     symtypes-4.15.13-2-default.gz  sysctl.conf-4.15.13-2-default  vmlinuz-4.15.13-1-default
    and

    Code:
    # ls /lib/modules
    returns:
    Code:
    4.11.6-1-default  4.11.8-2-default   4.12.7-1-default  4.13.10-1-default  4.13.3-1-default  4.13.9-1-default   4.15.0-1-default   4.15.13-1-default  4.15.3-1-default
    4.11.8-1-default  4.12.11-1-default  4.12.8-1-default  4.13.12-1-default  4.13.6-1-default  4.14.11-1-default  4.15.10-1-default  4.15.13-2-default  4.15.9-1-default
    when...
    Code:
    # rpm -qa *default
    returns:
    Code:
    virtualbox-host-kmp-default-5.2.8_k4.15.13_2-2.3.x86_64
    kernel-default-4.15.13-2.4.x86_64
    icewm-default-1.4.2-6.1.x86_64
    ghc-data-default-0.7.1.1-2.5.x86_64
    bbswitch-kmp-default-0.8_k4.15.13_2-28.88.x86_64
    kernel-default-4.15.13-1.6.x86_64
    Yast only shows 4.15.13-2 and 4.15.13-1 being installed.

    If I do
    Code:
    mkinitrd
    I get:

    Code:
    Creating initrd: /boot/initrd-4.15.13-1-default
    dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force /boot/initrd-4.15.13-1-default 4.15.13-1-default
    dracut: *** Including module: bash ***
    dracut: *** Including module: systemd ***
    dracut: *** Including module: warpclock ***
    dracut: *** Including module: systemd-initrd ***
    dracut: *** Including module: i18n ***
    dracut: Could not find FONT_MAP none!
    dracut: *** Including module: drm ***
    dracut: *** Including module: plymouth ***
    dracut: *** Including module: btrfs ***
    dracut: *** Including module: kernel-modules ***
    dracut: *** Including module: resume ***
    dracut: *** Including module: rootfs-block ***
    dracut: *** Including module: suse-xfs ***
    dracut: *** Including module: terminfo ***
    dracut: *** Including module: udev-rules ***
    dracut: Skipping udev rule: 40-redhat.rules
    dracut: Skipping udev rule: 50-firmware.rules
    dracut: Skipping udev rule: 50-udev.rules
    dracut: Skipping udev rule: 91-permissions.rules
    dracut: Skipping udev rule: 80-drivers-modprobe.rules
    dracut: Skipping udev rule: 61-persistent-storage-compat.rules
    dracut: *** Including module: biosdevname ***
    dracut: *** Including module: dracut-systemd ***
    dracut: *** Including module: haveged ***
    dracut: *** Including module: usrmount ***
    dracut: *** Including module: base ***
    dracut: *** Including module: fs-lib ***
    dracut: *** Including module: shutdown ***
    dracut: *** Including module: suse ***
    dracut: *** Including modules done ***
    dracut: *** Installing kernel module dependencies and firmware ***
    dracut: *** Installing kernel module dependencies and firmware done ***
    dracut: *** Resolving executable dependencies ***
    dracut: *** Resolving executable dependencies done***
    dracut: *** Hardlinking files ***
    dracut: *** Hardlinking files done ***
    dracut: *** Stripping files ***
    dracut: *** Stripping files done ***
    dracut: *** Generating early-microcode cpio image ***
    dracut: *** Constructing GenuineIntel.bin ****
    dracut: *** Store current command line parameters ***
    dracut: Stored kernel commandline:
    dracut:  resume=UUID=71befdee-3245-42f0-a4b5-a6bd95ada3e8
    dracut:  root=UUID=e957e756-905d-4b97-8239-34bae6f2d47c rootfstype=btrfs rootflags=rw,relatime,ssd,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot,subvol=@/.snapshots/1/snapshot
    dracut: *** Creating image file '/boot/initrd-4.15.13-1-default' ***
    dracut: *** Creating initramfs image file '/boot/initrd-4.15.13-1-default' done ***
    Creating initrd: /boot/initrd-4.15.13-2-default
    dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force /boot/initrd-4.15.13-2-default 4.15.13-2-default
    dracut: *** Including module: bash ***
    dracut: *** Including module: systemd ***
    dracut: *** Including module: warpclock ***
    dracut: *** Including module: systemd-initrd ***
    dracut: *** Including module: i18n ***
    dracut: Could not find FONT_MAP none!
    dracut: *** Including module: drm ***
    dracut: *** Including module: plymouth ***
    dracut: *** Including module: btrfs ***
    dracut: *** Including module: kernel-modules ***
    dracut: *** Including module: resume ***
    dracut: *** Including module: rootfs-block ***
    dracut: *** Including module: suse-xfs ***
    dracut: *** Including module: terminfo ***
    dracut: *** Including module: udev-rules ***
    dracut: Skipping udev rule: 40-redhat.rules
    dracut: Skipping udev rule: 50-firmware.rules
    dracut: Skipping udev rule: 50-udev.rules
    dracut: Skipping udev rule: 91-permissions.rules
    dracut: Skipping udev rule: 80-drivers-modprobe.rules
    dracut: Skipping udev rule: 61-persistent-storage-compat.rules
    dracut: *** Including module: biosdevname ***
    dracut: *** Including module: dracut-systemd ***
    dracut: *** Including module: haveged ***
    dracut: *** Including module: usrmount ***
    dracut: *** Including module: base ***
    dracut: *** Including module: fs-lib ***
    dracut: *** Including module: shutdown ***
    dracut: *** Including module: suse ***
    dracut: *** Including modules done ***
    dracut: *** Installing kernel module dependencies and firmware ***
    dracut: *** Installing kernel module dependencies and firmware done ***
    dracut: *** Resolving executable dependencies ***
    dracut: *** Resolving executable dependencies done***
    dracut: *** Hardlinking files ***
    dracut: *** Hardlinking files done ***
    dracut: *** Stripping files ***
    dracut: *** Stripping files done ***
    dracut: *** Generating early-microcode cpio image ***
    dracut: *** Constructing GenuineIntel.bin ****
    dracut: *** Store current command line parameters ***
    dracut: Stored kernel commandline:
    dracut:  resume=UUID=71befdee-3245-42f0-a4b5-a6bd95ada3e8
    dracut:  root=UUID=e957e756-905d-4b97-8239-34bae6f2d47c rootfstype=btrfs rootflags=rw,relatime,ssd,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot,subvol=@/.snapshots/1/snapshot
    dracut: *** Creating image file '/boot/initrd-4.15.13-2-default' ***
    dracut: *** Creating initramfs image file '/boot/initrd-4.15.13-2-default' done ***
    Creating initrd: /boot/initrd-4.15.9-1-default
    dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force /boot/initrd-4.15.9-1-default 4.15.9-1-default
    dracut: *** Including module: bash ***
    dracut: *** Including module: systemd ***
    dracut: *** Including module: warpclock ***
    dracut: *** Including module: systemd-initrd ***
    dracut: *** Including module: i18n ***
    dracut: Could not find FONT_MAP none!
    dracut: *** Including module: drm ***
    dracut: *** Including module: plymouth ***
    dracut: *** Including module: btrfs ***
    dracut: *** Including module: kernel-modules ***
    dracut: *** Including module: resume ***
    dracut: *** Including module: rootfs-block ***
    dracut: *** Including module: suse-xfs ***
    dracut: *** Including module: terminfo ***
    dracut: *** Including module: udev-rules ***
    dracut: Skipping udev rule: 40-redhat.rules
    dracut: Skipping udev rule: 50-firmware.rules
    dracut: Skipping udev rule: 50-udev.rules
    dracut: Skipping udev rule: 91-permissions.rules
    dracut: Skipping udev rule: 80-drivers-modprobe.rules
    dracut: Skipping udev rule: 61-persistent-storage-compat.rules
    dracut: *** Including module: biosdevname ***
    dracut: *** Including module: dracut-systemd ***
    dracut: *** Including module: haveged ***
    dracut: *** Including module: usrmount ***
    dracut: *** Including module: base ***
    dracut: *** Including module: fs-lib ***
    dracut: *** Including module: shutdown ***
    dracut: *** Including module: suse ***
    dracut: *** Including modules done ***
    dracut: *** Installing kernel module dependencies and firmware ***
    dracut: *** Installing kernel module dependencies and firmware done ***
    dracut: *** Resolving executable dependencies ***
    dracut: *** Resolving executable dependencies done***
    dracut: *** Hardlinking files ***
    dracut: *** Hardlinking files done ***
    dracut: *** Stripping files ***
    dracut: *** Stripping files done ***
    dracut: *** Generating early-microcode cpio image ***
    dracut: *** Constructing GenuineIntel.bin ****
    dracut: *** Store current command line parameters ***
    dracut: Stored kernel commandline:
    dracut:  resume=UUID=71befdee-3245-42f0-a4b5-a6bd95ada3e8
    dracut:  root=UUID=e957e756-905d-4b97-8239-34bae6f2d47c rootfstype=btrfs rootflags=rw,relatime,ssd,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot,subvol=@/.snapshots/1/snapshot
    dracut: *** Creating image file '/boot/initrd-4.15.9-1-default' ***
    dracut: *** Creating initramfs image file '/boot/initrd-4.15.9-1-default' done ***
    I've tried rebuilding the rpmdb but not manually removing these old files and directories. I don't know where all the pieces are and I'm afraid to get things misaligned. I really don't want to leave so much extra stuff on the drive (SSD, space will eventually be an issue) and the problem of compiling kernels that shouldn't even be installed bothers me.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,684
    Blog Entries
    3

    Default Re: Old Kernels not getting purged: mkinitrd compiles them, still in boot

    It looks to me as if kernel 4.15.9-1 is not in the rpm database, but the corresponding files still exist on disk.

    As for that list of directories under "/lib/modules", many of those are probably almost empty. When you remove a kernel, the corresponding entries under "/lib/modules" are removed, except that a directory cannot be removed if it is not empty. You probably have some third party software, such as an nVidia driver, which puts modules there keeping those directories from being removed. It's probably okay to manually remove module directories and content for kernels no longer installed.

    As for kernel 4.15.9-1: I suppose you could manually remove everything related to that.

    It looks to me as if the purging of old kernels is working properly, with the exception of 4.15.9-1.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  3. #3
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,925
    Blog Entries
    14

    Default Re: Old Kernels not getting purged: mkinitrd compiles them, still in boot

    Quote Originally Posted by nrickert View Post
    It looks to me as if kernel 4.15.9-1 is not in the rpm database, but the corresponding files still exist on disk.

    As for that list of directories under "/lib/modules", many of those are probably almost empty. When you remove a kernel, the corresponding entries under "/lib/modules" are removed, except that a directory cannot be removed if it is not empty. You probably have some third party software, such as an nVidia driver, which puts modules there keeping those directories from being removed. It's probably okay to manually remove module directories and content for kernels no longer installed.

    As for kernel 4.15.9-1: I suppose you could manually remove everything related to that.

    It looks to me as if the purging of old kernels is working properly, with the exception of 4.15.9-1.
    Drawing the same conslusions.
    @OP: I think you're misunderstanding things. There is no kernel being compiled at boot, none. As no initrd is made during boot. The kernel is compiled in OBS, packaged and distributed. Installing a kernel will trigger mkinitrd to create a RAMdisk used to boot the system. The entries in the GRUB2 boot menu allow you to boot previous kernels, which can be very helpful in some cases.
    Another thing: be careful in attempts to 'clean up' your system. Do you have any solid reasons / needs to do so?
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  4. #4

    Default Re: Old Kernels not getting purged: mkinitrd compiles them, still in boot

    Thanks, both of you. The nvidia drivers do seem to be the culprit in the modules directory.

    It does seem odd, though that doing mkinitrd would _build_ (I thought it was _recompiling_ the kernel with the required modules) kernels that are supposedly not installed.

    @Knurpht, There's no immediate problem, but I've gotten stuck fixing a system that couldn't boot or build because the root or boot partitions were full before. I've got room now, but want to be mindful of what's going on so that I'm not fixing a broken system a year from now when I've stopped paying attention. That just sucks, mostly because it happens at the least convenient time.

  5. #5

    Default Re: Old Kernels not getting purged: mkinitrd compiles them, still in boot

    Quote Originally Posted by CWDillon View Post
    It does seem odd, though that doing mkinitrd would _build_ (I thought it was _recompiling_ the kernel with the required modules) kernels that are supposedly not installed.
    mkinitrd doesn't compile/build anything.

    It just creates a filesystem image for each installed kernel that contains the necessary kernel modules for booting (taken from your actual system partition), that the corresponding kernel can use before the actual system partitions are mounted (which may require to load drivers/modules first that cannot be done without loading those drivers/modules first of course ).

    Btw, it will create an initrd for all kernels found in /boot/, regardless of what the rpm database says about the installed packages.
    Just like the boot menu shows all kernels found in /boot/.

    You can compile a kernel yourself and use it, without installing a package.
    Last edited by wolfi323; 08-Apr-2018 at 10:11.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •