[Bug 2070250] Re: update-grub fails to set submenu item as default by name

TomyLobo 2070250 at bugs.launchpad.net
Mon Jun 24 10:56:52 UTC 2024


** Description changed:

  # 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.
+ 
+ # 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://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob;f=util/grub.d/10_linux.in;h=cc393be7eda9ab79cd0207434924c06fbd27bb6d;hb=HEAD#l104
+ 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://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=0cdc126ca2c7af914ede99253d1546ebbd11e937
  
  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)

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

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

Status in grub2 package in Ubuntu:
  New

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.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.

  # 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.

  # 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://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob;f=util/grub.d/10_linux.in;h=cc393be7eda9ab79cd0207434924c06fbd27bb6d;hb=HEAD#l104
  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://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=0cdc126ca2c7af914ede99253d1546ebbd11e937

  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)

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




More information about the foundations-bugs mailing list