-
Junior Member
registered user
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.)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Vintage Apple IIGS Computer A2S6000 (PARTS) #99
$149.99
Vintage Rare Apple 20th Anniversary Macintosh Computer (TAM) FATBack Cover
$390.00
Apple IIe w/Vintage Apple Carry Bag Tested and Working
$599.99
Vintage Apple Power Macintosh 6100/66 Computer M1596 Powers On AS-IS
$129.99
Drakware ADB2USB - vintage Apple ADB to USB keyboard adapter
$29.95
Vintage Apple ll PCB Replica some chips or parts missing
$39.95
Vintage Apple Rainbow Logo Blue Messenger Laptop Bag Travel Office Expandable
$28.39
Vintage Apple Newton eMate 300 H0208 Laptop Computer 1997 Works
$199.95
Vintage Apple M2980 AppleDesign Keyboard
$28.99
Vintage Apple IIc A2S4100 Computer with Power Supply Turns on
$210.87