DietPi update from v10.1.2 to v10.5.2 Fails: grub-efi-amd64 error

root@DietPi:~# locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
root@DietPi:~#

Did not yet reinstall grub-efi-amd64, so here goes:

root@DietPi:~# apt install --reinstall grub-efi-amd64
Summary:
  Upgrading: 0, Installing: 0, Reinstalling: 1, Removing: 0, Not Upgrading: 0
  Download size: 0 B / 46.7 kB
  Space needed: 0 B / 236 GB available

Preconfiguring packages ...
grub-efi-amd64 failed to preconfigure, with exit status 128
(Reading database ... 30516 files and directories currently installed.)
Preparing to unpack .../grub-efi-amd64_2.12-9+deb13u2_amd64.deb ...
Unpacking grub-efi-amd64 (2.12-9+deb13u2) over (2.12-9+deb13u2) ...
Setting up grub-efi-amd64 (2.12-9+deb13u2) ...
dpkg: error processing package grub-efi-amd64 (--configure):
 installed grub-efi-amd64 package post-installation script subprocess returned error exit status 128
Errors were encountered while processing:
 grub-efi-amd64
Error: Sub-process /usr/bin/dpkg returned an error code (1)
root@DietPi:~#

:face_with_raised_eyebrow:

Here btw the respective debug output from my test system:

+ db_input medium grub2/linux_cmdline
+ _db_cmd INPUT medium grub2/linux_cmdline
+ local _db_internal_IFS=

+ IFS=
+ printf %s\n INPUT medium grub2/linux_cmdline
+ IFS=

+ read -r _db_internal_line
+ IFS=

+ RET=30 question skipped
+ local _db_status=30
+ return 30
+ true

So it gets RET=30 question skipped like the others.

Doing an interactive reconfiguration fails the same way?

dpkg-reconfigure grub-efi-amd64
root@DietPi:~# dpkg-reconfigure grub-efi-amd64
/usr/sbin/dpkg-reconfigure: grub-efi-amd64 is broken or not fully installed
root@DietPi:~#

:thinking:

It seem to not like the package state, when postinst failed before:

mv /var/lib/dpkg/info/grub-efi-amd64.postinst /var/lib/dpkg/info/grub-efi-amd64.postinst.bak
dpkg --configure -a
mv /var/lib/dpkg/info/grub-efi-amd64.postinst.bak /var/lib/dpkg/info/grub-efi-amd64.postinst
dpkg-reconfigure grub-efi-amd64

OK, ran the above commands. DietPi gave a number of choices to make under the dialog heading “Configuring grub-efi-amd64”, then completed without any messages:

root@DietPi:~# mv /var/lib/dpkg/info/grub-efi-amd64.postinst /var/lib/dpkg/info/grub-efi-amd64.postinst.bak
dpkg --configure -a
mv /var/lib/dpkg/info/grub-efi-amd64.postinst.bak /var/lib/dpkg/info/grub-efi-amd64.postinst
dpkg-reconfigure grub-efi-amd64
Setting up grub-efi-amd64 (2.12-9+deb13u2) ...
root@DietPi:~#

Next move ?

Setting up grub-efi-amd64 (2.12-9+deb13u2) ... is from the dpkg --configure -a, so dpkg-reconfigure grub-efi-amd64 seems to not have produced any console output, aside of the dialogs. So it failed as well.

Can you run dpkg-reconfigure grub-efi-amd64 again, confirming/leaving untouched all values/choices by just hitting return, and tell me which dialog is the last you see?

Oh actually, I just see this:

You added quite a number of cmdline arguments to the GRUB_CMDLINE_LINUX_DEFAULT setting. It might be copy&paste quirk, but after this line in your config script debug output, there is an empty line, which shouldn’t be there. The same can be seen in the frontend debug output:

+ IFS=
+ printf %s\n SET grub2/linux_cmdline_default consoleblank=0 amd_pstate.shared_mem=1 mitigations=off elevator=none tsc=perfect quiet irqaffinity=0 nosoftlockup nmi_watchdog=0 nohz=on isolcpus=nohz,domain,1-7 nohz_full=1-7 rcu_nocbs=1-7 no_balance_cores=1-7

+ IFS=

vs other sections, which do not have the empty line after printf ...:

+ IFS=
+ printf %s\n SET grub2/linux_cmdline net.ifnames=0
+ IFS=

So maybe the error is not coming from the grub2/linux_cmdline value in debconf or GRUB_CMDLINE_LINUX in /etc/default/grub, but from the grub2/linux_cmdline_default or GRUB_CMDLINE_LINUX_DEFAULT respectively. And maybe that newline in the value itself spills over into the next variable/question.

A proper newline in this file would not cause a newline inside the assigned variable value. I could imagine that you edited the file with an editor on Windows, which added a carriage return (common for Windows line endings: CRLF vs LF). Or another control character was accidentally added. Please try to edit /etc/default/grub with a Linux editor, or nano /etc/default/grub from console, and remove the line ending and at best last character of GRUB_CMDLINE_LINUX_DEFAULT. E.g.:

  1. Navigate to the start of GRUB_CMDLINE_LINUX below.
  2. Hit the delete (<—) key 2 or 3 times, until the last character 7 of the GRUB_CMDLINE_LINUX_DEFAULT was deleted.
  3. Re-add the 7 and hit return to re-add a proper newline between the two settings.
  4. Save with CTRL+O, return.
  5. Exit with CTRL+X.

And then we should also check the respective debconf value:

sed -n '/grub2\/linux_cmdline_default/,/^$/l' /var/cache/debconf/config.dat

This shows also control characters in the grub2/linux_cmdline_default section of the debconf data.

Thanks for the continued deep sleuthing… :smiling_face_with_sunglasses: By way of explanation, the long string of arguments comes from a recipe to build an awesome mpd-based music player, running on dietpi OS. The parameter string is a cut-n-paste from the build instruction document.

It warns to beware of Windows messing with line endings, suggesting nano or Notepad++ on a Windows machine to do the job.

So, as you suggested… edit using nano, only to find the closing quote (ie: double-quote character) alone by itself on the line below the long string :face_with_raised_eyebrow:. As found:

post edit:

Then as per the header comment:

root@DietPi:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.12.100+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.100+deb13-amd64
Found linux image: /boot/vmlinuz-6.12.57+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.57+deb13-amd64
Adding boot menu entry for UEFI Firmware Settings ...
done
root@DietPi:~#

then:

root@DietPi:~# sed -n '/grub2\/linux_cmdline_default/,/^$/l' /var/cache/debconf/config.dat
Name: grub2/linux_cmdline_default$
Template: grub2/linux_cmdline_default$
Value: consoleblank=0 amd_pstate.shared_mem=1 mitigations=off elevato\
r=none tsc=perfect quiet irqaffinity=0 nosoftlockup nmi_watchdog=0 no\
hz=on isolcpus=nohz,domain,1-7 nohz_full=1-7 rcu_nocbs=1-7 no_balance\
_cores=1-7$
Owners: grub-efi-amd64$
$
root@DietPi:~#

OK - is it now time to attempt the update to v10.5.2 ?

Ah great, so that was it, let’s hope that was really the issue. The value in the debconf config looks good, no trailing linebreak there.

Test this again:

dpkg-reconfigure -f noninteractive grub-efi-amd64
root@DietPi:~# dpkg-reconfigure -f noninteractive grub-efi-amd64
Installing for x86_64-efi platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.12.100+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.100+deb13-amd64
Found linux image: /boot/vmlinuz-6.12.57+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.57+deb13-amd64
Adding boot menu entry for UEFI Firmware Settings ...
done
Processing triggers for shim-signed:amd64 (1.51~1+deb13u1+16.1-2~deb13u1) ...
root@DietPi:~#

Is this the thumbs up I’ve been looking for ?

Oh yes, that worked :+1:. So the newline really was the culprit. Glad we finally found it, and good to know the effect of such on debconf dialogues. I’ll open a bug report at Debian, as I think debconf requires to print a meaningful error message, instead of just exiting silently, considering that debugging this nested shell => perl => shell call path is so difficult.

Debian bug report: https://bugs.debian.org/1144150

Probably it is a rare case, but it shouldn’t be hard to emit something like

debconf retrieved an invalid input line “” while processing package “grub-efi-amd64”. Please check your package configuration files or inputs.

to give admins some pointer.

SUCCESS !!!

Yes, just to confirm - the update to v10.6.2 ran cleanly and without incident :slightly_smiling_face:.

Thank you so much for digging in to solve this obscure little show-stopper - I really appreciate your persistence & dedication to making DietPi “so easy” to use (…with help and assistance when required).

As an added bonus, the OS upgrade has once again improved the quality/ precision of the music playback by a tiny - but undeniable - degree. So thanks to the Dev Team for continuing to make my HiFi a little more satisfying !!:clap: !!

Great to hear!

Seeing the cooler, I just learned recently that these heat pipes do contain actual liquids, which vaporize at the chip side and condense within the fins side. Hence latent heat absorption and actual convection to make dissipation to and throughout the fins quite effective. Totally makes sense, but I never took the word “pipe” that literal :sweat_smile:.