Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: X11 server crashes -- a partial fix

  1. #1
    Junior Member registered user
    Join Date
    Nov 2005
    Posts
    18

    X11 server crashes -- a partial fix

    I love Knoppix, I really do, but there is one and only one thing that royally pisses me off about it: the X11 server crashes from time to time (from memory leaks, code pages getting corrupted, and other miscellaneous problems), and when that happens, instead of returning to init level 2 and a nice little bash prompt, the machine usually shuts down completely. Why? Because the startx script assumes that when the X11 server exits, the user meant for this to happen, and it simply falls through and goes into the shutdown sequence.

    When the machine doesn't shut down on its own, it's because things have gotten hung. Same result, only I have to grit my teeth and rip the battery out of my laptop because the machine won't shut down no matter what else I do. The odd thing is, even though the power button doesn't work to shut the machine off, the disk-access light blips when I push it the first time, so something clearly happens.

    Data? Forget it, there was absolutely no way for me to save it in either case. Yeah, I know about the "magic sysreq" and a few other tricks, nothing works. If the server died and fell through, it all shut down too fast to stop it. If the server hung, nothing could get me to a text console.

    Well, I have come up with a way.

    In /usr/bin/startx I replace the line:
    Code:
     xinit $client $clientargs -- $server $display $serverargs
    with
    Code:
    until test -f /var/lock/reallyshutdown ; do
        xinit $client $clientargs -- $server $display $serverargs
        bash
    done
    And in /etc/acpi/powerbtn.sh I add some scripting. Instead of:
    Code:
     /sbin/shutdown -h now "Power button pressed"
    I now have:
    Code:
    mount /mnt/sda1
    mkdir /mnt/sda1/emergency-backup/
    cp -r /home/knoppix/.mozilla /mnt/sda1/emergency-backup/
    sync
    cp -r /home/knoppix/Desktop /mnt/sda1/emergency-backup/
    sync
    umount /mnt/sda1
    This saves the data that I want -- the stuff in my /home/knoppix/Desktop directory, and whatever browsing I've been doing -- off to the hard drive on my laptop. It's not a part of the disk I normally want to use (it's actually the Windows recovery partition for the drive, hah), but it works, and it's pretty much useless to me otherwise.

    This got a live-fire test tonight when for no apparent reason, the X11 server suddenly croaked, probably due to a memory leak. The change to startx meant that the machine wouldn't exit out completely, but the machine was hung in graphics mode and so the X11 server wasn't restarting. I hoped like hell that I had run my script to modify the startx and powerbtn.sh scripts, and I pushed the power button. The disk light went on for a lot longer than usual. When I restarted the machine, all my data was saved.

    If you use these changes, you'll obviously need to tailor them to however your machine is set up and what directories you save data in during a Knoppix session. Also, of course, it may or may not work depending on whether your power button has any effect after a crash. (A "real" power button will obviously just shut the machine off, but if you have a "soft" power button, which merely suggests to the OS that someone wants it to power down, as is the case on most modern machines, it might work.)

  2. #2
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by FlameWeasel View Post
    I love Knoppix, I really do, but there is one and only one thing that royally pisses me off about it: the X11 server crashes from time to time (from memory leaks, code pages getting corrupted, and other miscellaneous problems), and when that happens, instead of returning to init level 2 and a nice little bash prompt, the machine usually shuts down completely. Why? Because the startx script assumes that when the X11 server exits, the user meant for this to happen, and it simply falls through and goes into the shutdown sequence.
    I am not sure your version is the same as mine. I too find it irritating and more so at one point in time, I liked to experiment with newer X drivers and libraries.

    Eventually what happened was that I modified /etc/init.d/knoppix-startx, towards the end, I commented all the lines after the comment 'Shutdown/Reboot after X-session'. That put a stop to this rather knoppix-ish behaviour.

  3. #3
    Moderator Moderator
    Join Date
    Jan 2010
    Location
    Asheville, NC, USA
    Posts
    528
    Thanks for sharing all this good stuff! On another front, do you (or anyone monitoring this thread) have any idea why the supposedly "magical" key-combo ctrl-alt-F1 (and its siblings) are not available on most machines? I can get to the text console windows by issuing sudo chvt 1 from a terminal emulator, so I know they're out there, but sometimes I just really miss that keyboard shortcut. The combo ctrl-alt-F5 does work to get me back to the graphical environment, but then the capability is gone again. I checked the state of the kernel parameter with
    Code:
    cat /proc/sys/kernel/sysrq
    and it is 1 (on), so that other combo you mentioned as "magical" should be enabled.

    Cheers!
    Krishna

  4. #4
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    @Krishna

    I was reading up on Virtual Box and ran across this material
    concerning some magic key combos that are disallowed in
    some virtualization situations.

    I thought this might suggest one reason some combos are
    not available on some of the later distros.
    I miss control-alt-backspace and control-alt-dele when they
    aren't available.

    See for example,

    http://www.virtualbox.org/manual/ch01.html#idp7681328

    Cheers

  5. #5
    Moderator Moderator
    Join Date
    Jan 2010
    Location
    Asheville, NC, USA
    Posts
    528
    Hmmm - I get it, but I was hoping for something like a kernel parameter to change. Maybe someone else has a suggestion?

    Cheers!
    Krishna

  6. #6
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by krishna.murphy View Post
    Hmmm - I get it, but I was hoping for something like a kernel parameter to change. Maybe someone else has a suggestion?
    My guess is this is probably related to X11 display driver. Maybe you can check if all the "problematic" machines are using the same X11 display drivers. Or you could try using different display drivers to see if they make any difference to this behaviour.

  7. #7
    Senior Member
    Join Date
    Jan 2011
    Posts
    242
    Quote Originally Posted by krishna.murphy View Post
    sudo chvt 1
    Oh. That's what that's for. For me ctrl+alt+F1 works and has always worked. I use it lots under Debian and it's fine too under Knoppix.

    I've tried Knoppux with three laptops this evening:

    X-org intel driver: OK
    X-org sis driver: OK
    X-org vesa driver: OK

    This last is a really old laptop with a SiS chipset but when I boot without xmodule=vesa it starts the LXDE desktop, the bottom panel appears and then disappears and X exits. Guess this isn't a memory leak because Knoppix just restarts the X server again, over and over again, in exactly the way it didn't for FlameWeasel. Odd thing is, even with X restarting and restarting I can still use ctrl+alt+F1.

    I could suggest a few things to try that might shed some light on the problem but since condescension is out I'll have to take a wild guess ....

    You have a hard drive installation. You have a persistent store. When you installed Knoppix 6.4.4. you kept your old persistent store that you've been using for years. Thus you've carried forward the same xorg.conf file from release to release. It has got some retro stuff in there that it should not.

    Try moving your xorg.conf to one side and copying over the original from the 6.4.4 distribution. Reboot and see if that makes a difference.

  8. #8
    Senior Member
    Join Date
    Jan 2011
    Posts
    242
    Quote Originally Posted by utu View Post
    I thought this might suggest one reason some combos are
    not available on some of the later distros.
    I miss control-alt-backspace and control-alt-dele when they
    aren't available.
    Ah, I know what ctrl-alt-bksp does not work on some of the later distros ...

    ... it is no longer the default ... you have to tell X you want this functionality.

    Apparently, the story goes, Ubuntu users are so crass they keep typing ctrl-alt-bksp by mistake. (How ? The whole point of it being ctrl-alt-bksp is you can't press three keys like that by mistake). Ubuntu users complained that this was not 'user-friendly' so MS (no not the MS as in Bill Gates, MS as in Ubuntu) persuaded the Xorg foundation to change the Xserver so the ctrl-alt-bksp does nothing by default.

    KK rightly restored the old behaviour (he's so sentimental its untrue).

    You can do so too when taking other distros out for a spin. Edit the file /etc/default/keyboard and make sure the line that starts XKBOPTIONS includes the option terminate:ctrl_alt_bksp.

    Now its your turn: find out how to restore the old behaviour of ctrl+alt+del.

    Did you know you can now even get X to give you "shift with numeric keypad keys works as in MS Windows" ? There soon won't be any point in using Linux as it will be just a Windows clone. Damn Ubuntu.

  9. #9
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423

    control-alt-delete

    This is inside my /etc/X11/xinit/xinitrc :-

    Code:
    setxkbmap -option terminate:ctrl_alt_bksp -option compose:ralt
    xmodmap -e "keycode 22 = BackSpace BackSpace BackSpace BackSpace"
    By having these the ctrl-alt-del is disabled.

    And to reenable ctrl-alt-del, I just do this :-

    Code:
    # xmodmap -e "keycode 22 = BackSpace Terminate_Server BackSpace Terminate_Server"
    In fact I wrote a little script which allows me to do it from the LXDE perference menu.

  10. #10
    Moderator Moderator
    Join Date
    Jan 2010
    Location
    Asheville, NC, USA
    Posts
    528
    Quote Originally Posted by Forester View Post
    Oh. That's what that's for. For me ctrl+alt+F1 works and has always worked. I use it lots under Debian and it's fine too under Knoppix.
    Hmm - It hasn't worked for me since version 5. On multiple machines, also. With various keyboards, displays, etc.
    You have a hard drive installation. You have a persistent store. When you installed Knoppix 6.4.4. you kept your old persistent store that you've been using for years. Thus you've carried forward the same xorg.conf file from release to release. It has got some retro stuff in there that it should not.

    Try moving your xorg.conf to one side and copying over the original from the 6.4.4 distribution. Reboot and see if that makes a difference.
    I guess it's worth a try, but I'm still using the version I started with when I found that 5.0 wasn't the latest, i.e. 6.2.0. I did move it from my laptop to this machine...

    Cheers!
    Krishna

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •