mocaccinoOS / mocaccino

:musical_score: where magic happens
72 stars 7 forks source link

Kernel upgrade/switch fails, and multiple installed at the same time too #5

Open mudler opened 3 years ago

mudler commented 3 years ago

Fail to upgrade or switch kernel in MOS Desktop, before, but at least verified from 18 April 2021 builds.

Luet version: Not relevant, a packaging issue

CPU architecture, OS, and Version: MOS Desktop

Describe the bug Upgrading kernels or switching fails. I've tried to uninstall the standard kernel and install the lts, and it fails as grub doesn't have either an Initrd entry, and dracut seems to complain during the process

To Reproduce

luet uninstall -y kernel/mocaccino-full && luet install -y kernel/mocaccino-lts-full

Same thing probably happens during upgrades

Expected behavior System booting

Logs Installing two kernels at the same time instead fails for unproper symlink handling: VirtualBox_desktop_18_04_2021_11_59_59

This is by doing uninstall and install: VirtualBox_desktop_18_04_2021_12_08_58

Additional context

geaaru commented 3 years ago

This issue seems related to three distinct issues:

msdobrescu commented 3 years ago

Old images should be removed also.

geaaru commented 3 years ago

Implemented experimental feature: mos kernel geninitrd that will replace kernel-upgrade and mocaccino-dracut to support multiple kernels setup, links and grub config generation.

https://github.com/mocaccinoOS/mos-cli/commit/17e3553c7ee07d7696e6f36ac2fdb64d2dd67e38

# mos kernel geninitrd --help
Rebuild Dracut initrd images or for Mocaccino Micro fix links.

$ # Generate all initrd images of the kernels available on boot dir.
$ mos kernel geninitrd --all

$ # Generate all initrd images of the kernels available on boot dir
$ # and set the bzImage, Initrd links to one of the kernel available
$ # if not present or to the next release of the same kernel after the
$ # upgrade.
$ mos kernel geninitrd --all --set-links

$ # Just show what dracut commands will be executed for every initrd images.
$ mos kernel geninitrd --all --dry-run

$ # Generate the initrd image for the kernel 5.10.42
$ mos kernel geninitrd --version 5.10.42

$ # Generate the initrd image for the kernel 5.10.42 and kernel type vanilla.
$ mos kernel geninitrd --version 5.10.42 --ktype vanilla

$ # Generate the initrd image for the kernel 5.10.42 and kernel type vanilla
$ # and set the links bzImage, Initrd to the selected kernel/initrd.
$ mos kernel geninitrd --version 5.10.42 --ktype vanilla

Usage:
  mos kernel geninitrd [flags]

Aliases:
  geninitrd, gi

Flags:
      --all                  Rebuild all images with kernel.
      --bootdir string       Directory where analyze kernel files. (default "/boot")
      --dracut-opts string   Override the default dracut options used on the initrd image generation.
                             Set the MOS_DRACUT_ARGS env in alternative.
      --dry-run              Dry run commands.
      --grub                 Update grub.cfg.
  -h, --help                 help for geninitrd
      --ktype string         Specify the kernel type of the initrd image to build.
      --purge                Clean orphan initrd images without kernel.
      --set-links            Set bzImage and Initrd links for the selected kernel or update links of the upgraded kernel.
      --version string       Specify the kernel version of the initrd image to build.

Global Flags:
      --config string   config file (default is $HOME/.mos.yaml)