systemd[1]: /lib/systemd/system/grub-common.service:10: 可执行路径不是绝对的:grub-editenv /boot/grub/grubenv unset recordfail

systemd[1]: /lib/systemd/system/grub-common.service:10: 可执行路径不是绝对的:grub-editenv /boot/grub/grubenv unset recordfail

我的 Ubuntu 服务器在一次版本升级期间崩溃后出现了问题。我使用 do-release-upgrade 命令从 Ubuntu 18.04 升级到 20.04。在此过程中,我意外地按了 CTRL+C,因此不得不硬重启系统。系统当前显示“Ubuntu 20.04”,所以我猜升级部分成功了。

我设法通过 SSH 恢复了对系统的访问,现在我正在尝试修复这些问题。运行 apt-get upgrades 时,我注意到 dpkg 抛出了有关 grub-common 包的错误:

root@caesarovich:~# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libnginx-mod-http-geoip libunistring2:i386
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 289 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up grub-common (2.04-1ubuntu26.15) ...
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: Exec format error.
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: Exec format error)
   Active: inactive (dead)

Apr 07 14:35:20 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:40:57 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:40:57 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:40:58 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:41:18 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:41:18 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:41:18 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:50:28 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:50:29 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
Apr 07 14:50:29 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail
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 grub-efi:
 grub-efi depends on grub-common (= 2.04-1ubuntu26.15); however:
  Package grub-common is not configured yet.

dpkg: error processing package grub-efi (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-efi-amd64-bin:
 grub-efi-amd64-bin depends on grub-common (>= 2.02~beta2-9); however:
  Package grub-common is not configured yet.

dpkg: error processing package grub-efi-amd64-bin (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-efi-amd64:
 grub-efi-amd64 depends on grub-efi-amd64-bin (= 2.04-1ubuntu44.2); however:
  Package grub-efi-amd64-bin is not configured yet.

dpkg: error processing package grub-efi-amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub2-common:
 grub2-common depends on grub-common (= 2.04-1ubuntu26.15); however:
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
                                                                                       No apport report written because MaxReports is reached already
                                                                                                                                                     No apport report written because MaxReports is reached already
                          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-efi-amd64-signed:
 grub-efi-amd64-signed depends on grub-efi-amd64-bin (= 2.04-1ubuntu44.2); however:
  Package grub-efi-amd64-bin is not configured yet.
 grub-efi-amd64-signed depends on grub-efi-amd64 | grub-pc; however:
  Package grub-efi-amd64 is not configured yet.
  Package grub-pc is not installed.
 grub-efi-amd64-signed depends on grub2-common (>= 2.02~beta2-36ubuntu3.31); however:
  Package grub2-common is not configured yet.

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

引起我注意的是这一行:

Apr 07 14:40:57 caesarovich.xyz systemd[1]: /lib/systemd/system/grub-common.service:10: Executable path is not absolute: grub-editenv /boot/grub/grubenv unset recordfail

但我在网上找不到关于此错误的任何信息。我​​想知道是否有人知道这是怎么回事。任何提示都欢迎!

编辑:以下是请求的其他信息

~# cat /lib/systemd/system/grub-common.service 
[Unit]
Description=Record successful boot for GRUB
After=sleep.target
ConditionPathExists=/boot/grub/grub.cfg

[Service]
Type=oneshot
Restart=no
ExecStartPre=/bin/sh -c '[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv; mkdir -p /boot/grub'
ExecStart=grub-editenv /boot/grub/grubenv unset recordfail
ExecStartPost=/bin/sh -c 'if grub-editenv /boot/grub/grubenv list | grep -q initrdless_boot_fallback_triggered=1; then echo "grub: GRUB_FORCE_PARTUUID set, initrdless boot paniced, fallback triggered."; fi'
StandardOutput=kmsg

[Install]
WantedBy=multi-user.target sleep.target

命令:文件 /usr/bin/grub-editenv

/usr/bin/grub-editenv: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e9970f097fb3d25735e9607c0cb1da91505f8f92, for GNU/Linux 3.2.0, stripped

[解决了]

最近我没有太多时间来解决这个问题,但今天我以清醒的头脑回来,并设法解决了这个问题。

问题是grub-通用服务执行开始并不是绝对的。使固定:编辑 .service 文件并将路径设为绝对路径ExecStart=/usr/bin/grub-editenv而不是ExecStart=grub-editenv

相关内容