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"in中的行/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(出現問題的系統和我將其進行比較的系統)。

為什麼會發生這種情況?

答案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 不完整

相關內容