![16.04 - 18.04 LTS 更新后的问题](https://linux22.com/image/907250/16.04%20-%2018.04%20LTS%20%E6%9B%B4%E6%96%B0%E5%90%8E%E7%9A%84%E9%97%AE%E9%A2%98.png)
提前为冗长的介绍道歉,但我认为最好尽可能多地介绍背景。我最近尝试将我的 HP Z420 工作站从 16.04 升级到 18.04 LTS。在更新过程中,Ubuntu 在显示的实例上冻结
然后我重新启动,之后我不断得到内核恐慌,如下图所示
然后我从实时 CD 启动并运行bootrepair
,显示输出信息
这解决了内核恐慌。但是,现在我只看到一个空白屏幕(与 Grub2 中的颜色相同)。
当我进入 Grub 并选择较早的内核时,Ubuntu 18.04 会加载,但我只获得命令行登录,而不是 GUI。我尝试重新运行该命令,apt-get update
但这也给出了与元数据相关的错误,请参阅
我完全不知道如何让一切重新开始运转,任何帮助都将不胜感激。
谢谢!
更新 1:根据 janmyszkier 的回答,我使用磁盘实用程序(扩展自检)检查了硬盘是否有错误,令人放心的是,没有发现任何问题。
更新2:我尝试在虚拟控制台中使用 LiveCD 和 chroot 方法尝试重新进行升级,但错误仍然存在。具体来说,Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
、could not load /boot/System.map-4.4.0-121-generic: No such file or directory
、could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
和/usr/share/initramfs-tools/hooks/plymouth failed with return 1
。见下文:
$sudo mount /dev/sda6 /mnt
$sudo mount --bind /dev /mnt/dev
$sudo mount --bind /proc /mnt/proc
$sudo mount --bind /sys /mnt/sys
$sudo chroot /mnt
$apt update
........
$apt upgrade
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be REMOVED:
linux-image-extra-4.4.0-121-generic
The following NEW packages will be installed:
bubblewrap
The following packages have been kept back:
libhmsbeagle1v5 phyml
The following packages will be upgraded:
apache2-bin bolt desktop-file-utils firefox-locale-en ghostscript
ghostscript-x gir1.2-gnomedesktop-3.0 gir1.2-javascriptcoregtk-4.0
gir1.2-packagekitglib-1.0 gir1.2-totem-1.0 gir1.2-webkit2-4.0 git git-man
gnome-desktop3-data gnome-initial-setup grub-common grub-pc grub-pc-bin
grub2-common gstreamer1.0-packagekit libapache2-mod-perl2
libgnome-desktop-3-17 libgs9 libgs9-common libgvc6-plugins-gtk
libjavascriptcoregtk-4.0-18 libldap-2.4-2 libldap-common
libpackagekit-glib2-18 libsmbclient libssh-4 libtotem0
libunity-settings-daemon1 libwbclient0 libwebkit2gtk-4.0-37
libwebkit2gtk-4.0-37-gtk2 openjdk-8-jre openjdk-8-jre-headless packagekit
packagekit-tools python-samba python3-distupgrade python3-update-manager
samba-common samba-common-bin samba-libs smbclient totem totem-common
totem-plugins ubuntu-keyring ubuntu-release-upgrader-core
ubuntu-release-upgrader-gtk unity-settings-daemon update-manager
update-manager-core update-notifier update-notifier-common
58 upgraded, 1 newly installed, 1 to remove and 2 not upgraded.
387 not fully installed or removed.
Need to get 0 B/83.9 MB of archives.
After this operation, 155 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
(Reading database ... 1326337 files and directories currently installed.)
Removing linux-image-extra-4.4.0-121-generic (4.4.0-121.145) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-121-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-121-generic
WARNING: missing /lib/modules/4.4.0-121-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-121-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-121-generic (--remove):
installed linux-image-extra-4.4.0-121-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-121-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
我建议备份您的驱动器作为安全措施。然后,您应该能够使用名为“chroot”(更改根的缩写)的方法进入当前安装的实例,该方法如下所述: https://help.ubuntu.com/community/LiveCdRecovery
一旦您 chroot 到您的原始安装,您应该能够从内部运行 apt-get update 和 apt-get upgrade 命令,修复您最初遇到的软件包问题。
但是,很有可能安装程序损坏是因为您的笔记本电脑磁盘存在 IO 问题(如果是 HDD,我见过这种情况发生多次),因此在创建备份后立即检查磁盘可能是件好事。