12

Ubuntu升级20.04后无法启动的解决办法

 3 years ago
source link: https://tlanyan.me/ubuntu-upgrade-to-20-04-problem/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

昨晚睡前使用`do-release-upgrade`命令把一台服务器上的Ubuntu 18.04 LTS系统升级到Ubuntu 20.04 LTS。今早起来发现服务异常。使用SSH命令连接,提示“ssh_exchange_identification: read: Connection reset by peer”; telnet ip 22 命令测试端口,没有出现预期的“SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1“提示,说明SSH服务也挂了。

到现场使用GUI登录,输入密码后出现“Oh no! Something has gone wrong – Please log out and try again”的错误提示,无法正常进入桌面系统。所以Ubuntu升级不仅影响网络服务,顺带把桌面系统也弄崩了。

无奈之下直接断电重启,遗憾的是未能启动成功,出现“Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)”的错误提示。从错误可以看到,内核挂载硬盘出现了问题。

RfUBFre.jpg!mobile Kernel panic – not syncing- VFS- Unable to mount root fs on unknown-block(0,0)

无法直接启动成功,那就试试恢复模式吧。开机的时候按住shift按键,直到出现GRUB菜单。接着选择“Advanced options for Ubuntu”启动选项,然后选择升级前的内核(Linux 4.15.0),这一次没再提示错误。虽然Ubuntu桌面系统仍是一片黑,但是通过ssh命令已经能进入服务器。

在服务器上执行 sudo apt update 命令,成功,没问题;接着执行 sudo apt upgrade ,提示 “E: dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a’ to correct the problem.”。这个提示说明升级过程中一些软件包损坏了,需要修复。

按照提示输入 sudo dpkg --configure -a 修复软件包数据,期间会有一些交互选项选择配置文件版本,直接回车选择默认的就可以了。大约五分钟后,修复结束。再次运行 sudo apt upgrade ,运行正常。

接着直接重启,系统顺利进入新版内核。 uname -a 有如下输出:“Linux node2 5.4.0-64-generic #72-Ubuntu SMP Fri Jan 15 10:27:54 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux”。 hostnamectl 命令输出如下:

Static hostname: node2
Icon name: computer-desktop
Chassis: desktop
Machine ID: xxx
Boot ID: xxx
Operating System: Ubuntu 20.04.1 LTS
Kernel: Linux 5.4.0-64-generic
Architecture: x86-64

说明系统已经升级到Ubuntu 20.04 LTS版本,并且运行了5.4.0内核。

参考

  1. Kernel panic – unable to mount root fs after upgrade to 20.04

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK