Human Readable   

 

     
   
     

Sysctl and SysRq—Day 47

© Copyright Darrell Anderson.

After I had successfully installed a firewall script, I then decided I wanted to clean my act. I had done some reading about sysctl and Iknew that I had some sysctl commands in my rc.local script. I also had some commands in my firewall script. Time to clean house and organize.

I downloaded a sample sysctl.conf file and then using that sample, migrated my firewall and rc.local sysctl commands to my new file. Then I verified that sysctl was set to run automatically in my Slackware boot scripts. This was already done in the rc.S script. I added a screen echo message so I would know when those commands were being executed. Then I deleted the related commands from my rc.firewall and rc.local. Everything worked well. I logged on to the web and tested my firewall protection. All looked good!

However, while I was studying the sample sysctl.conf file, I noticed a reference to using the SysRq key to safely bail out of locked sessions. This was important to me because although I had noted about how to use this magic, I never could get the spell to work on my Slackware configuration. I wanted to enable this option.

I don’t know why, but lately my X sessions have been acting goofy when I try to exit X. I do not yet have a clue where to start troubleshooting. The lock-up occurs as either root or mortal user, and when starting X from the command line or KDM (KDE Display Manger). The problem is intermittent so I suspect that some GUI program that I do not run all the time must be playing havoc with my system. Regardless, when I try to exit X my screen locks hard. X never fully exits and the mouse pointer remains fixed somewhere in the middle of the screen. I am unable to toggle to another console using the magical Alt-Fx keyboard combinations. SysRq seemd a nice way to bail out.

Fortunately, every time I pressed the rest button I experienced no problems with fsck other than noticing a screen message of reparing the journal. All non-destructive. Still, I wanted those SysRq options for that eventual day when I wanted to bail safely.

I discovered that the SysRq was not enabled in my kernel configuration file. I did not investigate further to see if I caused this problem or if the original Slackware came packaged with this option disabled. That was not important because the kernel I was using was recompiled to my taste. So I booted my test box, opened menuconfig, and then enabled the SysRq option from the kernel hacking section. I recompiled and rebooted. Then I tried the following keyboard sequences:

Alt-SysRq-k: kill anything on all virtual terminal
Alt-SysRq-s: synchronize
Alt-SysRq-u: unmount all partitions
Alt-SysRq-b: reboot

My system rebooted. No fsck error messages. Bravo! So I “sacrificed” 15 minutes of my time to recompile the kernel on my primary box. I experienced the same test results. Woohoo!

A day or so later I once again experienced my strange X lock-up upon shutting down. This time I was logged in as mortal user and had used the KDM to perform a shutdown. Same old story. I was about to press the reset button when I remembered I now had use of the SysRq option. I ran through the recipe and everything worked like a book!

Finis.

Table of Contents