Stefano Rivera (tumbleweed)'s Website, Blog, collected bits of code, cruft and other stuff.

The joy that is SysRq

I’m constantly surprised when I come across long-time Linux users who don’t know about SysRq. The Linux Magic System Request Key Hacks are a magic set of commands that you can get the Linux kernel to follow no matter what’s going on (unless it has panicked or totally deadlocked).

Why is this useful? Well, there are many situations where you can’t shut a system down properly, but you need to reboot. Examples:

  • You’ve had a kernel OOPS, which is not quite a panic but there could be memory corruption in the kernel, things are getting pretty weird, and quite honestly you don’t want to be running in that condition for any longer than necessary.
  • You have reason to believe it won’t be able to shut down properly.
  • Your system is almost-locked-up (i.e. the above point)
  • Your UPS has about 10 seconds worth of power left
  • Something is on fire (lp0 possibly?)
  • …Insert other esoteric failure modes here…

In any of those situations, grab a console keyboard, and type Alt+SysRq+s (sync), Alt+SysRq+u (unmount), wait for it to have synced, and finally Alt+SysRq+b (reboot NOW!). If you don’t have a handy keyboard attached to said machine, or are on another continent, you can

# echo u > /proc/sysrq-trigger

In my books, the useful SysRq commands are:

b
Reboot
f
Call the oom_killer
h
Display SysRq help
l
Print a kernel stacktrace
o
Power Off
r
Set your keyboard to RAW mode (required after some X breakages)
s
Sync all filesystems
u
Remount all filesystems read-only
0-9
Change console logging level

In fact, read the rest of the SysRq documentation, print it out, and tape it above your bed. Next time you reach for the reset switch on a Linux box, stop your self, type the S,U,B sequence, and watch your system come up as if nothing untoward has happened.

Update: I previously recommended U,S,B but after a bit of digging, I think S,U,B may be correct.

Videos up

Administravia: Just uploaded a pile of videos:

Also, I changed a few feeds on CLUG Park from RSS to Atom, so sorry about any RSS-reader-spamming.

The word "Cruft"

According to the Media course I did back in first year, there’s a fine line between Jargon and Technical Terminology, jargon being more informal. Amongst geeks, technical terminology makes communication possible, and jargon makes our lives easier. To anyone else, it makes us sound like “geek”s, but we are generally ok with that.

When we say “webserver daemon” or “apache httpd” to each other, we mean “the piece of software running on the computer that gives web-pages to anyone who asks for them”. We don’t want to say things like that to each other (it’d take years to say anything), but we often need to break terms down like that when talking to people from other worlds (fields).

Technical, computer-jargon isn’t the only type of jargon, either, there’s legalese jargon, mathematical jargon, medical jargon, literary jargon, etc etc.

Just like normal English, we all know a large enough subset of our jargon that we can understand each other even if we don’t know the odd specific term, but every now and then we have to refer to a dictionary.

Of course to be able to speak amongst ourselves and to the world at large, we need to know where the lines are between technical terminology, jargon, and normal English. Sometimes, we get this wrong. A housemate called me on it today, asking what I meant when I was describing something as “crufty”. I was incredulous - was cruft not a standard, everyday word? Is it just me, or do other geeks regard “cruft” as being a normal English word? It hardly sounds technical, it sounds like something you’d find on the corner a carpet, that we abused as a metaphor for unmaintained messy bits of computing.

A quick google (note “to google” is no longer jargon) took me to the Jargon file entry stating a very geeky etymology:

  1. Poorly built, possibly over-complex. The canonical example is “This is standard old crufty DEC software”. In fact, one fanciful theory of the origin of crufty holds that was originally a mutation of ‘crusty’ applied to DEC software so old that the ‘s’ characters were tall and skinny, looking more like ‘f’ characters.

This term is one of the oldest in the jargon and no one is sure of its etymology, but it is suggestive that there is a Cruft Hall at Harvard University which is part of the old physics building; it’s said to have been the physics department’s radar lab during WWII. To this day (early 1993) the windows appear to be full of random techno-junk. MIT or Lincoln Labs people may well have coined the term as a knock on the competition.

On a similar note, how many other people only discovered the word “segue” after hearing about the Segway Personal Transporter? (Hint: “segue” is pronounced “seg-way”) It certainly seems to have become a much more popular word to use since the launch of the Segway.

International 419-SMS

I don’t know if I get more spam than other people because my phone numbers are public, or if I’m just more of a touchy, grouchy git than other people and just react to every spam I get.

So, here is another SPAM-related post.

I just got an SMS from +256715316646 saying:

CONGRATULATION- You have won a TOYOTA LANDCRUISER VX worth $80,000 US DOLLARS.Contact the manager DR: STEPHEN through +254720043297 (JAPAN INT. MOTORS) THANKS.

Look closely. Firstly, it’s a 419-scam via SMS. I’ve never seen one of those before. 2nd, it’s from Uganda (a Uganda Telecom cellphone number). Third, it wants me to call someone in Kenya (a Safaricom cell number).

What on earth does one do to stop such things? Either this is run by a group with people on the ground in both countries, or they are using online bulk-SMS services. But International SMSs aren’t cheap. And I have no idea who to complain to about this. Let’s hope that this kind of spam doesn’t become common, because it’s virtually unstoppable if it does (like International e-mail spam).

Update: This page seems to have become a rant-board for people getting this spam. If it isn’t plainly obvious, here’s what to do: nothing. Don’t respond, don’t give them details, it’s a scam!.

Update 2: I won’t be replying to any of these comments any more - read the update above.

Update 3: Comments disabled, as this post is collecting more of the same comments. Don’t try and contact me personally if you have got a similar message, I’m not interested.

Ctrl-Alt-shortcuts considered harmful

I’ve written about this before, but Ctrl-Alt-workspace switching key-presses nail me routinely.

Let’s go through some history:

We have Ctrl-Alt-Delete, the “three-fingered-salute”, meaning reboot, right? That combination was designed to NEVER be pressed by accident. And it never used to be.

The X guys needed a kill-X key-press, as things can sometimes get broken in X. So they chose Ctrl-Alt-Backspace, which is also a pretty sensible combination. It’s very similar to Ctrl-Alt-Delete, so we remember it, and backspace has milder connotations than delete, so we understand it to mean that it’ll only kill a part of the system.

X also has some other Ctl-Alt- shortcuts. Some of these are also suitably obscure, i.e. NumPad+ and NumPad-. Others like Ctrl-Alt-F1 mean change to virtual console 1. That one might do by accident, if you are an old WordPerfect user, but should be safe enough otherwise. They were designed to look like big brothers of (and even work as) standard VT-changing behaviour.

For changing workspaces, Alt-F1 style key-presses were used, mimicing VT-changing key-presses. This is great for *nix users, but people coming from Windows expect Alt-F4 to close a program, not take them to workspace 4.

So GNOME came along, and decided that instead, they’d use Ctrl-Alt-Arrow key-presses to change workspace. That’s fine, but it’s a pretty common action, so I’m often holding down Ctrl-Alt without even thinking about it. If I start editing something and press delete/backspace, before I’ve released Ctrl-Alt, boom! And I run screaming and write a blog post.

Now, I know that Ctl-Alt-{Delete,Backspace} can be disabled (even if the latter is a little tricky to do), but I’d really like to change them. I like to be able to kill X without using another machine and ssh, I just don’t like this to happen by accident. And no, the solution isn’t for me to change my workspace-changing keys, because this problem must affect every GNOME user, not just me.

Dangerous key-presses should be really unlikely key-presses. Alt-SysRq- key-presses are good in this regard, they’ll always be unlikely. (Oh, and they are insanely useful.)

Syndicate content