Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Role is removing and adding kernel image alternately #2

Open
stefanpinter opened this issue Feb 17, 2022 · 5 comments
Open

Role is removing and adding kernel image alternately #2

stefanpinter opened this issue Feb 17, 2022 · 5 comments

Comments

@stefanpinter
Copy link

stefanpinter commented Feb 17, 2022

Hello!

thank you for this role!

on at least one of our hosts the role is behaving bad.
when I run it I see it creating initrd and vmlinuz files in /boot
when I run it again it deletes those files
when I run it again, they are here again
this can be done again and again. obviously the server can't boot without these files. ;)
we stumpled over this today - even NO initrd and NO vmlinuz files were there!

Using Ubuntu 20.04

vars:
kernel_variant: generic
kernel_version: 5.4.0-99
reboot_on_kernel_update: false
install_kernel_headers: true

it is alternating between these:

  1. GOOD

root@servername:/boot# apt list --installed | grep 0-99

linux-image-5.4.0-99-generic/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed]
linux-libc-dev/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed,automatic]
linux-modules-5.4.0-99-generic/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed,automatic]
root@servername:/boot# ls -lsah
total 118M
4.0K drwxr-xr-x 4 root root 4.0K Feb 17 11:46 .
4.0K drwxr-xr-x 24 root root 4.0K Feb 17 11:46 ..
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-94-generic
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-96-generic
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-97-generic
233K -rw-r--r-- 1 root root 233K Feb 17 09:31 config-5.4.0-99-generic
1.0K drwxr-xr-x 5 root root 1.0K Feb 17 11:46 grub
36M -rw-r--r-- 1 root root 36M Feb 17 10:07 initrd.img-5.4.0-97-generic
36M -rw-r--r-- 1 root root 36M Feb 17 11:46 initrd.img-5.4.0-99-generic
12K drwx------ 2 root root 12K Jun 20 2016 lost+found
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-94-generic
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-96-generic
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-97-generic
4.6M -rw------- 1 root root 4.6M Feb 17 09:31 System.map-5.4.0-99-generic
14M -rw------- 1 root root 14M Feb 17 10:07 vmlinuz-5.4.0-97-generic
14M -rw------- 1 root root 14M Feb 2 17:23 vmlinuz-5.4.0-99-generic

  1. BAD

root@servername:/boot# apt list --installed | grep 0-99

linux-headers-5.4.0-99-generic/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed]
linux-headers-5.4.0-99/focal-updates,focal-security,now 5.4.0-99.112 all [installed,automatic]
linux-libc-dev/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed,automatic]
linux-modules-5.4.0-99-generic/focal-updates,focal-security,now 5.4.0-99.112 amd64 [installed,automatic]
root@servername:/boot# ls -lsah
total 69M
4.0K drwxr-xr-x 4 root root 4.0K Feb 17 11:47 .
4.0K drwxr-xr-x 24 root root 4.0K Feb 17 11:47 ..
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-94-generic
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-96-generic
233K -rw-r--r-- 1 root root 233K Feb 17 10:07 config-5.4.0-97-generic
233K -rw-r--r-- 1 root root 233K Feb 17 09:31 config-5.4.0-99-generic
1.0K drwxr-xr-x 5 root root 1.0K Feb 17 11:47 grub
36M -rw-r--r-- 1 root root 36M Feb 17 10:07 initrd.img-5.4.0-97-generic
12K drwx------ 2 root root 12K Jun 20 2016 lost+found
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-94-generic
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-96-generic
4.6M -rw------- 1 root root 4.6M Feb 17 10:07 System.map-5.4.0-97-generic
4.6M -rw------- 1 root root 4.6M Feb 17 09:31 System.map-5.4.0-99-generic
14M -rw------- 1 root root 14M Feb 17 10:07 vmlinuz-5.4.0-97-generic

@stefanpinter
Copy link
Author

some further tests: in fact this effectively does happen on EVERY host where I run this role
Ubuntu 18.04 as well:

vars:
kernel_variant: generic
kernel_version: 4.15.0-167
reboot_on_kernel_update: false
install_kernel_headers: true

for now I added this to the playbook so at least it checks if the kernel files are there:

tasks:

- name: prüft, ob kernel und vmlinuz-Dateien tatsächlich vorhanden sind
  shell: ls /boot/vmlinuz*{{ kernel_version }}*

- name: prüft, ob kernel und initrd-Dateien tatsächlich vorhanden sind
  shell: ls /boot/initrd*{{ kernel_version }}*

@ghost
Copy link

ghost commented Feb 17, 2022

Hello, thank you for the report.

I reproduced it and fixed it in e9ea379. Published in 1.2.9

Please confirm if everything is OK on your side

@stefanpinter
Copy link
Author

stefanpinter commented Feb 17, 2022

nice, thank you for being so quick ;)
looks good so far! i will do further tests soon...
it also didnt install headers reliably (or deleted it again)
I guess the cause might have been the same - what do you think?

@ghost
Copy link

ghost commented Feb 17, 2022

This issue also removed kernel headers.
The 1.2.9 also fix a condition related to kernel headers.

With 1.2.9, on my tests, the kernel headers seems to install properly.

@stefanpinter
Copy link
Author

hi! it doesnt seem to happen anymore, but it also doesnt remove the unwanted kernel packages when I want to downgrade the kernel...
for example my machine has 5.4.0-100-generic and i ran this:

 kernel_variant: generic
 kernel_version: 5.4.0-99
 reboot_on_kernel_update: false
 install_kernel_headers: true

after a reboot it still boots 5.4.0-100...

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

No branches or pull requests

1 participant