grub fails to add boot entries if python3-apt is missing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
In mantic and noble, when update-grub is run without python3-apt installed, the following output is generated:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Traceback (most recent call last):
File "/usr/lib/
import apt_pkg
ModuleNotFo
Traceback (most recent call last):
File "/usr/lib/
import apt_pkg
ModuleNotFo
Traceback (most recent call last):
File "/usr/lib/
import apt_pkg
ModuleNotFo
Adding boot menu entry for UEFI Firmware Settings ...
done
When this occurs, no Linux boot options are added to the GRUB config.
grub-sort-version was added to the grub-common binary package in 2.12~rc1-10ubuntu2. It is a python script which sorts the kernel versions via Debian rules using apt_pkg. The grub package was updated to depend on python3 so this script could run. However, the script also depends on python3-apt.
Either grub-sort-version should be changed not to depend on python3-apt (or fail gracefully when it's missing) or python3-apt should be added to the dependencies of grub-common.
affects: | grub (Ubuntu) → grub2 (Ubuntu) |
tags: | added: rls-nn-incoming |
tags: | removed: rls-nn-incoming |
Changed in grub2 (Ubuntu): | |
status: | Triaged → Fix Committed |
The whole thing is a bit annoying but it was nicer than forking dpkg --compare-versions for each pair. I'm not sure how you ended up with a system without python3-apt, it should be pulled in via ubuntu- minimal- >uuntu- advantage- tools already and you can't just go remove those packages and still pretend you have a supported system.