问题是这样的,在使用命令升级系统到Ubuntu 20.04后,开机后直接出现了下面的log。
: unable to launch "/usr/libexec/run-systemd-session unity-session.target" X
session --- "/usr/libexec/run-systemd-session unity-session.target" not found;
falling back to default session.
这一看就是桌面挂掉了。这里我点okay后,反正就是进不去了。于是 Ctrl + Alt + F1 进入 tty。进入之后先做apt update,这里正常。然后做apt upgrade,这里就会报错,应该是依赖项出现了问题。
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution)
它建议我做apt --fix-broken install,但是这仍然会报错。如下:
rm: cannot remove ‘/etc/apparmor.d/cache/bf9d6da9.0’ : Is a directory
dpkg: error processing archive /var/cache/apt/archives/apparmor-2.13.3-7ubuntu52_amd64.deb (--unpack):
new apparmor package pre-installation script subprocess returned error exit status 1Errors were encountered while processing:
/var/cache/apt/archives/apparmor_2.13.3-7ubuntu5.2_amd64.debE: Sub-process /usr/bin/dpkg returned an error code (1)
于是我Google了一下,找到了一个解决方案:
删除AppArmor cache:
sudo rm -rf /etc/apparmor.d/cache/
然后再做apt --fix-broken install就可以了。