Archive for category Operating Systems

Safe reboot a crashed Linux

Originally seen here as Skinny Elephants, this sequence of keys allows you to safely reboot a Linux system that has blocked – avoiding hitting the reset button.

Raising Skinny Elephants Is Utterly Boring

Here is how you “raise the elephant”:

Alt+SysRq+r ( The LEFT Alt key ) ( SysRq is on the same button as print screen )
Alt+SysRq+s
Alt+SysRq+e
Alt+SysRq+i
Alt+SysRq+u
Alt+SysRq+b

Give a little time between keystrokes.

The r stands for put keyboard in raw mode
The s for sync the disk
The e for terminate all processes
The i for kill all processes
The u for remount all filesystems read only
The b for reboot the system

THIS IS THE VERY LAST SAVE YOUR BUTT PROCEDURE ! ONLY IF ALL ELSE FAILS !

Bruno

PS: If your filesystem is Ext3 or ReiserFS and on reboot it wants you to do a filesystem check, don’t touch any key when it asks you to press “Y” and let it recover the journal automatically.

NOTE: For the skinny elephants to work you need to have the sysrq-key enabled in the kernel. (CONFIG_MAGIC_SYSRQ)
You can check if it is enabled by typing “cat /proc/sys/kernel/sysrq”, if the command returns “1″ the sysrq-key is enabled.
If it returns “0″ you can enable it with “echo 1 > /proc/sys/kernel/sysrq”

Tags:

Windows shutdown mindnumbingly slow

It seemed that shutdown in WindowsXP was taking excessively long, with it taking several minutes at the “Saving Your Settings” screen.

Surprisingly(?) I found a tool at Microsoft that provides a solution to get shutdown times back to only a few seconds:
User Profile Hive Cleanup Service

The User Profile Hive Cleanup service helps to ensure user sessions are completely terminated when a user logs off. System processes and applications occasionally maintain connections to registry keys in the user profile after a user logs off. In those cases the user session is prevented from completely ending. This can result in problems when using Roaming User Profiles in a server environment or when using locked profiles as implemented through the Shared Computer Toolkit for Windows XP.

Tags: ,

Default Interface for Multicast on Windows (IPTV)

Third time lucky, as the saying goes.

Having given up trying to get IPTV to work twice before I didn’t hold much hope for a third and final attempt. Again I had no luck on my desktop PC, however I fired up a browser on a different PC and to my surprise it worked immediately.

This confirmed that it was not a problem with my router or the ISP. I quickly realised it could be a problem with the routing of multicast packets (required for IPTV, but rarely used otherwise) and as my main PC had dual NICs there could be a configuration issue.

For IPTV to work the default multicast interface must be the same interface that routes to the internet. For some unknown reason WindowsXP had decided to set the default multicast route to the private LAN, despite the fact that the default route for all other packets was the router.

The quick fix is to update the metrics (priorities) for the multicast routes. Do a route print to see the current table, then update each multicast route such that the Internet gateway IP has the lowest metric:

route add 224.0.0.0 MASK 240.0.0.0 <gateway IP> METRIC 10 -p

This will update the metric to “10″ for the given gateway IP, -p means persistent, so it should remain the same after a reboot.

References

Default Interface for Multicast on Windows
How to change the binding order of network adapters in Windows XP and in Windows 2000

Tags: , ,

Linux open file limit

I discovered some error logs that indicated I was hitting the limit for concurrent open files. Increasing the limit is actually very easy.

Check the current system-wide limit:

$ cat /proc/sys/fs/file-max

To increase this to 65535 we would do (as root):

$ echo "65535" > /proc/sys/fs/file-max

If you want this new value to survive across reboots you can add it to /etc/sysctl.conf:

# Maximum number of open files permited
fs.file-max = 65535

That’s it for system limits, however you should also check user limits:

$ ulimit -n
1024

(use ulimit -a to see all user limits)

To increase this to 65535 for all users (as root), edit /etc/security/limits.conf, and modify or add “nofile” (number of file) entries – note that a userid can be used in place of an asterisk (*)

*                soft    nofile          65535
*                hard    nofile          65535

References

Fix ‘Too many open files’ error on Linux by increasing filehandles
Linux: Increasing the number of open file descriptors
Maximum Number of open files and file descriptors in Linux

Tags: ,

My Documents opens at startup

This was becoming a nuisance, explorer would open a new window every time I logged in (and if I didn’t close them they would continue to compound after each reboot).

A support article suggests a minuscule change in the registry is the cause:

Navigate the Registry to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win­dows NT\CurrentVersion\Winlogon

Find the value Userinit. This value should read: C:\WINDOWS\system32\userinit.e­xe, including the comma.

Why was the comma missing? Who knows, but at least Windows is somewhat under control now.

Tags: ,

Windows Updates Hate

After “updating” to IE7, shared drives are treated as internet zone – prompting you to confirm every single time you try to copy a file.

This knowledge-base article describes the problem, however the “fix” does not work.

This registry hack appeared to work:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\YOUR_SERVER]
"file"=dword:00000001

Then obviously reboot after update the registry, because Winblows can’t seem to get anything done without a reboot.

Tags: , , ,

Fixing VirtualBox

I have been testing VirtualBox OSE in Ubuntu, but found that every time a kernel upgrade comes out the VirtualBox kernel drivers are left out of the upgrade.

The solution is quite simply to add the “ose-source” modules for VirtualBox:

sudo apt-get install virtualbox-ose-source
sudo module-assistant auto-install virtualbox-ose-source
sudo /etc/init.d/vboxdrv start

Now every subsequent upgrade the “ose-source” will be included and the kernal drivers should be built automatically.

Tags: , ,

Problems adding SP3 to WindowsXP

I was unable to upgrade WindowsXP to SP3, given an access denied error. It was not hard to find a relevant kb article from Microsoft:
kb949377
: When you try to install Windows XP Service Pack, you receive the error message “Access is denied” or “Service Pack installation did not complete”

The only given solution that worked was to reset the registry and the file permissions (as given in the kb article):

cd /d "%ProgramFiles%\Windows Resource Kits\Tools"
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f /grant=system=f
subinacl /subdirectories %windir%\*.* /grant=administrators=f /grant=system=f
secedit /configure /cfg %windir%\repair\secsetup.inf /db secsetup.sdb /verbose

Tags: , ,

SP2 cripples Windows XP

SP2 brought with it a rather annoying tweak to the TCP/IP stack: a 10-connection-per-second limit.

I can’t remember exactly what alerted me to this problem, it may have been when a link-checker application stalled, or could have been the multi-threaded ftp client I was using.

Either way, the effect of “hitting the wall” was damned annoying and I need to find a way around it. Thankfully I found an article that offered a few solutions.

Tags: , , ,