Ubuntu logo
Ubuntu logo

I have recently seen some cases of apt failing when doing package upgrades. It seems like there is a change in the package grub-common that breaks on some systems but works well on others. Systems installed with the same version of Ubuntu around the same time and with the same upgrade, frequency has been hit and miss with this error.

When Ubuntu and APT try to upgrade, you will see the following error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up grub-common (2.04-1ubuntu26.13) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Failed to restart grub-common.service: Unit grub-common.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status grub-common.service' for details.
invoke-rc.d: initscript grub-common, action "restart" failed.
● grub-common.service - Record successful boot for GRUB
   Loaded: error (Reason: Invalid argument)
   Active: active (exited) since Thu 2021-07-22 22:22:31 CEST; 3 months 10 days ago

Nov 01 11:53:34 ServerHostName systemd[1]: [/lib/systemd/system/grub-common.service:10] Executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail
Nov 01 11:53:34 ServerHostName systemd[1]: grub-common.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Nov 01 11:53:34 ServerHostName systemd[1]: [/lib/systemd/system/grub-common.service:10] Executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail
Nov 01 11:53:34 ServerHostName systemd[1]: grub-common.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Nov 01 11:54:41 ServerHostName systemd[1]: [/lib/systemd/system/grub-common.service:10] Executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail
Nov 01 11:54:41 ServerHostName systemd[1]: grub-common.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Nov 01 11:54:42 ServerHostName systemd[1]: [/lib/systemd/system/grub-common.service:10] Executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail
Nov 01 11:54:42 ServerHostName systemd[1]: grub-common.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Nov 01 11:54:42 ServerHostName systemd[1]: [/lib/systemd/system/grub-common.service:10] Executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail
Nov 01 11:54:42 ServerHostName systemd[1]: grub-common.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
dpkg: error processing package grub-common (--configure):
 installed grub-common package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of grub2-common:
 grub2-common depends on grub-common (= 2.04-1ubuntu26.13); however:
  Package grub-common is not configured yet.

dpkg: error processing package grub2-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-pc-bin:
 grub-pc-bin depends on grub-common (= 2.04-1ubuntu26.13); however:
  Package grub-common is not configured yet.

dpkg: error processing package grub-pc-bin (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-pc:
 grub-pc depends on grub-common (= 2.04-1ubuntu26.13); however:
  Package grub-common is not configured yet.
 grub-pc depends on grub2-common (= 2.04-1ubuntu26.13); however:
  Package grub2-common is not configured yet.
 grub-pc depends on grub-pc-bin (= 2.04-1ubuntu26.13); however:
  Package grub-pc-bin is not configured yet.

dpkg: error processing package grub-pc (--configure):No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.                                                                                                                                                                                                                                                                         No apport report written because MaxReports is reached already

 dependency problems - leaving unconfigured
Errors were encountered while processing:
 grub-common
 grub2-common
 grub-pc-bin
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

The error points to line 10 of the file /lib/systemd/system/grub-common.service, so let us examine that file on line 10.

ExecStart=grub-editenv /boot/grub/grubenv unset recordfail 

The error message states: executable path is not absolute, ignoring: grub-editenv /boot/grub/grubenv unset recordfail so let us make the path absolute, and to do so we issue the command which grub-editenv to find the path. The path for this executable is /usr/bin/grub-editenv so let us update the file with this path, making line 10 this:

ExecStart=/usr/bin/grub-editenv /boot/grub/grubenv unset recordfail

After you have updated the file and saved it, perform a new sudo apt upgrade and see that APT can now complete the upgrade.

By Jostein Elvaker Haande

"A free society is a society where it is safe to be unpopular" - Adlai Stevenson

Leave a Reply

Your email address will not be published. Required fields are marked *