15.10:启动到控制台时“startx $(which unity)”失败

15.10:启动到控制台时“startx $(which unity)”失败

我跟着这个答案并在我的 15.10 Unity Desktop 上运行以下命令以启动到文本模式:

sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target

虽然第一个命令给出了以下输出,但我还是继续:

The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

我也修改了GRUB_CMDLINE_LINUX_DEFAULT="text"中的行并随后/etc/default/grub运行。sudo update-grub


然后系统成功启动到文本模式,我可以使用 TTY1 登录掩码。但之后,我想使用 启动桌面startx $(which unity),但失败了,并显示以下错误消息(顺便说一下,红色背景上是白色文本):

X.Org X Server 1.17.2
Release Date: 2015-06-16
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.13.0-68-generic x86_64 Ubuntu
Current Operating System: Linux ecs-harigel-webserver 4.2.0-27-generic #32-Ubuntu SMP Fri Jan 22 04:49:08 UTC 2016 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.2.0-27-generic root=UUID=17983985-9c67-4e5b-a6fd-0c501c5abc41 ro text
Build Date: 12 November 2015  05:33:29PM
xorg-server 2:1.17.2-1ubuntu9.1 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.32.6
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Feb  3 10:28:57 2016
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
>                   Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server
Traceback (most recent call last):
  File "/usr/bin/unity", line 21, in <module>
    import glib
ImportError: No module named glib
xinit: connection to X server lost

waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.

这些命令startx /usr/bin/gnome-session --session=ubuntu和平原startx将我带到一个破碎的桌面,只有墙纸和一个 X 形光标,它只在从左上角向下到右的对角线上移动。

如果有帮助的话,这里是输出env

XDG_VTNR=1
LC_PAPER=de_DE.UTF-8
XDG_SESSION_ID=c1
LC_ADDRESS=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
SHELL=/bin/bash
TERM=linux
HUSHLOGIN=FALSE
LC_NUMERIC=de_DE.UTF-8
USER=bytecommander
LC_TELEPHONE=de_DE.UTF-8
MAIL=/var/mail/bytecommander
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
QT_QPA_PLATFORMTHEME=appmenu-qt5
LC_IDENTIFICATION=de_DE.UTF-8
PWD=/home/bytecommander
LANG=en_US.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
SHLVL=1
XDG_SEAT=seat0
HOME=/home/bytecommander
LOGNAME=bytecommander
XDG_RUNTIME_DIR=/run/user/1000
LC_TIME=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
_=/usr/bin/env

which python报告/usr/bin/python,其版本为 2.7.10。

查看 python 的sys.path值,启动到文本模式和启动到桌面时是一样的,但与另一个 15.10 安装相比,/usr/lib/python2.7/dist-packages/gtk-2.0这里缺少该值。glib启动到文本模式和桌面模式时我都无法导入 python。在另一台 15.10 机器上,这可以正常工作。

该软件包在两个系统上python-dbus均有安装1.2.0-2build3(出现问题的系统和我与之比较的系统)。

为什么会发生这种情况?我该如何修复它,以便能够在启动到文本模式时启动 GUI?

答案1

好像python-gtk2缺少软件包。我安装了它:

sudo apt-get install python-gtk2

这解释了 Python 中sys.path(/usr/lib/python2.7/dist-packages/gtk-2.0缺失) 的差异。但在另一台存在该条目的机器上,根据aptitude why,该包仅作为 的依赖项安装compizconfig-settings-manager,这显然是一个可选包。我认为应该将此包转换为 Unity 的依赖项!

但我得到的 Unity Desktop 仍然无法使用。它的屏幕分辨率为 800x600,所有指示器都缺失,面板完全是空的。而且我无法更改设置(例如显示分辨率),这导致出现如下错误:

屏幕截图:无法应用配置

我就此提出一个新问题:
使用“startx $(which unity)”手动启动时 Unity Desktop 不完整

相关内容