Apt wants to reinstall Grub?

chrisb1

Member
Aug 14, 2021
13
0
21
Hi,
today I noticed, that apt wants to reinstall grub (I'm on systemd-boot) and I'm not really sure why. grub and osprober are at least no direct dependencies of the packages that should be updated.
Can this cause any problems? I'm honestly not sure if the host would switch back to Grub as a consequence of the installation and initial automatic configuration (done by apt/dpkg).
This is the output of apt:
Code:
root@proxmox1:~# apt full-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  grub-common grub-pc grub-pc-bin grub2-common os-prober proxmox-kernel-6.5.11-8-pve-signed
The following packages will be upgraded:
  proxmox-backup-client proxmox-backup-file-restore proxmox-kernel-6.5
3 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 110 MB of archives.
After this operation, 581 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Could anyone please confirm, that the installation won't cause issues? And could someone please explain the cause for the grub (re-)installation? My apt-skills are far not sufficient...

Thanks
 
Seams like the kernel update is causing the Grub installation, but the reason is unclear to me:
Bash:
root@proxmox1:~# apt install --dry-run proxmox-kernel-6.5
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  grub-common grub-pc grub-pc-bin grub2-common os-prober proxmox-kernel-6.5.11-8-pve-signed
Suggested packages:
  multiboot-doc grub-emu mtools xorriso desktop-base
The following NEW packages will be installed:
  grub-common grub-pc grub-pc-bin grub2-common os-prober proxmox-kernel-6.5.11-8-pve-signed
The following packages will be upgraded:
  proxmox-kernel-6.5
1 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
Inst grub-common (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Inst grub2-common (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Inst grub-pc-bin (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Inst grub-pc (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Inst os-prober (1.81 Debian:12.4/stable [amd64])
Inst proxmox-kernel-6.5.11-8-pve-signed (6.5.11-8 Proxmox Debian Repository:stable [amd64])
Inst proxmox-kernel-6.5 [6.5.11-7] (6.5.11-8 Proxmox Debian Repository:stable [all])
Conf grub-common (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Conf grub2-common (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Conf grub-pc-bin (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Conf grub-pc (2.06-13+pmx1 Proxmox Debian Repository:stable [amd64])
Conf os-prober (1.81 Debian:12.4/stable [amd64])
Conf proxmox-kernel-6.5.11-8-pve-signed (6.5.11-8 Proxmox Debian Repository:stable [amd64])
Conf proxmox-kernel-6.5 (6.5.11-8 Proxmox Debian Repository:stable [all])
 
Same here, migrated to systemd-boot and got rid of this grub crap. But on kernel upgrade I see system wants to reinstall grub and ruin my boot.

I found out that grub packages are in proxmox kernel recomends list:

Code:
apt info proxmox-kernel-6.8.12-9-pve-signed
Package: proxmox-kernel-6.8.12-9-pve-signed
Version: 6.8.12-9
Priority: optional
Section: admin
Source: proxmox-kernel-signed-6.8 (6.8.12+9)
Maintainer: Proxmox Support Team <support@proxmox.com>
Installed-Size: 577 MB
Provides: linux-image-6.8.12-9-pve-amd64, proxmox-kernel-6.8.12-9-pve
Depends: busybox, initramfs-tools | linux-initramfs-tool
Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub-efi-arm64
Suggests: pve-firmware
Conflicts: proxmox-kernel-6.8.12-9-pve
Replaces: proxmox-kernel-6.8.12-9-pve
Download-Size: 103 MB
APT-Sources: http://download.proxmox.com/debian/................................. amd64 Packages
Description: Proxmox Kernel Image (signed)
 This package contains the linux kernel and initial ramdisk used for booting
 .
 This package contains the kernel image signed by the Proxmox Secure Boot CA.

Thus on already installed and running host systems set APT options to disable recommended and suggested package installs:

Code:
cat > /etc/apt/apt.conf.d/99norecommends << EOT
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOT

After this, apt update and upgrade does not bother about grub anymore.
 
This is likely just because of a dependency. If you start excluding packages from the system, you may end up with a broken or non-upgrading system.

The fact the binaries are installed is irrelevant to the mode your system starts in. The system will figure it out whether or not you're using grub to boot and then take the appropriate actions. If you remove the grub tools and ignore the dependency, now the command that package runs during an update or configuration change may fail and whether that causes the entire process to halt or just silently errors out or has some undesirable side-effect is pretty much unknown to you. Or even worse, you don't purge the packages and it continues using an outdated and vulnerable version of the tool/config.

You shouldn't just randomly decide to rm /usr/bin/something (which is what you're trying to accomplish) without understanding across the system what else calls it.
 
You use sudo apt-mark hold and do that for each of those grub packages as well as os-prober. I switched over to systemd-boot shortly after install Proxmox as I despise GRUB. I removed all the grub, os-prober and shim-xx packages with sudo dpkg -P --force-all grub-xx, etc. And then used apt-mark hold to make sure they do not come back.