Safely Reboot a Crashed Linux

You need to press
Alt + Print, hold it and press
R E I S U B
(without the spaces).

Now your kernel *should* sync and unmount the filesystems and then reboot.

Found in 10 tips for lazy admins.

Sysctl for Network Perfomance

The short version:

net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.log_martians = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 87380 8388608
net.core.wmem_max = 262143
net.core.rmem_max = 262143
net.core.rmem_default = 262143
net.core.wmem_default = 262143


Or less with more comments:
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15

# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800

# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0

# Turn off the tcp_sack
net.ipv4.tcp_sack = 0

# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0

# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1

# Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1

# Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024

# Increase the tcp-time-wait buckets pool size
net.ipv4.tcp_max_tw_buckets = 1440000


An excerpt from Webhostingtalk.

The Great Sysctl Mystery

Most advanced Linux users with know the sysctl interface for fine-tuning the Linux kernel. But there is probably noone on earth who really understands all those parameters. Well no wonder, as they're usually not even documented.

So I just thought to myself:
It would be great to have a program which has all the values and explanations to them. It could then create configuration files and let sysctl parse them. "Linux Kernel Tuning" would be a cool name. If I had more time... ;-)

The World in Danger

When the Large Hadron Collider was activated for the first today there was a very disconcerting picture leaked.

Also check out this comic.

Git Bisecting the Linux Kernel to Find Bugs

You can help the Linux developers by testing out the current bleeding edge version of Linux by downloading the current version from git:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

And then you can compile the kernel normally. To fetch the newest updates you enter the directory (linux-2.6) and enter git pull.

Then if you find a bug that wasn't there before you can find out which patch caused it with a git bisect search. It's relatively quick through a binary search algorithm, it only needs around 14 compiles and boots for about 4000 patches, and the complexity is logarithmic I believe (so it's always relatively quick, even with a lot to test).

Also see this quick intro and the man page.

Compiling really takes most of the time. You can decrease that time by creating a minimal kernel configuration (it's worth it!) with only the features activated that are needed to trigger the bug.

I recommend compiling everything directly into the kernel, you can then just do "make bzImage" instead of make and save the time for making and installing the modules (over and over again).

When Community does not Help: Ubuntu Maintainers keep their hands still about NetworkManager Memory Leak

There is a bug report about the current networkmanager memory leak at launchpad since March now. At that time the current Release was not even out. But the maintainers at Ubuntu are so passionately careless about it that they haven't even commented on it since then.

There are several people watching the bug and of course thousands affected with NetworkManager being in the standard installation of at least Ubuntu and Kubuntu, but the maintainers keep their hands still. A fix is also out and has been successfully applied and a package was released, too. It just never went into the current distribution.

This shows how the community can care so much about important bugs, if the appropriate people don't respond, many Linux users are just as helpless as when they use Windows. But I really doubt that such a major memory leak would remain unfixed for such a long time even in any current Microsoft product.

A shame...

If you want the bug fixed for you, you can do so manually, I posted links to the fixed packages a while ago.

Latencytop Explained

I hope you all know what powertop is - at least if you own a Laptop with Linux on it - but I always had trouble with the wonderfully non-intuitive interface to LatencyTop. But now there's an article on Linux.com explaining it.

Debian Packages the Easy Way

Ever wanted to create a debian package so your package manager knows about the program you installed from source and helps you with the clean up or upgrades? Do you configure; make as usual and then simpy give it a
sudo checkinstall -D

You may of course need to apt-get install the package checkinstall first.

Using IrDA on Linux

Using IrDA under Windows is quite simple. It just works. On Linux it took me literally hours to get it working. But you might get it working much faster with these tips ;-)

A very useful website was this one: http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/#debug

You have to do most things as user root. Otherwise they might now work because you don't have the permissions but you won't know that because the programs won't tell you.
  1. You need to load all the appropriate modules for your driver, also ircomm_tty irtty_sir sir_dev.
  2. Then you need to activate the network interface irda0: ifconfig irda0 up.
  3. You should now be ready to establish a connection (as root).
I've made this script, which lets me connect a Siemens M65 to the Acer Extensa 5220:
#reprobe irda kernel module
rmmod nsc-ircc
modprobe nsc-ircc dma=3 io=0x02F8 irq=3 # these are standard settings for the 5220. they might work for you, too.

# activate interface
ifconfig irda0 up
# enable discovery
echo 1 > /proc/sys/net/irda/discovery
#wait for results
sleep 2
#check results
cat /proc/net/irda/discovery

#attach irda stack
irattach irda0 -s

#you should now be able to watch the transfer stats with irdadump

# for mobile phone connectivity problems I need to reduce the connection speed
echo 9600 > /proc/sys/net/irda/max_baud_rate
Notes
  • cat /proc/net/irda/* shows you some information about the irda devices.
  • Be aware that the connection device is /dev/ircomm0.
  • You should first try everything as user root. Otherwise it might fail just because of missing permissions. Then in a second step when it works, try to use it as a user.
  • obexftp claims it doesn't need the -i parameter for irda. Well, it does, though.
  • I still haven't been able to get ppp over GPRS to work with Linux.
  • Irda currently works only after rebooting into Linux from Windows.

Memory Usage - Pidgin vs. Kopete

The GTalk outage gave me some time to run another test of pidgin vs. kopete in memory consumption. Pidgin used to always win this competition, which is - next to the then better working file transfers - why I use pidgin.

I tested it again today and this time the Kopete coming with KDE 4.1.1 in Kubuntu won!

  • Kopete used about 18 MB ram
  • Pidgin used 23 MB ram

These results and the differences were reproducible. They were tested with "free" in the console. I started one program, then the other and in between ran free in the shell - several times.

Of course these results apply only if you're running a KDE 4.1.1 desktop. If you're a gnome user, pidgin is very likely to use less memory for you.

Also reproducible was that Kopete ate a lot of memory when opening the - currently very slow - configuration dialogue.

There seems to be a bug somewhere, as this memory is not freed until after you restart kopete. So after configuring something in Kopete 0.60.1 make sure you quit and restart it.

Feel free to test it yourself and post your results. Make sure to include what distribution, program versions and desktop environment you use and that you have the same amout of accounts active in each program.

Google Server Problem

Google wasn't especially known for server problems so far. But it seems recently there have been outages or slow service in Gmail and other Google online services. So if your Google Talk account doesn't work today don't worry - you're not the only one.

Google Chrome under Linux with WINE

It turns out the guys at WineHQ already figured out how to run Google Chrome within WINE. Heres a really easy quick guide for you:

  1. Get a current wine version (1.1.3+)
  2. Download the Chrome offline installer.
  3. Install normally, best with a fresh wine installation.
  4. Go into the install directory (e.g. #cd ".wine/drive_c/windows/profiles//Local Settings/Application Data/Google/Chrome/Application") NOTE: this path is not exactly the same for everyone
  5. Start chrome like this: wine chrome.exe --new-http --no-sandbox
To get some privacy you should also
  1. Disable URL typo correction.
  2. Disable website suggestions.
  3. Disable Google Ad cookies.
  4. Quit Chrome. Then change the browser's unique identifier in "User Data/Local State" to the values from Google Chrome Portable to (hopefully) prevent Google from identifying your personal browser copy:
"client_id": "FA7069F6-ACF8-4E92-805E-2AEBC67F45E0",
"client_id_timestamp": "1220449017",

And now finally enjoy your privacy-enhanced Google Chrome browser! :)

Unfortunately there's no guarantee that Google hasn't hidden even more spying features in this otherwise pretty neat little browser.

Strip Mining of Open Source

Two people, one idea. Richard Hillesley from IT PRO also writes about companies who don't give back to the open source community, like Apple.

It makes for an interesting read and I think his article is much better researched than my own I posted here recently. And showing the dangers of some open source licenses he concludes developers should be careful in their choice of open source licenses.

The GPL, he concludes, not only protects from "strip mining" companies, but also (though IMO less well reasoned) from fragmentation and forking of the code.

It seems Hillesley's article is a response to an article by Fleury.

Power Save Script

I wrote a little powersave script that quickly executes a few commands to improve battery life, esp. on notebooks. You can put it in /etc/acpi/battery.d/20-powersave.sh to start automatically when the computer runs on battery.


#!/bin/bash

SUDO=`which sudo`
SU=`which su`
EXEC="$SUDO $SU -c"

echo Activating power saving mode...

# Automatically suspend USB -- How to automatize?
# usbcore.autosuspend=1 to kernel cmdline didnt work
$EXEC "echo 1 > /sys/module/usbcore/parameters/autosuspend"

# Disable CD autodetection by hal
# sudo hal-disable-polling --device /dev/scd0

$EXEC "ethtool -s eth0 wol d"

# reduce disk writes
$EXEC "echo 1500 > /proc/sys/vm/dirty_writeback_centisecs"

# SATA powersaving mode
$EXEC "echo min_power > /sys/class/scsi_host/host0/link_power_management_policy"

# AC97 power saving
$EXEC "echo 1 > /sys/module/snd_ac97_codec/parameters/power_save"

# Intel-HDA power saving
$EXEC "echo 1 > /sys/module/snd_hda_intel/parameters/power_save"

# optimize scheduling for dual-core cpus
$EXEC "echo 1 > /sys/devices/system/cpu/sched_mc_power_savings"

# Remove fixed network adapter, intel watchdog
sudo rmmod iTCO_wdt iTCO_vendor_support tg3

# set minimum frequency
#$EXEC "echo 866664 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"

sudo killall guidance-power-manager.py

xrandr --output TV --off

for i in /sys/bus/usb/devices/%s/power/autosuspend; do $EXEC "echo 1 > $i"; done

$SUDO iwconfig wlan0 power on



Actually I think a part of the script might be from someone else...

Reducing Power Consumption for Linux Laptop

Besides tuning your system with powertop, there are a lot of things you can do to minimize the power consumption of your Linux laptop in order to maximize the battery life.

Thinkwiki is a great Wiki with lots of power saving information I recommend.

Second Thoughts on Google Chrome

The problems with Google Chrome are that it
  1. is not (yet) available for Linux
  2. spies what webpages you visit
  3. has a unique browser identifier
  4. can be crashed completely by a single webpage
  5. has some (so far minor) security issues.
And of course it might extend Google's web monopoly even further.

Open Source Donation Center

Reading a news update on Phoronix I had a nice idea: Why isn't there a place to make a spread donation to open source projects. You get everything for free on Linux, but you'd like to give some money for improving the software you use.

Imagine there's a simple single place where you can donate to different software projects and for different purposes. They could of course also offer memberships, bounties and support contract models, mascots, licenses etc. And the software projects wouldn't have to deal with the legal and financial issues involved but just get the money.

Especially Xorg needs more support and I guess a couple paid employees wouldn't hurt. Situations like that could be sought out and dealt with by a Linux task force. I guess someone like the Linux Foundation might be a good starting point.

(Not) Giving Back to the Community

Open source software is not only a great chance for software projects to make better software. It is also a great Chance for the community and companies to quickly create new products or assemble them to new products.

Among the current examples of using free software are many big names
  • Apple's OS X operating system
  • the Safari browser
  • Google's Servers (Linux-based)
  • Google's new Chrome browser
  • AnchorFree's Hotspotshield software.
The problem is, though, that many companies use code from other projects themselves, but fail to give back code to the community.

Apple only publishes the changes made to the Darwin operating system every once in a while, only that few people really care. Of course Apple doesn't want people to be able to run Mac OS X on normal PC hardware and thus does everthing to discourage too active community involvement here.

But you can only wonder how come the Safari browser, based on KDE's Konqueror KHTML engine, is still not available for Linux. Even worse, most of the enhancements made by Apple are never incorporated back into KDE. And Apple even managed to draw developers away from developing KHTML to working only on Safari. (I know, this is a big debate and flate-prown.)

Google claims to give back much more to the community than it would have to and proudly states that Chrome is made open source. But it's not like it really was their free choice. Chrome is based upon Firefox and KHTML and both are open source and at least HTML is GPL-licensed and may thus not be published as a closed source software. And most other Google software products are closed source: Google Desktop, Picasa, etc.

And one has to wonder about the big picture. If companies do not return code enhancements and help to the open source projects, the result will not only be a major frustration in the projects, but also a financial detriment for the global economy. Because only if the project members are encouraged to write free software and not only used, they will enjoy working in their free time. In their work they help to prevent a constant reinventing of the wheel in different areas of software development and fix many bugs.

In the end good open source collaboration can free up many resources and enable programmers everywhere to create new, better software much more quickly, dynamically and freely. This is something a company must consider when getting involved with open source projects and keep in mind to provide help back to the projects in terms of a significant part of the employee time, code and money they saved.

Google Chrome is Out

Everybody's writing about it. I've got a direct download link for you, in case the people at Google keep taking it off just like today:
Try either http://www.google.com/chrome/eula.html or http://dl.google.com/update2/installers/ChromeSetup.exe.

Or the Offline installer: http://dl.google.com/chrome/install/149.27/chrome_installer.exe

(not verified backup: http://rapidshare.com/files/142199853/chrome_installer.exe)

Backup Partitions to a Bootable Partimage DVD

Looking for exactly that I found a nice quick little howto, which is written for Windows, but only uses Linux tools: http://ping.windowsdream.com/ping/doc-2.01/bootiso.html