APT 报告“/usr/sbin/grub-mkconfig:13:/etc/default/grub:After:未找到”和“存储库没有 Release 文件”

APT 报告“/usr/sbin/grub-mkconfig:13:/etc/default/grub:After:未找到”和“存储库没有 Release 文件”

每次运行sudo apt-get update(即使包含-f--fix-broken)时,我都会得到以下信息:

$ sudo apt-get update
Hit:1 ******archive.canonical.com/ubuntu focal InRelease
Ign:2 ******ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease          
Get:3 ******security.ubuntu.com/ubuntu focal-security InRelease [107 kB]      
Hit:4 ******ppa.launchpad.net/canonical-hwe-team/backport-iwlwifi/ubuntu focal InRelease
Ign:5 ******ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease              
Hit:6 ******us.archive.ubuntu.com/ubuntu focal InRelease                      
Get:7 ******us.archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]     
Hit:8 ******archive.ubuntu.com/ubuntu focal InRelease                         
Get:9 ******us.archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]  
Hit:10 ******ppa.launchpad.net/gottcode/gcppa/ubuntu focal InRelease
Hit:11 ******ppa.launchpad.net/teejee2008/timeshift/ubuntu focal InRelease
Hit:12 ******ppa.launchpad.net/thopiekar/cura/ubuntu focal InRelease
Err:13 ******ppa.launchpad.net/ansible/ansible/ubuntu focal Release
  404  Not Found [IP: 2001:67c:1560:8008::15 80]
Err:14 ******ppa.launchpad.net/gencfsm/ppa/ubuntu focal Release
  404  Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository '******ppa.launchpad.net/ansible/ansible/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

其他人报告了同样的问题,但我尝试的任何修复都遇到以下问题:

$ sudo apt install ansible
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ieee-data python3-argcomplete python3-jinja2 python3-jmespath
  python3-kerberos python3-libcloud python3-netaddr python3-ntlm-auth
  python3-requests-kerberos python3-requests-ntlm python3-selinux
  python3-winrm python3-xmltodict
Suggested packages:
  cowsay sshpass python-jinja2-doc ipython3 python-netaddr-docs
The following packages will be REMOVED:
  linux-image-5.4.0-42-generic
The following NEW packages will be installed:
  ansible ieee-data python3-argcomplete python3-jinja2 python3-jmespath
  python3-kerberos python3-libcloud python3-netaddr python3-ntlm-auth
  python3-requests-kerberos python3-requests-ntlm python3-selinux
  python3-winrm python3-xmltodict
0 upgraded, 14 newly installed, 1 to remove and 38 not upgraded.
2 not fully installed or removed.
Need to get 9,398 kB of archives.
After this operation, 76.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 ******us.archive.ubuntu.com/ubuntu focal/main amd64 python3-jinja2 all 2.10.1-2 [95.5 kB]
Get:2 ******us.archive.ubuntu.com/ubuntu focal/main amd64 ieee-data all 20180805.1 [1,589 kB]
Get:3 ******us.archive.ubuntu.com/ubuntu focal/main amd64 python3-netaddr all 0.7.19-3 [235 kB]
Get:4 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 ansible all 2.9.6+dfsg-1 [5,794 kB]
Get:5 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-argcomplete all 1.8.1-1.3ubuntu1 [27.2 kB]
Get:6 ******us.archive.ubuntu.com/ubuntu focal/main amd64 python3-jmespath all 0.9.4-2 [21.3 kB]
Get:7 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-kerberos amd64 1.1.14-3.1build1 [22.6 kB]
Get:8 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-libcloud all 2.8.0-1 [1,403 kB]
Get:9 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-ntlm-auth all 1.1.0-1 [19.6 kB]
Get:10 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-requests-kerberos all 0.12.0-2 [11.9 kB]
Get:11 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-requests-ntlm all 1.1.0-1 [6,004 B]
Get:12 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-selinux amd64 3.0-1build2 [139 kB]
Get:13 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-xmltodict all 0.12.0-1 [12.6 kB]
Get:14 ******us.archive.ubuntu.com/ubuntu focal/universe amd64 python3-winrm all 0.3.0-2 [21.7 kB]
Fetched 9,398 kB in 1s (12.0 MB/s)         
(Reading database ... 250791 files and directories currently installed.)
Removing linux-image-5.4.0-42-generic (5.4.0-42.46) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-42-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 13: /etc/default/grub: After: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.4.0-42-generic (--remove):
 installed linux-image-5.4.0-42-generic package post-removal script subprocess r
eturned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.4.0-42-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试手动删除 linux-image-5.4.0-42-generic

$ sudo apt remove -f linux-image-5.4.0-42-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-5.4.0-42-generic
0 upgraded, 0 newly installed, 1 to remove and 38 not upgraded.
2 not fully installed or removed.
After this operation, 11.7 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 250791 files and directories currently installed.)
Removing linux-image-5.4.0-42-generic (5.4.0-42.46) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-42-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 13: /etc/default/grub: After: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.4.0-42-generic (--remove):
 installed linux-image-5.4.0-42-generic package post-removal script subprocess r
eturned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.4.0-42-generic
Processing was halted because there were too many errors.

sudo-apt upgrade达到 98%,最后完成:

dpkg: error processing package linux-image-5.4.0-51-generic (--configure):
 installed linux-image-5.4.0-51-generic package post-installation script subproc
ess returned error exit status 1
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Errors were encountered while processing:
 linux-image-5.4.0-52-generic
 linux-image-5.4.0-51-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

您有多个问题。只需阅读您的输出,它就会告诉您所需的一切。

  1. 您的 PPA 已过时。删除它们

  2. 你的脚本被损坏了。

    您的输出显示:

    /usr/sbin/grub-mkconfig: 13: /etc/default/grub: After: not found

    /usr/sbin/grub-mkconfig 文件由软件包提供grub-common。只需重新安装它:sudo apt install --reinstall grub-common

答案2

其实我找到了答案错误:安装的子进程删除后脚本返回错误退出状态 1 - Ubuntu 论坛

对我有用的步骤粘贴如下

问题似乎出在 GRUB 的安装后脚本中:/etc/kernel/postrm.d/zz-update-grub

我没有遇到这个问题,但我做了以下操作。唯一的区别是我的系统没有因为脚本失败而挂起。

选项 1:如果您已启动到操作系统并且可以运行,apt-get install 您可以使用 测试这是否可行sudo apt-get install 2vard。这是一个非常小的包。如果安装成功:

  1. 清除 grub-common。该命令将卸载 grub-common 和 grub-pc

    sudo apt-get purge grub-common
    

    这将删除 zz-update-grub 脚本。系统将警告你正在删除引导加载程序。Tab单击“确定”并Enter

  2. 安装 grub-pc。它将安装 grub-common 和 grub-pc。

    sudo apt-get install grub-pc
    

    Tab单击“确定”,然后使用Spacebar仅选择 Ubuntu 驱动器,而不是分区。

    这将恢复zz-update-grub文件。如果问题出在 grub 文件上,这应该可以解决问题。

相关内容