update-grub fails to set submenu item as default by name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
# Motivation
The latest 22.04 HWE kernel (6.5.0-41) doesn't work with my dock (#2070020), so I'm trying to set a previous stable kernel (6.5.0-35) as a default in GRUB.
# What I did
I've added the following to /etc/default/
```
GRUB_DEFAULT=
```
# What went wrong
update-grub warns:
```
Warning: Please don't use old title `Ubuntu, with Linux 6.5.0-35-generic' for GRUB_DEFAULT, use `Advanced options for Ubuntu>Ubuntu, with Linux 6.5.0-35-generic' (for versions before 2.00) or `gnulinux-
```
It does add an override to grub.cfg to change the default to "Advanced options for Ubuntu>Ubuntu, with Linux 6.5.0-35-generic", though:
```
if [ "x$default" = 'Ubuntu, with Linux 6.5.0-35-generic' ]; then default='Advanced options for Ubuntu>Ubuntu, with Linux 6.5.0-35-generic'; fi;
```
That's why I initially thought I did everything right and disregarded the warning.
# Workaround
I changed /etc/default/
```
GRUB_DEFAULT=
```
# Remarks
The workaround is the preferred way to set a default by name.
However, I believe that if there is code that generates a broken override, it should be fixed or removed.
# Relation to other bugs
I believe this is NOT a duplicate of #2049681, since it also occurs without "GRUB_DISABLE_
# Causes
grub-mkconfig generates broken grub.cfg code to add the submenu part to the default.
It's still present in the current master branch:
https:/
It's missing an `x` before `$quoted`.
Because of that, the condition always fails and GRUB falls back to booting the first available kernel.
This was introduced when grub-mkconfig was updated to support submenus in 2012:
https:/
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: grub2 (not installed)
ProcVersionSign
Uname: Linux 6.5.0-35-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: KDE
Date: Mon Jun 24 11:41:59 2024
InstallationDate: Installed on 2023-07-05 (354 days ago)
InstallationMedia: Kubuntu 22.04.2 LTS "Jammy Jellyfish" - Release amd64 (20230223)
SourcePackage: grub2
UpgradeStatus: No upgrade log present (probably fresh install)