• How to properly restart a frozen Linux: SysRq

    I know that Linux works very well on your machine, but when your work is to provide support you’ll probably see some frozen Linux…

    The biggest problem is when a frozen, full screen X application took control over your mouse and keyboard and it seems that the only way to regain access to the system is to force a shutdown.

    This is obviously not an optimal way to get around the problem, as you may suffer serious data loss.

    The first thing to try is to kill just the frozen application. There are normally six text consoles sessions available and one graphics session.
    You can access the consoles by pressing CTRL + ALT + Fx (where Fx is a function key on the keyboard from F1 to F6).
    Once you enter one console, you will be prompted for user name and password. Enter them and then you’ll reach a command prompt.
    Now you can kill the offending process using the kill command.
    To switch back to the graphic session, just click CTRL + ALT + F7.

    If for some reason you cannot access any of the consoles or you simply cannot control the pc anymore, you should try as last resort to perform a “safe reboot” of your OS.

    Since linux kernel 2.1.43 the feature CONFIG_MAGIC_SYSRQ has been added. When the kernel is compiled with this option enabled, it will be able to understand some low level commands that will work most of the times even if you have unresponsive applications that are freezing your machine.
    To send a low level command you must press ALT + SysRq + Command (where “Command” is one of the commands listed at: http://lxr.linux.no/linux/Documentation/sysrq.txt).

    The SysRq/Print Screen key

    To actually reboot the machine there is a well know key sequence to follow: REISUB (or REISUO if you want to turn off the pc instead of reboot).
    Basically, if you keep pressed ALT + SysRq + R and then while you keep pressed ALT + SysRq you press E, I, S, U, B.
    Here you can see an explanation of each one of those commands:

    R: Switch the keyboard from RAW to XLATE mode (take back the control of the keyboard)
    E: Send the SIGTERM signal to all processes except init
    I: Send the SIGKILL signal to all processes except init
    S: Sync all mounted filesystems (this will help avoiding loss of data)
    U: Remount all mounted filesystems in read-only mode
    B: Immediately reboot the system, without unmounting partitions or syncing

    Sometimes the first command “R” doesn’t work at the first time so you’ll have to press it a few times. And it happened once to me that the REISUB didn’t work until I went to a console (as described before, using the CTRL + ALT + Fx combination).

    Hopefully this information will help you!

  • How to share the internet connection of your Ubuntu with your old Palm using Bluetooth

    Since Bluez utilities have been updated to the version 4.x I’ve found quite complicated to share the internet connection of my linux box (actually an Ubuntu 10.04 – Lucid Lynx) with my Palm Centro.

    So I’ve investigated the issue a bit and this is how I get it working:

    1. pair the phone and the pc using the standard bluetooth interface (on the taskbar)
    2. sudo apt-get install bluez-compat
    3. gksudo gedit /etc/sysctl.conf
    4. Uncomment the line “net.ipv4.conf.default.forwarding=1”
    5. sudo sysctl -p
    6. gksudo gedit /etc/ppp/peers/dun
    7. paste inside the file (and adapt it to your network configuration):
    115200

    # IP address of PC : IP address to be assigned to Palm
    192.168.2.1:192.168.2.2

    local

    # put your DNS server IP down here:
    ms-dns 192.168.0.1

    noauth

    debug
    8. sudo /usr/bin/dund --listen --persist --msdun call dun --nodetach
    9. launch the connection from your phone, it worked for me… Good luck!