Public bug reported:

# 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.d/pin-6.5.0-35.cfg:
```
GRUB_DEFAULT="Ubuntu, with Linux 6.5.0-35-generic"
```

# 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-advanced-abd4adac-c96a-4e9b-bc6b-17edaad709ee>gnulinux-6.5.0-35-generic-advanced-abd4adac-c96a-4e9b-bc6b-17edaad709ee'
 (for 2.00 or later)
```
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.
However, the generated code for that override is broken (should be `"x$default" 
= 'xUbuntu, ...'` instead of `"x$default" = 'Ubuntu, ...'`) and GRUB falls back 
to booting the first available kernel.

# Workaround
I changed /etc/default/grub.d/pin-6.5.0-35.cfg to the following:
```
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 6.5.0-35-generic"
```

# 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_SUBMENU=true", but depending on what the issue was with #2049681, 
that bug might be covered by a solution for mine, so a "duplicates" pointing in 
the other direction might be more appropriate, if I understand the meaning of 
"duplicates" correctly.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: grub2 (not installed)
ProcVersionSignature: Ubuntu 6.5.0-35.35~22.04.1-generic 6.5.13
Uname: Linux 6.5.0-35-generic x86_64
NonfreeKernelModules: zfs
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: pass
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)

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug jammy

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2070250

Title:
  update-grub fails to set submenu item as default by name

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2070250/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to