≡ Menu

kernel hackers

There is a new growing trend in enterprise, adopt community based distribution such as Ubuntu or CentOS Linux. I can confirm the same. Last month, I helped one my client to move from RHEL 4.x to CentOS and Debian boxes. I also trained their existing staff to work with Debian. This was done to cut the cost and they found that Red Hat support is not worth paying huge money. They were totally dissatisfied with the cost of support services.

Companies are increasingly choosing free community-driven Linux distributions instead of commercial offerings with conventional support options. Several factors are driving this trend, particularly dissatisfaction with the cost of support services from the major distributors. Companies that use and deploy Linux internally increasingly have enough in-house expertise to handle all of their technical needs and no longer have to rely on Red Hat or Novell.

I've client with over 500 RHEL servers. I always found that Google is the best hunting tool for solving Linux related problems. Red Hat staff will always forced to do a sysreport before you moved to 2nd or 3rd level support to get quality support (it may take 2-3 days). So what is the use of support if I had to go though tier 1 each time?

On a bright side, you may wanna use Red Hat or Novell support:

  1. If you like to point fingers at someone else with 24/7
  2. Large Business most likely going to have support option
  3. Red Hat and Novell also help to grow open source software. They pay full-time Linux developers and kernel hackers.
  4. Some kernel bugs and issues can only be fixed by vendor as there is no work around.

Personally, I use Debian and FreeBSD on all my servers. Cyberciti.biz server is powered by RHEL 5.2. I always suggest to have RHEL for all business / mission critical systems.

Read more: Analyst: Ubuntu, community distros ready for the enterprise

Howto Reboot or halt Linux system in emergency

Linux kernel includes magic system request keys. It was originally developed for kernel hackers. However, you can use this hack to reboot, shutdown or halt computer safely (remember safe reboot/shutdown == flush filesystem buffers and unmount file system and then reboot so that data loss can be avoided).

This is quite useful when Linux based system is not available after boot or after a X server crashed ( svgalib program crashes) or no display on screen. Sysrq key combo forces the kernel to respond it regardless of whatever else it is doing, unless it is completely locked up (dead).

Using further extension to iptables called ipt_sysrq (new iptables target), which allows you to do the same as the magic sysrq key on a keyboard does, but over the network. So if your network server is not responding you can still reboot it. Please note that Magic SysRq support need to be compiled in your kernel. You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when configuring the kernel. I'm assuming that you have Magic SysRq key' support is compiled in your kernel.

Enable sysrq keys

By default it is not enabled on many Linux distributions. Add or modify following line (as soon as new Linux system installed) /etc/sysctl.conf:
# vi /etc/sysctl.conf
Append following config directive:
Save and close the file. Reload settings:
# sysctl -p

Save and close the file and reboot system to take effect

How do I use the magic SysRq keys in emergency?

You need to use following key combination in order to reboot/halt/sync file system etc:

The 'SysRq' key is also known as the 'Print Screen' key. COMMAND-KEY can be any one of the following (all keys need to hit simultaneously) :

  • 'b' : Will immediately reboot the system without syncing or unmounting your disks.
  • 'o' : Will shutdown your system off (if configured and supported).
  • 's': Will attempt to sync all mounted filesystems.
  • 'u' : Will attempt to remount all mounted filesystems read-only.
  • 'e' : Send a SIGTERM to all processes, except for init.
  • 'h': Show help, indeed this the one you need to remember.

So whey you need to tell your Linux computer to reboot or when your X server is crashed or you don't see anything going across the screen then just press:

ALT+SysRQ+s : (Press and hold down ALT, then SysRQ (Print Screen) key and press 's') -Will try to syn all mounted system

ALT+SysRQ+r : (Press and hold down ALT, then SysRQ (Print Screen) key and press 'r') -Will reboot the system.

If you wish to shutdown the system instead of reboot then press following key combination:

ipt_sysrq is a new iptables target that allows you to do the same as the magic sysrq key on a keyboard does, but over the network. Sometimes a remote server hangs and only responds to icmp echo request (ping). Every administrator of such machine is very unhappy because (s)he must go there and press the reset button. It takes a long time and it's inconvenient. So use the Network Magic SysRq and you will be able to do more than just pressing a reset button. You can remotely sync disks, remount them read-only, then do a reboot. And everything comfortably and only in a few seconds. Please see Marek Zelem page to enableIP Tables network magic SysRq function.

For more information read official Documentation for sysrq.c version 1.15 stored in /usr/src/linux/Documentation/sysrq.txt and read man page of sysctl, sysctl.conf.