LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-14-2010, 09:35 AM   #1
kopatops
Member
 
Registered: Mar 2010
Distribution: Arch Linux
Posts: 45
Blog Entries: 1

Rep: Reputation: 16
Question Clean way to shut down X server (and gnome-session)


Hi!

I like to end my X session in Arch on a regular basis.

I always use
'killall xinit'

This gives a lot of WARNING's and ERROR's. Among the messages are some lines about syntax errors in my config files, I think. But mostly it's about a "Fatal IO error" and gnome-settings-daemon not knowing what session it is in.

Is there a gentler way to put X down? Or is this how it should be?

I tried killing some of the processes that claim to be interrupted, before killing X, to no avail.

Regards
 
Old 04-14-2010, 09:39 AM   #2
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
try gnome-session-save in a terminal? :< Not sure if this will work but hopefully it should exit cleanly or give you a shutting down window.

However if your running gnome, dont you have a button or menu for logging out?
 
Old 04-14-2010, 09:44 AM   #3
kopatops
Member
 
Registered: Mar 2010
Distribution: Arch Linux
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 16
Thanks for the quick reply

I don't have any gnome-session-save, (doesn't seem to be included in the base package) but I do have a logout button. It gives the same result as "killall xinit".

Was just about to edit my post; X does shut down, and I haven't noticed any problems. It's more a question about minimizing warnings and errors, and knowing why they appear.

Whoops. EDIT: I do have gnome-session-save. Sry!
It's not any smoother though
tnx

Last edited by kopatops; 04-14-2010 at 09:49 AM. Reason: whoops
 
Old 04-14-2010, 10:12 AM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Doesn't Ctrl-Alt-Backspace kill the X-server for you? If not, add this stanza to your xorg.conf file:
Code:
Section "ServerFlags"
        Option      "DontZap" "off"
        Option      "DontVTSwitch" "off"
        Option      "HandleSpecialKeys" "Always"
EndSection
and that should work. See man xorg.conf for details.
 
Old 04-14-2010, 10:27 AM   #5
harryhaller
Member
 
Registered: Sep 2004
Distribution: Slackware-14.0
Posts: 452

Rep: Reputation: Disabled
An orderly shutdown will depend upon the programmes that are running in the session, not upon X nor Gnome.

GNU's Screen programmes accepts a message to shutdown. Programmes such as hellanzb recognise the terminate signal and close down in an orderly manner. Terminals expect C-d or the exit command - I don't think these can be passed remotely.

In my setup, running under Ratpoison, I have three Screen sessions running so I have a shutdown script for closing Ratpoison and X which first of all closes the Screen sessions and then issues the quit command to Ratpoison.

Thus for an orderly shutdown, you would need to know which programmes are running - maybe you could parse the output from ps? - and these programs must have been written so as to react to a terminate signal or a remote command by terminating properly.

Otherwise there will always be some programmes crashing and causing error messages.

Last edited by harryhaller; 04-14-2010 at 10:29 AM.
 
Old 04-14-2010, 10:33 AM   #6
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
I get error messages too - I'd like to clean up mine and now I understand your trouble. Mine vary from errors from xscreensaver complaining (but then being pleased I'm not running as root) as well an error which appears on both my systems about a problem reading/writing to ./.Xauthority. One day I'll likely post about these and see if I can sort them but so far even after around 6months of those random errors when sutting down I've not had anything "bad" happen to my system;
 
Old 04-14-2010, 10:41 AM   #7
harryhaller
Member
 
Registered: Sep 2004
Distribution: Slackware-14.0
Posts: 452

Rep: Reputation: Disabled
Quote:
Originally Posted by djsmiley2k View Post
Mine vary from errors from xscreensaver complaining (but then being pleased I'm not running as root) as well an error which appears on both my systems about a problem reading/writing to ./.Xauthority.;
Those don't sound like normal error messages. You should be able to fix those once you've discovered the cause.

I would like firefox to recognise that X is shutting down and close down properly so that one didn't get the restart screen. X should send signals, just as the system does when it performs system shutdown and all programmes should recognise these signals and react according.

Ah, well. That's a perfect world scenario.
 
Old 04-15-2010, 06:48 AM   #8
kopatops
Member
 
Registered: Mar 2010
Distribution: Arch Linux
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 16
These are the running processes, typically: [ps -e]

Code:
  PID TTY          TIME CMD
    1 ?        00:00:00 init
    2 ?        00:00:00 kthreadd
    3 ?        00:00:00 migration/0
    4 ?        00:00:00 ksoftirqd/0
    5 ?        00:00:00 watchdog/0
    6 ?        00:00:00 migration/1
    7 ?        00:00:00 ksoftirqd/1
    8 ?        00:00:00 watchdog/1
    9 ?        00:00:00 events/0
   10 ?        00:00:00 events/1
   11 ?        00:00:00 cpuset
   12 ?        00:00:00 khelper
   13 ?        00:00:00 netns
   14 ?        00:00:00 async/mgr
   15 ?        00:00:00 pm
   16 ?        00:00:00 sync_supers
   17 ?        00:00:00 bdi-default
   18 ?        00:00:00 kblockd/0
   19 ?        00:00:00 kblockd/1
   20 ?        00:00:18 kacpid
   21 ?        00:00:00 kacpi_notify
   22 ?        00:00:00 kacpi_hotplug
   23 ?        00:00:00 kseriod
   26 ?        00:00:00 khungtaskd
   27 ?        00:00:00 kswapd0
   28 ?        00:00:00 ksmd
   29 ?        00:00:00 aio/0
   30 ?        00:00:00 aio/1
   31 ?        00:00:00 crypto/0
   32 ?        00:00:00 crypto/1
  533 ?        00:00:00 ata/0
  598 ?        00:00:00 ata/1
  676 ?        00:00:00 ata_aux
  711 ?        00:00:00 scsi_eh_0
  731 ?        00:00:00 scsi_eh_1
  821 ?        00:00:00 scsi_eh_2
  822 ?        00:00:00 scsi_eh_3
  851 ?        00:00:00 kjournald
  878 ?        00:00:00 udevd
 1492 ?        00:00:00 ksuspend_usbd
 1516 ?        00:00:00 khubd
 1581 ?        00:00:00 kpsmoused
 2457 ?        00:00:00 tifm
 2469 ?        00:00:00 kmmcd
 2571 ?        00:00:00 usbhid_resumer
 2657 ?        00:00:01 hd-audio0
 2721 ?        00:00:00 pccardd
 3007 ?        00:00:00 bluetooth
 3753 ?        00:00:00 mount.ntfs-3g
 3867 ?        00:00:00 syslog-ng
 3868 ?        00:00:00 syslog-ng
 3885 ?        00:00:00 crond
 3900 ?        00:00:00 dbus-daemon
 3909 ?        00:00:00 acpid
 3912 ?        00:00:01 hald
 3913 ?        00:00:00 hald-runner
 3936 ?        00:00:00 hald-addon-inpu
 3938 ?        00:00:00 hald-addon-rfki
 3946 ?        00:00:00 hald-addon-acpi
 3973 ?        00:00:00 bluetoothd
 3980 ?        00:00:00 ntpd
 4008 ?        00:00:00 krfcommd
 4011 tty1     00:00:00 login
 4012 tty2     00:00:00 agetty
 4013 tty3     00:00:00 agetty
 4014 tty4     00:00:00 agetty
 4015 tty5     00:00:00 agetty
 4016 tty6     00:00:00 agetty
 4031 tty1     00:00:00 bash
 4043 tty1     00:00:00 xinit
 4044 tty7     00:09:14 X
 4079 tty1     00:00:00 gnome-session
 4088 tty1     00:00:00 dbus-launch
 4089 ?        00:00:00 dbus-daemon
 4092 ?        00:00:01 upowerd
 4096 ?        00:00:03 gconfd-2
 4112 ?        00:00:03 gnome-settings-
 4116 tty1     00:00:00 gnome-keyring-d
 4120 ?        00:00:00 gvfsd
 4128 ?        00:00:00 gvfs-fuse-daemo
 4135 ?        00:00:00 gvfs-gdu-volume
 4137 ?        00:00:00 udisks-daemon
 4138 ?        00:00:00 udisks-daemon
 4142 ?        00:00:00 gvfs-gphoto2-vo
 4143 ?        00:00:03 gtk-window-deco
 4156 ?        00:00:00 ntpd
 4181 tty1     00:00:00 gnome-panel
 4182 tty1     00:00:05 nautilus
 4184 ?        00:00:00 bonobo-activati
 4189 tty1     00:00:00 gdu-notificatio
 4196 ?        00:00:00 wnck-applet
 4200 ?        00:00:00 notification-ar
 4201 ?        00:00:00 clock-applet
 4209 ?        00:00:00 gvfsd-trash
 4210 ?        00:00:00 console-kit-dae
 4275 ?        00:00:02 gnome-screensav
 4280 ?        00:00:00 polkitd
 4287 ?        00:00:00 gvfsd-metadata
 5403 ?        00:00:00 wpa_supplicant
 5430 ?        00:00:00 dhcpcd
 5716 ?        00:00:00 flush-8:0
 5749 ?        00:00:04 firefox
 5777 ?        00:00:00 gnome-terminal
 5778 ?        00:00:00 gnome-pty-helpe
 5780 pts/1    00:00:00 bash
 5790 ?        00:00:00 metacity
 5800 pts/1    00:00:00 ps
This is the portion of the error messages I can see in console after killall xinit (not exact):

Code:
gnome-settings-daemon error
gnome-settings-daemon error
gnome-settings-daemon error
gnome-settings-daemon error
...
waiting for x to shut down gnome-settings-daemon (resource unavailable) X :0.0. 

gnome-terminal fatal IO 104 
gnome-session fatal IO 
gnome-screensaver fatal IO
...
could not parse args 
cannot open display 
...
xinit unexpected signal 15
$
The gnome-terminal error I can remove in an x-killer script that takes care of all gnome-terminal's first.

Can I pipe all the console output to a file? Tried
xinit > ~/out

which didn't work.

Last edited by kopatops; 04-15-2010 at 06:51 AM. Reason: add command
 
Old 04-15-2010, 08:51 AM   #9
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Question

Quote:
Originally Posted by kopatops View Post
Can I pipe all the console output to a file? Tried
xinit > ~/out

which didn't work.
Did you do
Code:
killall xinit > ~/out
otherwise it would of just shown you the errors xinit got while it was running, rather the the errors that were caused while it was being killed (by the killall process) - I maybe completely wrong with this but this is how I understand it to work.

I'm now wanting to go home and start investigating my xscreensaver messages ! (*I'm not even sure I get those anymore as I stopped using xscreensaver but I should check anyway*).



Oh and to me, those errors are from parts of gnome that are now complaining, as they can't find a screen to "connect" to - This is normal, you've just killed it. To stop it happening you'd need to stop each one of those services before X itself dies;

Last edited by djsmiley2k; 04-15-2010 at 08:55 AM.
 
Old 04-15-2010, 09:07 AM   #10
kopatops
Member
 
Registered: Mar 2010
Distribution: Arch Linux
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 16
I tried both

killall xinit > ~/out
and
xinit > ~/out # (at startup)

I got nothing.Who writes the messages?? Assume it's the X server?
 
Old 04-15-2010, 06:59 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,428

Rep: Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999
Shouldn't it be telinit 3?
http://publib.boulder.ibm.com/infoce...s5/telinit.htm
 
Old 04-15-2010, 07:11 PM   #12
bmn
LQ Newbie
 
Registered: May 2009
Posts: 16

Rep: Reputation: 0
Quote:
Originally Posted by kopatops View Post
I tried both

killall xinit > ~/out
and
xinit > ~/out # (at startup)

I got nothing.Who writes the messages?? Assume it's the X server?
Don't you want to redirect STDERR and not STDOUT? Shouldn't it be

Code:
killall xinit 2> ~/out
?
 
Old 04-20-2010, 11:31 PM   #13
kopatops
Member
 
Registered: Mar 2010
Distribution: Arch Linux
Posts: 45

Original Poster
Blog Entries: 1

Rep: Reputation: 16
Quote:
Don't you want to redirect STDERR and not STDOUT? Shouldn't it be

Code:
killall xinit 2> ~/out
?
Tried that, doesn't work.Thanks thou

I searched the filesystem for log files containing the phrases I remember, found nada.

Last edited by kopatops; 04-20-2010 at 11:33 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gnome session on SuSE 10.3 results in ICEwm, not Gnome Desktop shachter Linux - Desktop 0 01-30-2009 12:45 AM
not to save session after restart/shut down laucian SUSE / openSUSE 2 04-17-2008 09:59 AM
VNC Server no gnome session daniel_owen_uk Linux - Newbie 2 03-13-2008 10:42 AM
Gnome panel keeps crashing when starting gnome-session elluva Linux - Software 3 01-24-2006 05:26 PM
Changing environment variable for gnome session from gnome-terminal pymehta Linux - Software 1 10-11-2005 06:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration