-
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
Lot 10x SanDisk Cruzer ULTRA USB 3.0 16GB USB flash thumb drive SDCZ48-016G 16
$34.99
SanDisk 128GB Ultra Flair USB 3.0 Flash Drive - SDCZ73-128G-G46
$12.99
SanDisk 512GB Ultra Drive Dual Go USB Type-C Flash Drive Green SDDDC3-512G-G46G
$49.99
SanDisk 256GB Ultra Dual Drive USB Type-C, USB 3.1 Flash Drive - SDDDC2-256G-G46
$21.99
New TESLA OEM Model S,3,X,Y USB Flash Drive for Dashcam & Sentry Mode 128GB
$18.99
Mechanical Style Flash Drive USB 3.0 High Speed 16TB Large Capacity Waterproof
$8.39
Sandisk 16GB 32GB 64GB 128GB Cruzer Blade Flash Drive Memory Stick USB Lot Pack
$4.99
64GB USB 3.0 Flash Drive USB Memory Stick High Speed Retractable USB Thumb Drive
$6.99
USB Flash Drive Memory Stick Pendrive Thumb Drive 4GB, 8GB, 32GB, 64GB 128GB LOT
$249.37
SanDisk Cruzer Glide USB 3.0 16GB 32GB 64GB 128GB 256GB Flash Drive Memory Lot
$276.48