Ubuntu 18.04 gnome-session 安装后脚本损坏

Ubuntu 18.04 gnome-session 安装后脚本损坏

在 Ubuntu 18.04 的最小安装上,我尝试通过运行以下命令切换到原始 gnome 桌面: sudo apt-get install vanilla-gnome-desktop

此安装失败,原因是这个错误。此问题导致所有 apt-get install 和 apt-get upgrade 失败。

我尝试使用以下命令删除损坏的软件包,但无济于事:

hugh@xps:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up gnome-session (3.28.1-0ubuntu3) ...
update-alternatives: error: cannot stat file '/etc/alternatives/gdm3.css': Invalid argument
dpkg: error processing package gnome-session (--configure):
 installed gnome-session package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 gnome-session
E: Sub-process /usr/bin/dpkg returned an error code (1)

和:

hugh@xps:~$ sudo dpkg --remove --force-remove-reinstreq gnome-session
(Reading database ... 166375 files and directories currently installed.)
Removing gnome-session (3.28.1-0ubuntu3) ...
update-alternatives: error: cannot stat file '/etc/alternatives/gdm3.css': Invalid argument
dpkg: error processing package gnome-session (--remove):
 installed gnome-session package pre-removal script subprocess returned error exit status 2
Errors were encountered while processing:
 gnome-session

hugh@xps:~$ sudo apt-get install --reinstall gnome-session
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 0 not to upgrade.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for gnome-session:amd64

答案1

通常/etc/alternatives/gdm3.css指着/usr/share/gnome-shell/主题/ubuntu.css. 后者文件位于gnome-shell-common包裹
你可以使用以下命令重新安装它:

sudo apt-get install gnome-shell-common --reinstall

如果不起作用,你可以尝试通过手动重新创建链接来解决问题

sudo ln -s  /usr/share/gnome-shell/theme/ubuntu.css /etc/alternatives/gdm3.css

然后运行

sudo apt-get install -f

相关内容