Posts Tagged Linux

MultiMedia in Ubuntu

For Ubuntu here is a Comprehensive Multimedia & Video Howto – everything from Flash to DVDs, albeit no hints on getting Blu-Rays to play yet.

Tags: , ,

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:

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: ,

Bittorrent can’t load fastresume data

Testing the Bittorrent CLI client I noticed an error “can’t load fastresume data”. This was forcing it to rescan the entire data before resuming the torrent – even if nothing had changed since the previous run.

A bit of searching found this solution:

change file /usr/lib/python2.5/site-packages/BitTorrent/Storage.py
modify line 216

str(os.path.getmtime(filename)) + '\n')

to

str(int(os.path.getmtime(filename))) + '\n')

remove the binaries

rm /usr/lib/python2.5/site-packages/BitTorrent/Storage.pyo
rm /usr/lib/python2.5/site-packages/BitTorrent/Storage.pyc

Tags: , , ,