[Bug 1176652] Re: 40grub2 gets confused for menuentry generated in other languages

Benno Schulenberg bensberg at telfort.nl
Sun May 3 10:17:53 UTC 2020


Indeed, grub.cfg gets larger and larger with _every_ run of the script
(all my systems are localized to Dutch, which uses "op" not "on").
Yesterday, booting on my old laptop had become so slow, that I finally
looked into it.  It resulted that grub.cfg had grown to *seventeen
thousand* lines, with hundreds and hundreds of repetitions of "[name of
distro] (op /dev/sda3) (op /dev/sda7) (op /dev/sda3) ...".  The grub.cfg
files on the other partitions looked similar -- whenever any of them
gets a new kernel, it copies all menu and submenu items from the other
grub.cfg files, which of course include its own items, plus older copies
of those items, plus still older copies, plus...  A horrendous tangle.

So, I would suggest to change:

  elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then

to:

  elif echo "$title" | grep -q '(\w\+ /dev/\w\+)$'; then

to hopefully make it translation resistant.

** Summary changed:

- 40grub2 gets confused for menuentry generated in other languages
+ grub.cfg gets larger and larger when menu entries are generated in another language

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

Title:
  grub.cfg gets larger and larger when menu entries are generated in
  another language

Status in os-prober package in Ubuntu:
  Confirmed

Bug description:
  The script in 40grub2 has some code to skip certain entries from
  grub.cfg. It goes like this:

      elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then
          log "Skipping entry '$title':"
         log "appears to be an automatic reference taken from another menu.lst"
         ignore_item=1

  (( Notice the "on" ))

  However, if the grub.cfg was created on a system with a non standard
  LANG the grep does not find the match. This is particular nasty on a
  system with one boot partition and a few Linux root partitions. The
  end result of update-grub is a bigger grub.cfg after each run. It gets
  bigger and bigger. Also update-grub takes longer and longer to finish.

  Here is an example of a menuentry on my system

      menuentry 'Ubuntu 11.04 (11.04) (op /dev/mapper/vol1-root1004)'
  --class gnu-linux --class gnu --class os $menuentry_id_option
  'osprober-gnulinux-/vmlinuz-3.5.0-28-generic--29cff8d9-4fb2-49ec-
  8c62-e13f2a961abd' {

  Here is a session with running update-grub twice in a row.

  root at rockie:~# echo $LANG
  nl_NL.UTF-8
  root at rockie:~# grep menuentry /boot/grub/grub.cfg|wc -l
  34
  root at rockie:~# update-grub
  Aanmaken van 'grub.cfg'...
  Linux-afbeelding is gevonden: /boot/vmlinuz-3.5.0-28-generic
  Initrd-image gevonden: /boot/initrd.img-3.5.0-28-generic
  Found memtest86+ image: /memtest86+.bin
  Ubuntu 10.04.2 LTS (10.04) is gevonden op /dev/sda2
  Ubuntu 11.04 (11.04) is gevonden op /dev/mapper/vol1-clayrootbackup
  Ubuntu 10.04.1 LTS (10.04) is gevonden op /dev/mapper/vol1-root1004
  voltooid
  root at rockie:~# grep menuentry /boot/grub/grub.cfg|wc -l
  88

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1176652/+subscriptions



More information about the foundations-bugs mailing list