我有 Xubuntu 18.04.3,每当我尝试通过它安装包时,apt-get
我都会收到以下消息。
Removing linux-image-5.0.0-31-generic (5.0.0-31.33~18.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.0.0-31-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: FROM:: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.0.0-31-generic (--remove):
installed linux-image-5.0.0-31-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-5.0.0-31-generic
libdvd-pkg: Package libdvdcss2-1.4.2-1 was removed, stop processing...
E: Sub-process /usr/bin/dpkg returned an error code (1)
内容/etc/default/grub
:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="persistent"
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
FROM:
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
TO:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"
答案1
每当内核或内核模块更新时,DPKG来源GRUB。看来你正在关注如何在 Ubuntu 18.04 Bionic Beaver Linux 上禁用 IPv6 地址由于您修改了位于的 GRUB 文件/etc/默认。最初,您应该编辑该文件中的相应行,但您最终却附加了这些行。由于附加了这些行FROM:
,TO:
因此也在此处写入了 ,这当然不是 GRUB 的有效条目。
要修复此问题,您需要删除这些行。使用提升权限的文本编辑器编辑该文件
sudo nano /etc/default/grub
并删除最后 6 行,即从第 35 行到第 40 行。
如果您想按照该文章所述进行操作,请相应地编辑第 10 行和第 11 行。
答案2
选项1:重新配置包缓存
数据库在安装包时肯定已损坏。重新配置缓存
sudo dpkg --configure -a
选项 2:纠正损坏的依赖关系
尝试纠正存在破坏依赖关系的系统。
sudo apt install -f
选项 3:删除有问题的软件包的 post 信息文件
sudo mv /var/lib/dpkg/info/* /tmp