Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many initramfs files are removed #8

Open
JulienDlq opened this issue Aug 20, 2020 · 8 comments
Open

Too many initramfs files are removed #8

JulienDlq opened this issue Aug 20, 2020 · 8 comments

Comments

@JulienDlq
Copy link

I have the following inside my /boot.

ls -1 /boot
amd-uc.img
EFI
grub
initramfs-5.8.1-gentoo-x86_64.img
initramfs-5.8.1-gentoo-x86_64.old.img
initramfs-5.8.2-gentoo-x86_64.img
intel-uc.img
lost+found
System.map-5.8.1-gentoo-x86_64
System.map-5.8.1-gentoo-x86_64.old
System.map-5.8.2-gentoo-x86_64
vmlinuz-5.8.1-gentoo-x86_64
vmlinuz-5.8.1-gentoo-x86_64.old
vmlinuz-5.8.2-gentoo-x86_64

If I perform the following command I can see that only the .old kernel and related files will be removed.

eclean-kernel -d -n 2 -p            
These are the kernels which would be removed:
- 5.8.1-gentoo-x86_64.old: unwanted
kernel-install will be called to perform prerm tasks.

In order to be sure, I run the following command.

eclean-kernel -l        
5.8.2-gentoo-x86_64 [5.8.2-gentoo-x86_64]:
- vmlinuz: /boot/vmlinuz-5.8.2-gentoo-x86_64
- systemmap: /boot/System.map-5.8.2-gentoo-x86_64
- initramfs: /boot/initramfs-5.8.2-gentoo-x86_64.img
- modules: /lib/modules/5.8.2-gentoo-x86_64
- build: /usr/src/linux-5.8.2-gentoo
- last modified: 2020-08-20 16:21:44
5.8.1-gentoo-x86_64 [5.8.1-gentoo-x86_64]:
- vmlinuz: /boot/vmlinuz-5.8.1-gentoo-x86_64
- systemmap: /boot/System.map-5.8.1-gentoo-x86_64
- initramfs: /boot/initramfs-5.8.1-gentoo-x86_64.img
- modules: /lib/modules/5.8.1-gentoo-x86_64
- build: /usr/src/linux-5.8.1-gentoo
- last modified: 2020-08-18 18:35:56
5.8.1-gentoo-x86_64.old [5.8.1-gentoo-x86_64]:
- vmlinuz: /boot/vmlinuz-5.8.1-gentoo-x86_64.old
- systemmap: /boot/System.map-5.8.1-gentoo-x86_64.old
- initramfs: /boot/initramfs-5.8.1-gentoo-x86_64.old.img
- modules: /lib/modules/5.8.1-gentoo-x86_64
- build: /usr/src/linux-5.8.1-gentoo
- last modified: 2020-08-18 18:35:56

If I run the following command, it seems to perform what it is expected.

eclean-kernel -d -n 2   
* Removing kernel 5.8.1-gentoo-x86_64.old (unwanted)
- /boot/vmlinuz-5.8.1-gentoo-x86_64.old
- /boot/System.map-5.8.1-gentoo-x86_64.old
- /boot/initramfs-5.8.1-gentoo-x86_64.old.img
Removed 1 kernels

But if I double check, actually, eclean-kernel also removed the /boot/initramfs-5.8.1-gentoo-x86_64.img file. I didn't asked for that!

ls -1 /boot               
amd-uc.img
EFI
grub
initramfs-5.8.2-gentoo-x86_64.img
intel-uc.img
lost+found
System.map-5.8.1-gentoo-x86_64
System.map-5.8.2-gentoo-x86_64
vmlinuz-5.8.1-gentoo-x86_64
vmlinuz-5.8.2-gentoo-x86_64

It seems that initramfs management is buggy. 😢

@JulienDlq
Copy link
Author

I also tried with 2.99.1. I have the same issue.

eclean-kernel -D -d -n 2
DEBUG:root:Trying bootloader lilo
DEBUG:root:Trying bootloader grub2
DEBUG:root:/boot/grub/grub.cfg found
DEBUG:root:in get_removal_list()
Legend:
[-] file being removed
[x] file does not exist (anymore)
[+] file being kept (used by other kernels

* Removing kernel 5.8.1-gentoo-x86_64.old (unwanted)
 [-] /boot/vmlinuz-5.8.1-gentoo-x86_64.old
 [+] /usr/src/linux-5.8.1-gentoo
 [+] /lib/modules/5.8.1-gentoo-x86_64
 [-] /boot/System.map-5.8.1-gentoo-x86_64.old
 [-] /boot/initramfs-5.8.1-gentoo-x86_64.old.img
Removed 1 kernels
ls -1 /boot     
amd-uc.img
EFI
grub
initramfs-5.8.2-gentoo-x86_64.img
intel-uc.img
lost+found
System.map-5.8.1-gentoo-x86_64
System.map-5.8.2-gentoo-x86_64
vmlinuz-5.8.1-gentoo-x86_64
vmlinuz-5.8.2-gentoo-x86_64

@JulienDlq
Copy link
Author

JulienDlq commented Aug 20, 2020

Ok even if I tell my scripts to save previous initramfs with .img.old extension instead of .old.img, I still have the same issue.

But it seems that grub-mkconfig do not recognise the right initramfs for the right kernel!

grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.2-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.2-gentoo-x86_64.img
Found linux image: /boot/vmlinuz-5.8.1-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.1-gentoo-x86_64.img
Found linux image: /boot/vmlinuz-5.8.1-gentoo-x86_64.old
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.1-gentoo-x86_64.img
done

If a rename back the old initramfs file to /boot/initramfs-5.8.1-gentoo-x86_64.old.img.

grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.2-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.2-gentoo-x86_64.img
Found linux image: /boot/vmlinuz-5.8.1-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.1-gentoo-x86_64.img
Found linux image: /boot/vmlinuz-5.8.1-gentoo-x86_64.old
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-5.8.1-gentoo-x86_64.old.img
done

Everything is fine.

So the old initramfs file must be named initramfs-<version>.old.img.

@JulienDlq JulienDlq changed the title Too much initramfs files are suppressed Too many initramfs files are suppressed Aug 20, 2020
@JulienDlq JulienDlq changed the title Too many initramfs files are suppressed Too many initramfs files are removed Aug 20, 2020
@mgorny
Copy link
Member

mgorny commented Sep 22, 2020

Do I understand correctly that it's removing a file even though it doesn't say it's removing it?

Could you verify that it isn't kernel-install removing it? E.g. rename it or move out of PATH, and try eclean-kernel then.

@runcom
Copy link

runcom commented Apr 19, 2023

I'm having the very same issue here

@runcom
Copy link

runcom commented Apr 19, 2023

Could you verify that it isn't kernel-install removing it? E.g. rename it or move out of PATH, and try eclean-kernel then.

I can confirm it's kernel-install removing the other files indeed 🤦‍♂️ I'll run with --no-kernel-install and check it works

@runcom
Copy link

runcom commented Apr 19, 2023

I can confirm it's kernel-install removing the other files indeed man_facepalming I'll run with --no-kernel-install and check it works

I can confirm that running with --no-kernel-install "solves" the issue as in, it doesn't delete the initiramfs for the currentl (not old) kernel. Running without does indeed call kernel-install and as a result, it removes the initramfs (the "old" one). Any way to report this upstream in systemd perhaps?

@mgorny
Copy link
Member

mgorny commented Apr 24, 2023

Do you have dracut installed? I think this removal may be happening due to /usr/lib/kernel/install.d/50-dracut.install. I think an easy way to confirm would be to remove that file and see if it still happens.

In any case, this is going to be hard because there are so many different /boot layouts…

@xfzv
Copy link

xfzv commented May 28, 2024

Same here, my initramfs images are deleted despite not being listed as being removed by eclean-kernel.

I'm using dracut. Removing /usr/lib/kernel/install.d/50-dracut.install doesn't make any difference for me.

However, using --no-kernel-install as suggested by @runcom also solves the issue on my end.

% eclean-kernel --version
2.99.7
% equery u app-admin/eclean-kernel
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for app-admin/eclean-kernel-2.99.7:
 U I
 - - lz4                       : Enable support for lz4 compression (as implemented in app-arch/lz4)
 - - lzo                       : Enable support for lzo compression
 - - python_targets_python3_10 : Build with Python 3.10
 - - python_targets_python3_11 : Build with Python 3.11
 + + python_targets_python3_12 : Build with Python 3.12
 - - test                      : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled
                                 independently)
 - - zstd                      : Enable support for ZSTD compression
% ls /boot
EFI
grub
config-6.1.90-gentoo-custom
config-6.1.90-gentoo-custom.old
config-6.6.30-gentoo-custom
config-6.6.30-gentoo-custom.old
initramfs-6.1.90-gentoo-custom.img
initramfs-6.6.30-gentoo-custom.img
intel-uc.img
System.map-6.1.90-gentoo-custom
System.map-6.1.90-gentoo-custom.old
System.map-6.6.30-gentoo-custom
System.map-6.6.30-gentoo-custom.old
vmlinuz-6.1.90-gentoo-custom
vmlinuz-6.1.90-gentoo-custom.old
vmlinuz-6.6.30-gentoo-custom
vmlinuz-6.6.30-gentoo-custom.old
% sudo eclean-kernel -A -n 1
Preserving currently running kernel (6.1.90-gentoo-custom)
Legend:
[-] file being removed
[x] file does not exist (anymore)
[+] file being kept (used by other kernels)

Remove other 6.6.30-gentoo-custom.old (not referenced by bootloader (grub2))? [Yes/No]yes
Remove other 6.1.90-gentoo-custom.old (not referenced by bootloader (grub2))? [Yes/No]yes
* Removing kernel other 6.6.30-gentoo-custom.old (not referenced by bootloader (grub2))
 [-] /boot/vmlinuz-6.6.30-gentoo-custom.old
 [+] /usr/src/linux-6.6.30-gentoo
 [+] /lib/modules/6.6.30-gentoo-custom
 [-] /boot/System.map-6.6.30-gentoo-custom.old
 [-] /boot/config-6.6.30-gentoo-custom.old
* Removing kernel other 6.1.90-gentoo-custom.old (not referenced by bootloader (grub2))
 [-] /boot/vmlinuz-6.1.90-gentoo-custom.old
 [+] /usr/src/linux-6.1.90-gentoo
 [+] /lib/modules/6.1.90-gentoo-custom
 [-] /boot/System.map-6.1.90-gentoo-custom.old
 [-] /boot/config-6.1.90-gentoo-custom.old
Removed 2 kernels
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.6.30-gentoo-custom
Found initrd image: /boot/intel-uc.img
Found linux image: /boot/vmlinuz-6.1.90-gentoo-custom
Found initrd image: /boot/intel-uc.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
% ls /boot
EFI
grub
config-6.1.90-gentoo-custom
config-6.6.30-gentoo-custom
intel-uc.img
System.map-6.1.90-gentoo-custom
System.map-6.6.30-gentoo-custom
vmlinuz-6.1.90-gentoo-custom
vmlinuz-6.6.30-gentoo-custom
% sudo eclean-kernel -A -n 1 --no-kernel-install
Preserving currently running kernel (6.1.90-gentoo-custom)
Legend:
[-] file being removed
[x] file does not exist (anymore)
[+] file being kept (used by other kernels)

Remove other 6.6.30-gentoo-custom.old (not referenced by bootloader (grub2))? [Yes/No]yes
Remove other 6.1.90-gentoo-custom.old (not referenced by bootloader (grub2))? [Yes/No]yes
* Removing kernel other 6.6.30-gentoo-custom.old (not referenced by bootloader (grub2))
 [-] /boot/vmlinuz-6.6.30-gentoo-custom.old
 [+] /usr/src/linux-6.6.30-gentoo
 [+] /lib/modules/6.6.30-gentoo-custom
 [-] /boot/System.map-6.6.30-gentoo-custom.old
 [-] /boot/config-6.6.30-gentoo-custom.old
* Removing kernel other 6.1.90-gentoo-custom.old (not referenced by bootloader (grub2))
 [-] /boot/vmlinuz-6.1.90-gentoo-custom.old
 [+] /usr/src/linux-6.1.90-gentoo
 [+] /lib/modules/6.1.90-gentoo-custom
 [-] /boot/System.map-6.1.90-gentoo-custom.old
 [-] /boot/config-6.1.90-gentoo-custom.old
Removed 2 kernels
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.6.30-gentoo-custom
Found initrd image: /boot/intel-uc.img /boot/initramfs-6.6.30-gentoo-custom.img
Found linux image: /boot/vmlinuz-6.1.90-gentoo-custom
Found initrd image: /boot/intel-uc.img /boot/initramfs-6.1.90-gentoo-custom.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
% ls /boot
EFI
grub
config-6.1.90-gentoo-custom
config-6.6.30-gentoo-custom
initramfs-6.1.90-gentoo-custom.img
initramfs-6.6.30-gentoo-custom.img
intel-uc.img
System.map-6.1.90-gentoo-custom
System.map-6.6.30-gentoo-custom
vmlinuz-6.1.90-gentoo-custom
vmlinuz-6.6.30-gentoo-custom

Edit: also tried --exclude initramfs but the initramfs images were still deleted. Only --no-kernel-install seems to do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants