Debian

如何在 X-server 關閉之前關閉所有應用程序?

  • June 16, 2014

我正在使用 debian 測試作業系統和 openbox WM。此外,我通過該文件啟動 X-server,該.xinitrc文件具有以下內容:

xrdb /home/morfik/.Xresources
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session

我在重新啟動系統時注意到一堆錯誤。他們都登錄到文件.xsession-errors.old中。我添加了

if [[ $(tty) = /dev/tty4 ]]; then
   mv ~/.xsession-errors ~/.xsession-errors.old
   exec startx &> ~/.xsession-errors
fi

這就是為什麼我有.xsession-errors.xsession-errors.old文件並且可以閱讀他們的內容。例如,文件的基本部分如下所示:

xinit: connection to X server lost

waiting for X server to shut down urxvt: X connection to ':0' broken, unable to recover, exiting.
XIO:  fatal IO error 4 (Interrupted system call) on X server ":0"
     after 5353 requests (5353 known processed) with 0 events remaining.
real transparency on... depth: 32
xRandr: Found crtc's: 2
xRandr: Linking output DVI-I-2 with crtc 0
NO XSETTINGS manager, tint2 use config 'launcher_icon_theme'.
XIO:  fatal IO error 4 (Interrupted system call) on X server ":0"
     after 13565 requests (13565 known processed) with 0 events remaining.
real transparency on... depth: 32
xRandr: Found crtc's: 2
xRandr: Linking output DVI-I-2 with crtc 0

(kglobalaccel:1707): GConf-WARNING **: Got Disconnected from DBus.

firefox: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
kdeinit4: Fatal IO error: client killed
kglobalaccel: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
xscreensaver: 11:27:38: SIGHUP received: restarting...
xscreensaver: 11:27:38: running as morfik/morfik (1000/1000)

klauncher: Exiting on signal 15
kdeinit4: Fatal IO error: client killed
kdeinit4: kded4 [kdeinit]: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.
.Terminated
.claws-mail: Fatal IO error 2 (No such file or directory) on X server :0.
xscreensaver: 11:27:41: Can't open display: :0
xscreensaver: 11:27:41: running as morfik/morfik (1000/1000)

xscreensaver: 11:27:41: Errors at startup are usually authorization problems.
             But you're not logging in as root (good!) so something
             else must be wrong.  Did you read the manual and the FAQ?

             http://www.jwz.org/xscreensaver/faq.html
             http://www.jwz.org/xscreensaver/man.html

.(EE) Server terminated successfully (0). Closing log file.
(EE) 
(EE) Backtrace:
(EE) 0: /usr/bin/X (xorg_backtrace+0x48) [0x7fc1bbd38c58]
(EE) 1: /usr/bin/X (0x7fc1bbb91000+0x1ab949) [0x7fc1bbd3c949]
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fc1ba913000+0xf210) [0x7fc1ba922210]
(EE) 3: /lib/x86_64-linux-gnu/libc.so.6 (malloc_usable_size+0x26) [0x7fc1b93d1d36]
(EE) 4: /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x7fc1bab2f000+0xab6f3) [0x7fc1babda6f3]
(EE) 
(EE) Segmentation fault at address 0x0
(EE) 
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
    at http://wiki.x.org
for help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)

每次我openbox --exit在終端中輸入時都會收到這種消息。我發現了一些關於這個主題的類似主題,人們說錯誤是由於發送到 X-server 的 SIGTERM 信號而出現的,並且所有其他應用程序都無法再連接到它,所以它們崩潰了。

如何解決這個問題?如何在 X-server 終止之前關閉所有 GUI 應用程序?

更新#1

我嘗試了aecolley的解決方案,但不幸的是我什至無法啟動圖形環境——它只是掛起,/var/log/Xorg.0.log.xsession-errors文件中沒有錯誤。我可以通過 重新啟動 X-server ctrl+alt+del,但我只是黑屏,僅此而已。

該解決方案的另一件事是它安裝了許多依賴項。為了擁有openbox-gnome-session,我必須安裝軟體包:openbox-gnome-session, gnome-settings-daemon, packagekit, libpam-systemd. 他們安裝了這些東西:

# aptitude install openbox-gnome-session gnome-settings-daemon packagekit libpam-systemd
The following NEW packages will be installed:
 gdebi-core{a} gnome-desktop3-data{a} gnome-session-bin{a} gnome-settings-daemon libelfg0{a} libglib2.0-bin{a} libglib2.0-data{a}
 libgnome-desktop-3-7{a} libibus-1.0-5{a} libimobiledevice4{a} libjson-glib-1.0-0{a} libjson-glib-1.0-common{a} libpackagekit-glib2-16{a}
 libpam-systemd libplist1{a} libupower-glib1{a} libusbmuxd2{a} libwacom-common{a} libwacom2{a} nautilus-data{a} openbox-gnome-session
 packagekit packagekit-backend-aptcc{a} python3-dbus{a} python3-packagekit{a} systemd{a} upower{a} usbmuxd{a}
The following packages are RECOMMENDED but will NOT be installed:
 nautilus packagekit-tools
0 packages upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/12.7 MB of archives. After unpacking 52.6 MB will be used.
Do you want to continue? [Y/n/?]

我安裝了它並添加了:

exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-gnome-session

或者

exec openbox-gnome-session

到 .xinitrc 文件。

即使解決方案有效,我也不會對我的系統這樣做。:) 必須有另一種方法來解決這個問題。

我想我終於找到了這個問題的原因。看起來 nvidia 驅動程序和 xorg 存在問題。我試圖只從main儲存庫安裝一個新系統,並檢查了它是否Segmentation fault會出現在日誌文件中——它沒有。所以,我安裝了nvidia驅動程序,問題又回來了。

我認為其他應用程序的大多數錯誤都與此分段錯誤有關,這就是為什麼某些應用程序在 xserver 崩潰時不能簡單地保存設置/數據的原因。

我不確定這是否涉及所有版本的 nvidia 驅動程序,但我確信這是nvidia-legacy-304xx-driver. 這很糟糕,因為我必須使用 nvidia 驅動程序,而且我不知道如何解決這個問題。也許wayland會解決這個問題,所以我想我只能等待……

引用自:https://unix.stackexchange.com/questions/117421