Changing the User Password without Permissions

You can just download
http://ophcrack.sourceforge.net/
.

It reportedly works for Windows, Linux and OS X.

Using SMPlayer with hardware video acceleration such as VAAPI - Fixing various crashes etc. with VAAPI

If you've also tried to use VAAPI with SMplayer, you may also have experienced the crash every single time you try to watch anything. These things might also apply to VDPAU and xvmc.

Here's the solution
1. Disable screenshots:
General -> General -> Enable Screenshots [ ] (uncheck)

2. Set to single thread decoding:
Performance -> Performance -> Threads ... [1]

3. Disable subtitles and postprocessing.

Here's what doesn't help:
Upgrading to the current version 0.6.8.

If you want to know how to get VAAPI working SMPlayer in the first place: Select
General -> Video -> Output Driver -> Custom -> "vaapi,xv," and
Advanced -> Options for Mplayer -> Options -> "-va vaapi".

Let me know if it worked for you. Someone should probably inform the author of smplayer and/or mplayer. Excellent programs!

Over 9 Hours of Video on Battery with the MSI Wind U110

After I've managed to set up the video acceleration, it was time to test if it's really as power efficient as claimed. I just tried that with some SD and HD video. HD video wouldn't play properly of course, so it's silly to compare battery times.

But with SD video and vaapi, I managed to get down to 6.1 watts (9.1 hours). Without vaapi it was around 6.3-6.5 watts (8.5 hours).

I used a few tricks to achieve this:
  1. disabled wifi and bluetooth.
  2. lowered the display brightness to minum (still good though). This has to be done before boot in 2.6.31.
  3. moved the system to an SDHC card. While the power in standby is the same (5.7 watts both with only SDHC or only hard disk), the active power is much lower with the SDHC (only +0.5-2 watts instead of 3-5 watts).
  4. used by powersave script to optimize the kernel settings for low power mode:
echo cpu
echo 1 | tee /sys/devices/system/cpu/sched_smt_power_savings
echo 1 | tee /sys/devices/system/cpu/cpu*/cpufreq/ondemand/ignore_nice_load
echo 95 | tee /sys/devices/system/cpu/cpu*/cpufreq/ondemand/up_threshold
echo 50 | tee /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias
echo

echo usb
echo 2 | tee /sys/module/usbcore/parameters/autosuspend
echo auto | tee /sys/bus/usb/devices/*/power/level
echo

echo misc
echo 1500 | tee /proc/sys/vm/dirty_writeback_centisecs
echo 0 | tee /sys/block/sdb/queue/rotational
# broken echo 10 | tee /sys/module/snd_hda_intel/parameters/power_save
# not better echo 1 | tee /sys/module/psb/parameters/disable_vsync

killall -q hald-addon-storage knotify4 NetworkManager
hciconfig hci0 down

Ubuntu One Privacy in the EU

I was just about to look into using Ubuntu One. But I chose not to, because I would have had to install tons of Gnome dependencies and use the Gnome client. It's not integrated to KDE yet. Then I read about their privacy policy, because recently we see a lot of bad privacy policies I would say. And I'm not too happy about what I read.

"Canonical may disclose any or all personal data and contents you have sent, posted or published if required to comply with applicable law or the order or requirement of a court, administrative agency or other governmental body." (https://one.ubuntu.com/terms/)

So if the local village chief somewhere in East Timor wants ("requires") to see your private documents, he is welcome to. Or do we use eiusdem generis rule? Well, I would still say any administrative agency is not very narrow. I think we can at the very least expect not only secret services or police, but any part of the US federal and local government to have access to any of your saved data at any time they require it and without any court orders. The link also lists as administrative agencies: the labor relations board or the Farm Credit Administration, the Maritime Administration, Environmental Protection Agency, Food and Drug Administration, Immigration and Naturalization Service or FCC and IRS. So quite a lot of people with potential access to all of your private information.

We don’t share your personal information with anyone except to provide you with services, comply with the law, or protect our rights. (https://one.ubuntu.com/privacy/)

Canonical's rights could be a lot of things I think. Maybe it could include the right to get payed by you? If you didn't pay in time, it looks to me that by the contract terms they might share your personal information with "anyone" to protect their right to be payed.

The quotes are from the UK version of Ubuntu One, but probably apply similar everywhere. I think they actually really tried to make it privacy friendly. But at the same time, they really wanted to make sure they couldn't possible get in trouble through protecting your privacy.

DISCLAIMER: I am not a lawyer - this is not legal advise. This is just a discussion view and a try to inform the general public about something that may or may not be interpreted by professionals as here stated. You are invited to share your views in the comments.

How to Boot Floppy Disks with Grub e.g. to upgrade your BIOS

If you have a modern notebook, it's likely you don't have a floppy drive. But still, many companies offer either floppy images or windows tools to upgrade your BIOS. Both not really great for Linux users. Of course, you can use the tools of OpenBIOS, but that can be pretty difficult. Here's how you can boot any floppy directly in memory via grub:

1. You need to get memdisk. It's included in the syslinux package.

2. You copy memdisk to your boot folder:
e.g. cp /usr/lib/syslinux/memdisk /boot/memdisk

3. You uncompress (if it's zipped) and copy your floppy image to the boot folder, e.g. to /boot/floppy.ima.

4. You create the grub entry, use your normal values for root and the path:
title Floppy Image
root (hd0,0)
kernel /boot/memdisk
initrd /boot/floppy.ima
boot
5. Reboot, select it. It should boot normally, only without the annoying floppy drive noise. Done!

How to set up X and VAAPI Accelerated HD Video on the MSI Wind U110 (GMA500 - Poulsbo) and Ubuntu Karmic 9.10

The following guide is now slightly outdated as Ubuntu 10.04 is out and new drivers are necessary, also some of the repositories I originally used have disappeared. If you use Ubuntu 10.04, try following my much easier directions here instead. (The largest detriment to the Ubuntu 9.10 driver is a complete lack of suspend to ram for me. I will leave my guide for 9.10 online as reference, though. It seems to have been the first good description and I'm happy about the major online media coverage. :)

I've finally managed to get it running. Here is what I did. First you need to get Ubuntu 9.10 running with poulsbo. The first steps 1.-4. describe how to set up the driver for X. The second part (5.-10.) describes how to set up VAAPI and mplayer to get video acceleration. (There is already an early stage GMA500 driver for Ubuntu 10.04.)

The image shows the phoronix test suite benchmarking when I play Grey.ts in a loop (-loop 0) with mplayer and vaapi but without sound (-nosound) on my netbook. During the entire time, the CPU frequency is also downscaled to 800 Mhz. Compare to phoronix vdpau benchmark on a core 2 duo system (which obviously shows even less cpu usage, because the CPU is much more powerful) or the Atom and Nvidia ION benchmark on Phoronix.
CPU usage when playing a 10 minute fireworks recording in 1080p @ 50 fps without sound and then two FullHD movie trailers. The CPU is clocked at 800Mhz the entire time. The spike is caused by a bug in my test sequence: I didn't start a new mplayer process for new files but passed them all at once on the command line.

I can watch FullHD (1080p @ 50 fps + AC3) videos with about 30% or less CPU utilization (Atom@800 Mhz) on my netbook now. Looks really nice, too. Some videos produce artefacts, especially self-recorded AVCHD m2ts files. If you use the right demuxer, AVCHD videos play fine, but deinterlacing does not work. Sometimes the video seems not to run very smooth, etc. It's not perfect yet, don't expect too much! But most videos work perfectly, no matter what resolution.

The only real problem is with suspend to ram. You can't use suspend to ram or VAAPI at the same time: If you used VAAPI and try to suspend, the system doesn't suspend and/or crashes. If you suspend, then use VAAPI or even xv I think, the system crashes really hard. So suspend doesn't really work as expected yet. I think the sound also doesn't work properly after suspend. Suspend works fine for me even after resume if I do a double console switch (Ctrl-Alt-F1 wait until you see the console, then Ctrl-Alt-F7).

Here's what you need to do
1. Basically you add the GMA500 Repositories for Ubuntu 9.10 (karmic) and 10.04 (Lucid) to /etc/apt/sources.list.d/mobile.list. (If the entry below doesn't work, check this page.)
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update

2. Then you install the poulsbo-driver-3d including the firmware and everything.

2.a. Check if you can load the psb module: sudo modprobe psb. If you see this in dmesg instead of a switch to the correct resolution,
"kernel BUG: unable to handle kernel NULL pointer dereference at (null)" (2.6.31)
you need a manual hack to get the driver working, as I just reported.


3. Once that's done, for a more stable and speedy operation, you need to add an /etc/X11/xorg.conf:

Section "Device"
Identifier "GMA500"
Option "AccelMethod" "EXA"
# someone suggested UXA? but that's for the i965 drivers
Option "DRI" "on"
Option "MigrationHeuristic" "greedy"
Option "IgnoreACPI" "yes"
Driver "psb"
EndSection

Section "DRI"
Mode 0666
EndSection

4. Reboot and make sure that it works! If X doesn't work properly yet, VAAPI won't, either. After a short black screen, you should be greeted in the correct resolution. Full screen xv video should already work fine. Suspend to RAM also worked perfectly at this point for me.

If  the system goes to DPMS standby and from there switches to other modes (DPMS suspend, etc.), then my screen actually turns on again (showing all black with backlight active). So make sure you chose only one setting for DPMS. A constantly running screen is not good at all.

VAAPI Video Acceleration setup
Now comes the part where we install the hardware decoding acceleration. If you just want X you can stop now. ;) This is written for Ubuntu 9.10 with old repositories, so 5+6 might not be necessary anymore or work for Ubuntu 10.04!

5. Install the Libva library from http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva1_0.31.0-1+sds8_i386.deb. This replaces your current libva1 with a newer version.  also works for me. Don't forget to install the -dev version (http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb) as well if you want to compile mplayer later.


6. Create a link of your video driver to the vaapi driver directory:
sudo ln -s /usr/X11R6/lib/modules/dri/psb_drv_video.so /usr/lib/va/drivers/

A. Precompiled setup. (You can alternatively skip to part B: compiling the source code setup)

7. Download and unpack the precompiled mplayer:

8. Install a normal mplayer and libmad with apt-get.
sudo apt-get install mplayer libmad0

9. Unpack mplayer and create necessary links to the libraries it expects.
"ldd mplayer" tells you what library (names) mplayer expects.
Just to go /usr/lib and create links to them:
e.g
ln -s libx264.so.67 libx264.so.65
This should work as long as your libraries are newer than the expected ones. It may actually work out of the box in Ubuntu Jaunty.

10. Start mplayer from the package you downloaded:
e.g. ~/mplayer-vaapi-20090914.i686/mplayer -fs -vo vaapi -va vaapi HDtest.avi

B. Compiling the Source Code

I've also manged to get the source code to work. This is less bothersome, because you need not link the libaries. Hence less man hours, but more disk space and computer hours for compiling. Didn't take as long as I feared, though. And it's using a slightly newer version of mplayer-vaapi, which includes some rudimentary OSD in vaapi mode now.

7. Install the build environment:

sudo apt-get build-dep mplayer
sudo apt-get install libdrm-dev
maybe: sudo apt-get -f install


8. Download the source at http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-20091106-FULL.tar.bz2. Unpack it and execute the checkout-patch-build.sh.

9. Check if it works, e.g.
mplayer -fs -vo vaapi -va vaapi ~/HDtest.avi

10.
sudo make install.

X. Done! Enjoy e.g. a nice HD trailer for a start! Post your results! I can recommend using it in smplayer for more comfort(e.g. automatically continue where you left of last). If it crashed, check out by blog entry about smplayer crashing in vaapi mode.

Update: It turns out deinterlacing not working is not due to VAAPI, but a limit in the psb driver. It works with the current iegd driver and other drivers from AMD and NVIDIA (press the D putton in mplayer I think). If I could just get one of those iegd drivers... Thanks Gwenole from splitted-desktop.com for answering my email and of course for writing the mplayer-vaapi patches in the first place! He seems to be the absolute VAAPI expert.

Also some experiments show that I can attach an external screen and watch videos with VAAPI on it. That means I should be able to actually use the netbook for decoding HD video and displaying it on an external screen. (But it does not work for me with except in mirror or single display mode.) Only thing missing now is a digital display port to connect a FullHD display... ;)

You might also be interested in Surround Sound and Battery Life
And I did get a USB surround sound card working wonderfully now. Also here's some advice I wrote on decreasing your power consumption.

X Video finally works - Poulsbo and Linux on the MSI Wind U110 - Fix for BUG: kernel NULL pointer dereference at 00000000

If you tried to get poulsbo to run on your system and you get a message like this, you should try the fix posted below.

"kernel BUG: unable to handle kernel NULL pointer dereference at 00000000" (2.6.28)
"kernel BUG: unable to handle kernel NULL pointer dereference at (null)" (2.6.31)

Thanks to a post on Ubuntu's bugzilla, the poulsbo video module now finally works on my MSI Wind U110 (full review & installation guide). Download the psb-kernel-source module You only have to comment out the two lines in intel_lvds.c starting with

if (edid)
....

e.g.
/* if (edid)
drm_add_edid_modes(output, edid); */

Then reconfigure the package and it should be recompiled. The next time you start it, it should work instead of creating kernel BUG

Update:
Xvideo actually works better than in Directx video in Windows XP, where I often see blocky video scaling. The CPU usage is not too high, either. Currently it's only working under Ubuntu 9.04 for me. Though I had managed to compile the module with kernel 2.6.30 before, I don't remember how I did that... And I haven't gotten actual video acceleration to work yet.

Of course I'll keep you updated and I'll post a little howto once it's all working. But feel free to ask, anyway. And thanks so much to the person from the Ubuntu bugzilla who helped me to finally get it all working!!!

Update2: Keep checking the page. I will post a link to an archive with a script that will manage the compilation in Ubuntu 9.10. If someone could help me figure out how to, I'd love to create, upload and post a .deb for dkms so it all works automatically... Or ultimately, we could modify the driver to check for the MSI's signature and then skip the edid check.

I've created a package for Karmic that you can use to manually install the driver with the fix already applied: http://www.megaupload.com/?d=BB23R7K2. Extract it and execute the script make_psb.sh, then reboot and try to modprobe psb. Let me know when the 10 downloads run out and it it works for you.

Update3: Here is a step by step howto. It explains setting up X and then VAAPI (hardware video decoding) in Kubuntu 9.10.

My script for making the psb module out of the package:

KERNEL=/lib/modules/`uname -r`/
make KERNELRELEASE="$(uname -r)" LINUXDIR="/lib/modules/$(uname -r)/build" DRM_MODULES=psb || exit 1;
sudo cp drm.ko $KERNEL/kernel/drivers/gpu/drm/drm.ko
sudo mkdir -p $KERNEL/updates/dkms
sudo cp psb.ko $KERNEL/updates/dkms/psb.ko
ls -l $KERNEL/kernel/drivers/gpu/drm/drm.ko $KERNEL/updates/dkms/psb.ko
sudo depmod -a

Linux System Hardening Done Professionally

I just took a short look at the measures Google took to harden their Chromium OS. But I must say, I was pretty impressed. It seems to be a very, very secure system.

Linux Boots Faster!

Check out this live video comparison at TuxRadar:

Kubuntu 9.10 is a Beauty

It works nicely on intel graphics (except GMA500!), installs fine and seems much snappier than the 8.10 I was still using. It's a definite upgrade recommendation, as well for your friends who are thinking about Windows 7. ;)

I'll let you know if I'll have any worries. But so far, everything has been wonderful. KMS works great, suspend-resume is fine, KDE 4.3 is lovely... :)

Good work guys!

More News on Intel and its GMA 500 under Linux

The LinuxJournal wrote two articles about the horrible Linux support for Intel's GMA 500 graphics chipset.
How to kick your friends in the face - GMA500
More on Poulsbo GMA 500 - Intel and the Community

Also see the Intel defending response.

Convert 1080i AVCHD directly to 720p avi with ffmpeg 0.5

With the realease off ffmpeg 0.5 there is much better AVCHD support in my experience, so you can use it for perfect conversions. You can download ffmpeg from ffmpeg.org and then use this script:

#!/bin/sh
# ffmpeg-avchd script by linux-tipps.blogspot.com
# to encode a directory use this command:
# for i in *.m2ts; do ffmpeg-avchd $i; done
IN="$1"; shift
OUT=$(echo $IN | sed 's/.m2ts//')-720p.avi
echo Encoding $IN to $OUT.
ff="ffmpeg -deinterlace -i "$IN" -acodec copy -vcodec libx264 -vpre normal -crf 25 -sws_flags lanczos -s hd720 -r 25"
echo $ff $OUT
nice $ff "$OUT"

The only thing I'm not really happy with yet is the deinterlacing and deshaking. I would like to use a sharper deinterlacer, but I guess I'd need mencoder for that. The Lanczos software scaler does make steady images pretty sharp already, though.

Why you're screwed with the Intel Poulsbo Chipset

Let me tell you why you're not only screwed when you want to run Poulsbo systems on Linux:

Intel does not only have bad support for Linux, it even excludes any email support, even for Windows for the Intel Poulsbo Chipset: "Intel does not support this product via email."
see http://supportmail.intel.com/scripts-emf/defaultlanding.aspx?productid=3180&srchidstr=39,1101,3180 and it seems does no longer supply driver downloads: http://downloadcenter.intel.com/NotFound.aspx?ProductID=3180&lang=eng. Ok, the last is wrong: http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&ProductID=3001&DwnldID=17992&strOSs=45&OSFullName=Windows%20XP%20Home%20Edition*&lang=eng

Now what other support options are there from Intel? Contacting your manufacturer often does not prove helpful either. MSI's support even seem aware that the Poulsbo chipset is supposed to have active video decoding acceleration. They inform that the Poulsbo chipset is not a high end chipset and you shall just disable video decoding acceleration in case it crashes your Windows system.

Considering the overal bad support for the Poulsbo chipset I can not recommend using it: No good Linux driver, no good Windows driver, DXVA announced but not working(not even in Windows), no email support, no Windows driver downloads, etc.

So I think: don't buy Poulsbo systems.

Intel advertises features it can't deliver and doesn't support the chipset. And it's really sad to bring out a chipset that won't be supported well until maybe 2010.

Update: I've finally managed to get poulsbo working on my MSI Wind U110 netbook. Check out the dirty hack and the details.

MSI Wind U110 Linux Review

The MSI Wind U110 netbook has an excellent basic design: The new generation Intel hardware is made for long battery life and the MSI can really make it over 9 hours under Windows. The MSI's are one of the few netbooks of this generation which include a nice and bright non-glossy display.

The keyboard is excellent and can from my experience be used immediately without any issues. I actually like it better than my external keyboard. The only problem here was the tiny "'" key. But that's only important for English text and I'm sure in the version they sell in English speaking countries the keyboard doesn't have that flaw.

So they only thing that might be seen as negative is the lower display resolution compared to some other new netbooks that have an 11.6" display. But their display is usually glossy and thus disqualified for really using it anywhere outside and also of course costs battery time.

But for Linux it looks much worse. While the Poulsbo chipset was already roughly supported in Ubuntu 8.04, which was released over a year ago, the support for Poulsbo is still at least flaky. It needs binary blobs to work anywhere near well as far as I have read.

And unfortunately it's not yet working on the MSI Wind U110 or U115 netbooks. You can normally get the chipset to work pretty well - with the appropriate resolution and at least some 2D acceleration, but no hardware video acceleration (aka VDPAU or VA-API).

But on the MSI's the support isn't working yet. You get the message that the there was a null pointer dereference when trying to load the psb kernel modules that is "necessary for the driver to work" as the Xorg driver tells you. Though I've read it might actually work on a certain SuSe distribution.

That unfortunately means that the netbook can not currently be used for Linux. A small display combined with a bad resolution will definitely lead to headaches. Linux users will either have to use Windows until sometime - hopefully - Intel fixes it's drivers (and maybe even includes a working VA-API support!).

What else I've checked worked fine: Sound, USB, Brightness Adjustments. I haven't tested standby enough yet, but I think there were still problems. But that may very well also be related to the graphics chipset. And as far as I've read the standby to ram works fine at least with certain BIOS versions.

The MSI U110 comes with one RAM slot, which held 1 GB ram in this case and is extensible to 2 GB. There is of course an internal card reader included. A microphone and a headset jack and a USB port, a VGA and a 100 Mbit LAN port are on the right side, two more USB ports, the energy plug, a kensington lock connection and a fan on the left side.

Summary: For now only for Linux experts who are either willing to debug and fix the kernel module or figure out how to get SuSe running on it or people who are willing to use Windows until the problems are fixed (supposedly that might happen by the end of this year). But it's a great netbook with lots of battery time, a nice display and a great keyboard. Perfect for writing blog entries or a large word document.

Once the graphics work, I'll try installing and running Linux from an SDHC card to see it that saves even more power. But right now with the vesa driver the power savings aren't that good. I wonder if they are better with the real driver.

What works&What doesn't
  • Grafics (works pretty well now!)
  • Sounds works (needs a fix in Ubuntu 9.10)
  • SD-Card Adapter works (it's generally not very fast, though)
  • Standby (works in Ubuntu 9.10)
  • CPU low power mode (works for me, reportedly doesn't work in certain configurations)
  • Grafics low power mode (?)
  • Sound low power mode (creates problems and had to be deactivated in 9.10)
  • Webcam works with uvcvideo after pressing the short cut (Fn-F6).
  • Ethernet works in 9.10 after plugging in the cable (ASIX AX88772 USB 2.0 Ethernet).
  • Wifi works out of the box in 9.10. Needs additional drivers in 9.04.
If there are any questions feel free to ask.

UPDATE: X video works nicely now. Finally!!! :)

I even managed to get to work vaapi hardware video decoding up to FullHD 1080i.

Sound does not always work without problems. In Karmic 9.10 you have to comment out
#options snd-hda-intel power_save=10 power_save_controller=N
in /etc/modprobe.d/alsa-base.conf.
options snd-hda-intel position_fix=1 bdl_pos_adj=64
instead helped me as well.

Suspend to RAM works fine with newer kernels from Ubuntu 9.10 and the psb module active. But I think it crashed when I tried to use vaapi after that. It did. But that's fixed with the newest BIOS version (the most current one on 01. June 2010) for me now.

I've run powertop on a full battery(half a year old) to test how low I can get the power usage in X with it.

PowerTOP version 1.11 (C) 2007 Intel Corporation

Cn Avg residency P-states (frequencies)
C0 (cpu running) ( 1.8%) 1.60 Ghz 0.4%
C0 0.0ms ( 0.0%) 1333 Mhz 0.2%
C1 mwait 0.0ms ( 0.0%) 1067 Mhz 0.6%
C2 mwait 0.2ms ( 0.0%) 800 Mhz 98.7%
C4 mwait 0.3ms ( 0.0%)
C6 mwait 9.6ms (98.1%)

Wakeups-from-idle per second : 103.4 interval: 15.0s
Power usage (ACPI estimate): 5.6W (10.3 hours)

Top causes for wakeups:
53.7% (126.9) : acpi
26.4% ( 62.3) : psb@pci:0000:00:02.0
11.2% ( 26.4) : hrtimer_start_range_ns (tick_sched_timer)
2.3% ( 5.5) : Rescheduling interrupts
1.8% ( 4.3) : extra timer interrupt
1.3% ( 3.1) : hrtimer_start (tick_sched_timer)

I think the psb driver is not highly optimized for low power consumption yet, but the biggest problem is the pretty high number of "acpi" interrupts. We can see that with neither ethernet nor wifi active, the netbook can reach over 10 hours of run time. And this is with a battery that already lost 10% capacity. We should be able to get this down a lot more by finding the cause for the acpi interrupts and with some optimizations, mostly in psb.

A Netbook for Linux

While most netbooks use common intel chips, some use the GMA500, which is yet badly supported for linux. An open source driver "may" be there in Q4 2009. But as the video decoding acceleration benchmarks show, it might be worth waiting for it. It's not only good, but also energy-efficient at decoding even HD material. The bad thing is though - there's at the moment no yet any well working Linux driver available. And you can't even know for sure it will ever come. If you're still interested, check out the MSI Wind U110.

Adjust Linux Network Receive Window for Fast Networks

Simply execute the following command in your shell to increase the receive window buffers. That should improve the performance, especially from servers with a high latency.
sudo sysctl -w \
net.core.wmem_max=1075200 \
net.core.rmem_max=1075200 \
net.ipv4.tcp_rmem="4096 87380 8388608" \
net.ipv4.tcp_wmem="4096 87380 8388608" \
net.core.rmem_default=1075200 \
net.core.wmem_default=1075200

Booting Linux over the Network

Here's a quick how to.

Refreshing Linux Group Rights

Maybe I'm mistaken, but I think there is no other way to let your system know that you e.g. are now member of another group than logging out and back in. And I'm wondering - why? Can it be so complicated? We can reload, refresh everything, but for that you'd have to log out, which is especially annoying in X...

But that' wrong! You can work around the problem with newgrp. The program updates the environment variables so you can immediately use the group, at least in the shell started via newgrp.

The Essence of Open Source

Imagine your computer breaks down. It doesn't power on anymore. Now imagine you're not allowed to open it and the only person who may fix it would be the producer. It would probably take weeks for you to send it in, get the machine fixed. That's if the error was found and it got fixed. And then it might end up being pretty expensive. Because there's a monopoly on the repairs.

That's exactly how closed source software works. And that's exactly why you should prefer open source software. The more important the software, the more important that it's open source.

Pretending a Package is Installed by Creating an Empty Package with Checkinstall (for Debian-based Distributions)

After installing ffmpeg from svn with checkinstall, I had the problem that the also installed library libavcodec51 is not compatible with the one delivered with Ubuntu. But I could not simply uninstall it so that the manually installed version was used because that caused problems with libxine1-ffmpeg, which stopped kaffeine, amarok and other software from running properly.

Unfortunately, checkinstall's --provides option did not work as expected. So I had to find a way to have them use the manually installed version I compiled from svn and hiding that fact that my package manager. I had to let the package management system know the package was already installed.

So I ended up creating an artificial package that only has the same name and a similar package version, but no actual contents. Create an empty directory, place the following Makefile into it and execute the following checkinstall command. You may need to adjust the parameters for different packages, refer to the output of apt-cache policy somepackage for an appropriate version number)
Makefile:

install:
install -d /usr/local/bin

checkinstall commands:
checkinstall --nodoc --install=no --pkgname=libavcodec51 --pkgversion=3:0.svn$(date +%Y%m%d)-12ubuntu5
checkinstall --nodoc --install=no --pkgname=libavutil49 --pkgversion=3:0.svn$(date +%Y%m%d)-12ubuntu5
checkinstall --install=no --nodoc --pkgname=libavformat52 --pkgversion=3:0.svn$(date +%Y%m%d)-12ubuntu5
sudo dpkg --install ./*.deb
sudo ldconfig


This elegantly fixed the error "ffplay: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd" and "ffmpeg: error while loading shared libraries: libavformat.so.52: cannot open shared object file: No such file or directory" for me.

Circumventing Censorship - Evading the "20th Century's Berlin Wall"

The New York Times presents the status quo in censorship evasion with examples of Iran and China. A quite interesting read. Don't expect a how to, though.

Mpeg Artifacts

I wonder why mpeg decoders always produce artifacts (bad blocks) when decoding a stream with errors. Shouldn't there be a much better way to handle stream errors? What about discarding the block, there should only be a little glitch then instead of a completely bad block.

The other, more difficult option would seem to be to try to find a block that would match the crc and replace the bad block with it.

At least the current situation seems to be less that optimal.

It seems a similar idea has already been patented: "(WO/2004/028160) DETECTION AND REPAIR OF MPEG-2 CHROMA UPCONVERSION ARTIFACTS"

How to Fix "symbol lookup error: ... /lib/libavcodec.so.52: undefined symbol: av_gcd" after installation of ffmpeg

It's actually quite easy once you know what's causing the problem. There are two different versions of libavcodec in your system. In my case I installed a fresh ffmpeg from SVN, now I first had to remove the package "libavcodec51". Then everything worked just fine.

sudo apt-get remove libavcodec51


If you still have problems there might be stale libraries in here: /usr/lib/libavcodec.*. Try moving them somewhere else and see if that helps. Otherwise, send me a comment. ;)

See here for a more elegant work-around that tells the package manager we've got newer libraries available.

Btrfs' Hot New Features

Check them out at Linux Mag.

Intel Graphics Users: Don't Upgrade Your Ubuntu

As phoronix points out, the intel driver woes in the newest Ubuntu version 9.04 are so bad, you should probably skip this distribution upgrade... and wait for 9.10.

Update: Here is some advice if it's already too late for you. Check the H for more information.

Mount a Partition from inside a Disk Image

You need sfdisk and losetup.


sfdisk -l -uS disk_image.raw
# look for the start sector of the partition, e.g. 2

mount -o loop,offset=$((2 * 512)) disk_image.raw /mnt
#mount the partition to /mnt (replace 2 with the output from sfdisk)


You could of course also use kpartx to create special device files for the partitions.

Some useful CLI Commands

Tuxradar has put up a nice list of useful CLI commands and other tipps. For tip #36 to work in KDE 4, you need to type e.g. =4*5+4. I also recommend tip #49, locate will help you find the file, for me it was /etc/openoffice/sofficerc.

A List of Default Passwords

can be found here:http://www.phenoelit-us.org/dpl/dpl.html

DoS in Linux Server with Boinc

For kernels earlier than 2.6.29 tasks with SCHED_IDLEPRIO creating children such as boinc can freeze the entire system. The bug seems to be in the Linux scheduler: a process with idle priority can block the entire system (with *really* bad latency). It seems to me that if you use ionice, that will make it almost impossible for other tasks to do io (e.g. access the hard drive).

The workaround for boinc is not to use schedtool's SCHED_IDLEPRIO:
Edit /etc/default/boinc-client and set to SCHEDULE="0". E.g.
echo SCHEDULE="0"|sudo tee /etc/default/boinc-client

You can also deinstall schedtool and ionice for now, though that won't fix the security issue. Affected Systems include Ubuntu Server 8.04 with all updates. But many other systems are likely affected if the fix has not yet been backported (fixed in 2.6.29).

Amazon MP3

Amazon's MP3 Service does it right and brings support not only for Windows and Mac OS X, but also for all major Linux distributions including Debian, Ubuntu and Fedora and SUSE. You can try it now and download This Much is True by Amy MacDonals for free. It worked flawlessly for me. The Amazon downloader is about 1 MB and needed roughly 6 MB dependencies on my system. It's not open soured thought and I think it's only available for i386.

Browser Privacy Package: Disabling Flash Cookies, Google Analytics and Google Ads tracking

Flash cookies are a way to identify you even if you disabled your browsers identification and even all your cookies. Here's a guide how to disable flash cookies. Basically it deletes ~/.macromedia and creates a symlink to /dev/null instead. :) I suggest to delete .macromedia/Flash_Player and symlink that to /dev/null. That way it won't interfere with other macromedia software.

You can see what cookies are already installed with e.g.
find ~/.macromedia -iname '*.sol'
strings .macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/#skype.com/settings.sol# helps to see what's inside the cookies.
You probably also want to disable or restrict google's cookies. And you might want to opt out of Google Analytics. A quick overview and opt-out page for the other large advertising group's cookies
is also available.

Also check how to disable Facebook tracking you on other websites. And you may just want to install the Chrome AdThwart extension.

The just released Flash 10.1 supports a mode without flash cookies if your browser supports a private surfing mode and Flash is compatible with your browser's setting. I think that's mostly Firefox.

Make your Firewall Safer with Knockd

Here's a nice howto. It describes how to install, configure and test knockd.

Linux Kernels 2.6.24 - 2.6.29 Benchmarked (Phoronix)

I've read the newest Phoronix benchmark of all kernels 2.6.24 through 2.6.29 and if you don't follow the link now, I'll spoil it for you in the next paragraph...



Okay, so besides some normal fluctuations there is a significant speed gain for OpenSSL (+99%) and the OpenCL-backed Graphicsmagick (up to +73% and +80%) and a regression in 7-zip compression (-27%).

Wow - fascinating stuff. I wonder how much potential kernel code optimization has. I still remember the extreme difference between 2.4.x and 2.6.x. I had just bought a new computer because my old one was... getting old. And I felt completely cheated. The new kernel had brought me much more increase in responsiveness and "felt performance" than the new computer (AMD Duron 700 Mhz -> Athlon XP 2500+). If I could I probably would've brought it right back to the store. Well, they don't take returns on self-build computers here.

I really wonder how much difference the intel compiler compiled kernel makes in comparison to gcc. Maybe Phoronix could compare that one, too? Oh yeah "... boost up to 40% for certain kernel parts and an average boost of 8-9% possible" quotes LJ.

Debugging Alsa HDA Audio

If you're using the snd-hda-intel module and you've got audio problems, you might want to try out manually using a specific model, the list is in e.g. patch_realtek.c:
11687 static const char *alc268_models[ALC268_MODEL_LAST] = {
11688 [ALC267_QUANTA_IL1] = "quanta-il1",
11689 [ALC268_3ST] = "3stack",
11690 [ALC268_TOSHIBA] = "toshiba",
11691 [ALC268_ACER] = "acer",
11692 [ALC268_ACER_DMIC] = "acer-dmic",
11693 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11694 [ALC268_DELL] = "dell",
11695 [ALC268_ZEPTO] = "zepto",
11696 #ifdef CONFIG_SND_DEBUG
11697 [ALC268_TEST] = "test",
11698 #endif
11699 [ALC268_AUTO] = "auto",

e.g.
sudo modprobe -r snd-hda-intel; sudo modprobe snd-hda-intel model=test


See here for more.

Automatic Backups on Linux (IBM)

Darn them. They just wrote the article I was planning to write and get famous with: Automatic backups over SSH with Keychain and Scp... well, I suggest to use rsync instead. That way it's fast enough to regularly run over internet without even using a lot of bandwidth. (See "Tiny Backup Script with Rsync" under "You might also like".)

By the way, look at their crontab:
34 3 * * * /home/backups/remote_db_backup.sh
34 20 * * * /home/backups/remote_db_backup.sh

Could've simply written:
34 3,20 * * * /home/backups/remote_db_backup.sh

"Never use the second pass encoding again" - Using 'Constant Ratefactor' Instead of Average Bitrate in x264

Okay, I may not be able to completely fulfill that promise, but you will most likely be saved from the second pass and thus a lot of encoding time quite often with this tip. If you don't need the resulting file to e.g. fit on a CD, Constant Ratefactor aka Constant Quality is probably perfect for you. Let me supply you with a quick overview and my quick mencoder script that does the job.

Did you know you can use a roughly vorbis-like quality selection, constant quality crf even in x264? This will save you a lot of encoding time with more or less the same quality. Or maybe not? Well it will look different, but it should be fine. For x264 a range of 18-26 is recommended. The higher the number the lower the bitrate and thus the file size will be.

Nice! Finally I don't need to adjust and calculate bitrates myself anymore! The algorithms really seem to work, because when I now change the codec settings to more efficient ones (e.g. increase the frameref, subq or enable mixed_refs) the quality (SSIM) remained pretty similar, while the bitrate sank.

Some experience with the parameters: The mixed_refs parameter did regularly increase the SSIM for me, but also took a lot more time to encode. Frameref=2 increases the efficiency with little performance impact in my experience. I wonder why it's not the default. Bframes decrease the quality slightly but shave a lot off the bitrate and even increase performance a bit for me.

Let me show you my "quick" example script for mencoder.
#!/bin/bash

CRF=23.5 # 21-26 recommended, the higher the smaller the resulting file, see http://mewiki.project357.com/wiki/X264_Settings#crf

INPUT="$1"; shift
X264OPTS="$1"; shift
OUT=`basename "$INPUT"`"-x264.avi"
echo Encoding $INPUT to $OUT

mencoder="time nice /usr/bin/mencoder -quiet -cache 16384"
enc="$mencoder -ovc x264 -oac copy -x264encopts crf=$CRF:trellis=1:frameref=2:bframes=2:8x8dct:psnr:ssim:$X264OPTS"
# I suggest nr= of no more than 2 or 3 with current x264 from svn.
# something along the lines of -vf
# eq=contrast=20:brightness=2,hue=saturation=1.25 for bleak videos
# denoise3d for noisy and unsharp=l:3x3:1.045 for blurry videos.
# I recommend to try out the result with mplayer first.
# A combination of all may work well, too.

echo $enc -o "$OUT" "$INPUT" $*

[ -f "$OUT" ] && echo File exists && exit 1;

$enc -o "$OUT" "$INPUT" $*

# You can call the script like this:
# script.sh input [x264encopts] [mencoder parameters]
# $ sh menc.sh somefile.mpg "interlaced" "-vf crop=..." or
# $ sh menc.sh somefile.mpg "" "-vf crop=..." or simply
# $ sh menc.sh somefile.mpg
# to get the right crop settings try $ mplayer -vf cropdetect


Feel free to get out the flame thrower - or just make some productive comments.

How To: Comfortably Make your own WINE Bottles

If you're installing a few programs in WINE, you may notice that they tend to influence each other negatively. The fix is to install them in completely different operating system environments, also known as WINE bottles. This way it's easy to completely remove applications by just deleting their "bottle". Let me show you how to make this effortless with standard WINE and a simple shell script.

The script is the key part. You tell it a directory where you want your bottles installed and then it will create a new folder each time you install a program. Of course you may also install several programs into one bottle. Let's call the script wine-bottle, which I suggest to put into your $PATH:

!/bin/bash
# wine-bottle v. 0.2
# (c) 2009 Linux-Tipps.blogspot.com, (c) 2009 Joost @ http://home.student.utwente.nl/j.vanderhof
# newest version at http://linux-tipps.blogspot.com/2009/03/how-to-make-your-own-wine-bottles.html
# published under the GPL v. 3.0 http://gplv3.fsf.org/
INSTALLDIR="$HOME/.wine/bottles"; #Set this to where you want to put your Wine bottles
[ $# -lt 1 ] && #if you gave no parameters
echo "Please give me parameters! Usage:" &&
echo "Execute a program : $0 \"BottleName\" \"Program\"" &&
echo "Configure a bottle : $0 --conf \"BottleName\"" &&
echo "List bottles : $0 --list" &&
exit 1;
[ $# -lt 2 -a $1 != "--list" ] && #if you didn't give the right parameters
echo "Please give me at least two parameters or a --list parameter! Usage:" &&
echo "Execute a program : $0 \"BottleName\" \"Program\"" &&
echo "Configure a bottle : $0 --conf \"BottleName\"" &&
echo "List bottles : $0 --list" &&
exit 1;
[ $1 == "--list" ] && #if you want to list the bottles
echo "Wine bottles in $INSTALLDIR:" &&
ls -1 $INSTALLDIR &&
exit 1;
[ -d "$INSTALLDIR" ] || ( #if installdir is not existing
echo "Root of Wine bottles not existing: $INSTALLDIR" &&
mkdir "$INSTALLDIR"
) || ( #if installdir creation failed
echo "Could not create installation Directory: \"$INSTALLDIR\"." &&
exit 1);
which wine || ( #if wine is not found
echo "Wine not found, please install it first" &&
exit 1);
[ $1 == "--conf" ] && #if you wish to configure a bottle
WINEPREFIX="$INSTALLDIR/$2/" winecfg &&
exit 1;
#finally, the only remaining possibility is you want to run an application
PREF="$1";
shift; #drop first parameter to leave the command with its parameters
WINEPREFIX="$INSTALLDIR/$PREF/" wine "${@}";

You can now use this script almost like wine. The only difference is that you first need to tell it the bottle's name. E.g. wine-bottle lingopad setup.exe installs the program inside setup.exe into the bottle lingopad. I suggest using the "create Desktop short cut" option of installers, as it lets you easily start them later, without the need to use this script.

If you want to create a backup of your bottle, simpy put the bottle directory inside $INSTALLDIR together with the related .desktop file into an archive. If you want to manually start a program, you can of course still use wine-bottle from the shell: e.g. wine-bottle lingopad "$HOME/Wine/lingopad/drive_c/Program Files/Lingopad/Lingopad.exe".

You may also want to install a current wine via the wine ubuntu repository.

Let me know if you liked this howto!

Update: Updated to Joost's version, thanks!

Update2: It seems my script has inspired "Joost". He's created a version including a simple GUI. Check out his website.

Fixing XRANDR Caused High Latency with KDE4 - Display Flickering - Freezing Videos

If you're using KDE4 you might be disappointed by a bug that causes high latencies and or a flickering (second) display. Here's a really easy explanation how to permanently fix that right now.

Go to System Settings, Advanced, System Services.


Then in the bottom uncheck "Detecting RANDR (monitor) changes", then press Stop on the bottom right. The problem disappears immediately now.

You may read more about the bug here and here. Thanks to Electricroo for the fix. By the way, you know you have this bug, if DDC EDID probes ("(II) intel(0): Printing DDC gathered Modelines, (II) intel(0): EDID vendor") keep showing up in tail -f /var/log/Xorg.0.log and you know it's fixed once they disappear. If you don't have that message in your X log, your most likely don't have this issue.

Note that this will stop KDE from automatically detecting when you plug in an external monitor. But as the configuration doesn't yet work well anyway I think there's no detriment. And of course there will be other causes for latency, but this one was the only real problem for me.

Update:
Unfortunately it seems like the fix does not (currently) work for KDE 4.2. If you don't find the service in the list in KDE 4.1.x, this might be a good sign and show that it's already disabled. If you still find the messages in Xorg.0.log, the please post a comment and let's try to find a way around it. If there's no way to disable it, all you can do is file a bug for your distribution and refer to the here mentioned information.

The bug has already been reported for KDE 4.1 at the kde bugzilla. Please participate there if you see this problem in KDE 4.2. You might also help to get a fix by voting for it. Until that time you can probably use my previously posted dirty hack that works around the kde session management service (ksmserver) by starting the KDE4 environment manually - please let me know if this works for KDE 4.2 as well.

You can also try to manually disable all outputs you don't need in Xorg, but the instructions vary significantly between different graphics cards, setups, distributions etc. And of course that won't help you if you're using a dual screen setup. If you find instructions on how to do that, please let me know in the comments.

Update2:
For KDE 4.2, check your config file:
grep polling ~/.local/screen-configurations.xml
If it says polling false and after upgrading KDE to 4.2 you suddenly get the messages described above in Xorg.log, especially if the fix above worked for you before, then there's a bug somewhere in KDE. If you get polling true, you can try to reconfigure KDE to make it stop polling. (You can just edit the file and change true to false.)

Related: Automatically switch to connected External Display on Boot with XRandR shows you how to automatically set up your displays without just a single screen, so that you can disable xrandr.

I'm a Linux

Check out these "Linux Ads":




A cool French one:


One from Novel:


And what's your problem:


By the way, you should also have a look at this one(not in the competition).

New Look

I've just changed to Layout. I thought the old one was a tad too boring for the KDE 4 era. :)

Let me know if you like it in the comments!
(alternatively: works=I like it, doesn't work=don't like it.)

Parted Magic - A great bootable Linux CD for exhaustive Partitioning and Backups

Parted Magic doesn't only come with a fresh graphical parted and partimage, Testdisk, ext3grep and support even for reiser4 and ntfs-3g, but also with Firefox, XChat, LXDE. I simply but the 80 MB image on my boot partition and (next to knoppix) on my USB stick so I can start it out of grub if I need to.

Rescue Important Data with ddrescue

ddrecue is better than dd, dd_rescue or dd_rhelp if you want to (try to) backup what's possible from a broken (hard or compact) disc. It creates a log file and which lets you continue interrupted backups. If you try to backup a broken cd or dvd it might help to use different dvd drives to try to read the disc.

Don't let it run over night or you might end up with an exhausted dvd drive that doesn't really want to read anything any longer.

How the Linux Kernel Works

Tuxradar has a great article entitled "How the Linux Kernel Works". Great for beginners!

How to Remove Grub from your Boot Sector(MBR) but keep the Partition Table

It's one really easy command, if you know what it is ;)
sudo dd if=/dev/zero of=/dev/XXX bs=446 count=1

That helps you to remove any boot sector from that device, e.g. sda. But make sure you've got a boot sector somewhere! I can recommed installing grub to a USB stick for backup purposes.

How To Add Knoppix to your USB Stick

If you've got a large USB stick, there's a high chance you will have some space left for installing a current Knoppix on it. That way you can save a few CD-Rs as you need not write a new CD when a new Knoppix comes out.

Install Daily Fresh Ubuntu Directly over the Web

If you're doing a fresh installation and you don't have a CD downloaded yet, I can recommend the netboot installer. It let's you download and install the freshest packages from a mirror near you. All you need as preparation is e.g. a USB-Stick that boots into grub. Checkout this howto.

Basically all you need to do is copy the kernel "linux" and the initrd "initrd.gz" to your stick. Then boot them from Grub and you can start your installation.

The great thing about it: During the installation you can chose whether to install Kubuntu, Xubuntu, Ubuntu, etc. And you will automatically get the newest available packages right away. There's no need to fetch and install updates after the installation.

And getting the newest packages right away might save you a lot of trouble because of bad packages in the installation cd. And the network installer itself also gets updated regularly.

Extensive List of Great Ubuntu Repositories

The I been to Ubuntu blog just posted a great and extensive list of excellent Ubuntu repositories.

I especially recommend medibutu: (mplayer, codecs, etc.)
deb http://packages.medibuntu.org/ intrepid free non-free
(install the medibuntu-keyring package)

Wine:
deb http://wine.budgetdedicated.com/apt intrepid main
install the key:
wget http://wine.budgetdedicated.com/apt/Scott%20Ritchie.gpg -O - | sudo apt-key add -

Opera:
deb http://deb.opera.com/opera/ stable non-free

VLC:
deb http://ppa.launchpad.net/c-korn/ubuntu intrepid main

and Google: (Picasa, Google Earth, etc.)
deb http://dl.google.com/linux/deb/ stable non-free
deb http://dl.google.com/linux/deb/ testing non-free # for beta versions like picasa 3
wget https://dl-ssl.google.com/linux/linux_signing_key.pub -O - | sudo apt-key add -

There's a great way to install the missing keys: E.g. for Opera just use this command:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 033431536A423791
Replace the number with the one from the error message on sudo apt-get update (without the leading "0x")

Or all in one:
/etc/apt/sources.list.d/custom.list:
#medibuntu
deb http://packages.medibuntu.org/ intrepid free non-free
#wine
deb http://wine.budgetdedicated.com/apt intrepid main
#google
deb http://dl.google.com/linux/deb/ stable non-free
deb http://dl.google.com/linux/deb/ testing non-free
#opera
deb http://deb.opera.com/opera/ stable non-free
#vlc
deb http://ppa.launchpad.net/c-korn/ubuntu intrepid main

And then the keys:
wget https://dl-ssl.google.com/linux/linux_signing_key.pub -O - | sudo apt-key add -
wget http://wine.budgetdedicated.com/apt/Scott%20Ritchie.gpg -O - | sudo apt-key add -
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 033431536A423791
(...)

What packages are installed in Debian/Ubuntu

Howtoforge has a nice article on how to install the packages you've installed on another computer. It's written for debian and ubuntu systems, including step by step screen shots for doing it in Ubuntu with Synaptic. Here's how you can do the same thing in CLI(also in that article):

sudo dpkg --get-selections "*" > package_list
and
sudo dpkg --set-selections < package_list && sudo apt-get -u dselect-upgrade

Oh and from the article's comments: The method only works well if you use the exact same version of Ubuntu on both computers. Let me add that it only works at all if you have the same /etc/apt/sources.list and sources.list.d/* files on both computers.

Flashing your BIOS with a bootable CD

Here's a quick howto. I think it would probably be much easier if you'd just use a 2.88 MB floppy image which I think is supported as well. Also be aware that flashing your BIOS from a CD is not supported by most vendors and thus might even void your warranty. But hey, at least you won't need to install Windows.

Against Intellectual Property

Being a Linux fan you might be interested in this book(free pdf download) of two economists, which explains why they think intellectual property is often the wrong choice.

Fixing Grub Boot Problems

If your system doesn't boot anymore, because grub was overwritten, you installed windows, or you installed a second hard driver, etc. check out this wiki from the makers and users of the super grub disc.

Google and Privacy Part Two: Ad Privacy Settings

I've already written about the Google Ad Cookie Opt-Out. Now Google is introducing even more personal tracking of your private information. Here you can change your google ad tracking settings and chose to prevent Google from tracking your preferences. There's also a plugin that ensures that the tracking remains deactivated even if you delete your cookies.

Both links will stay available in the links section on the right hand side.

Automatically switch to connected External Display on Boot with XRandR

I bought a notebook to be flexible, but when at home I use it with external monitor, keyboard and mouse to be comfortable. Now the problem was that I couldn't tell Ubuntu I want to only use the external monitor - if it's available.

Well, I've written a one-liner that fixes that problem. If the external display is attached, it will automatically switch over to it and display the internal display. Otherwise it boots normally (leaving the internal display enabled).

I put the script into the Xsession.d directory so it gets started for every user on boot: /etc/X11/Xsession.d/98vgaonly and made it executable.

The actual script line is this:
xrandr -q | grep 'VGA connected' && xrandr --output LVDS --off --output VGA --auto
It checks if the line 'VGA connected' was found in xrandr's query and then asks your X server to turn off the internal output and use the external one with automatic resolution detection.

So to automatically switch to a connected VGA during boot just execute:
echo 'xrandr -q | grep \'VGA connected\' && xrandr --output LVDS --off --output VGA --auto' | sudo tee /etc/X11/Xsession.d/98vgaonly && sudo chmod a+x /etc/X11/Xsession.d/98vgaonly


You may have to change the name of the outputs for your setup. xrandr -q will let you know what's available. It would probably be possible to somehow call this script automatically when plugging in a monitor, but I've not figured out how. xrandr only works when called from inside the running X session in my experience.


If you want to know more about XRandR, check this recent article.

Any comments are welcome!

Why we shouldn't trust Google

Danielweb explains quite well why there might be other priorities for Google than your privacy. I wish to add government policies to that list, as already in China and Europe and soon possibly everywhere.

Fixing common Linux Problems

Techradar has a nice little introduction on the subject, covering grub, drivers, X graphics and lots more.Link

Testing the Development Kernel in Ubuntu

Testing the bleeding edge development kernel from Linus' git tree has never been easier. You can now download precompiled debian packages for the current release candidates from the Ubuntu kernel ppa.

Debugging a program whose user has no shell by the example of Mldonkey

When the mldonkey package in debian/ubuntu does not work properly you may very well end up without any error messages in all log files. When you try to login as user mldonkey to start it manually, that won't work either, because it doesn't have a shell. So what to do?

It's actually quite straight forward: You supply a shell manually when changing to user mldonkey: sudo su mldonkey -s /bin/bash
Then you simply cd ~; mlnet
And it should print out some error message. For me it complained about downloads.ini.tmp being in the directory and exited.

Use your ssh-agent for cron scripts with keychain

Here's a great IBM howto explaining how to use your ssh-agent for cron scripts with keychain.

Related: Copy your public SSH-Key to another Computer.

Resumable, fast and efficient hard disk data recovery dd_rhelp

dd_rhelp is a script that uses dd_rescue, but includes a log file and parameters to automatically read all the good blocks first and skip the bad ones. And it automatically resumes where you left off when it's interruped.

Grub Error Codes

If you want to know what the grub error codes mean, look here:

1 : Filename must be either an absolute filename or blocklist
This error is returned if a file name is requested which doesn't fit the syntax/rules listed in the Filesystem.
2 : Bad file or directory type
This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO.
3 : Bad or corrupt data while decompressing file
This error is returned if the run-length decompression code gets an internal error. This is usually from a corrupt file.
4 : Bad or incompatible header in compressed file
This error is returned if the file header for a supposedly compressed file is bad.
5 : Partition table invalid or corrupt
This error is returned if the sanity checks on the integrity of the partition table fail. This is a bad sign.
6 : Mismatched or corrupt version of stage1/stage2
This error is returned if the install command points to incompatible or corrupt versions of the stage1 or stage2. It can't detect corruption in general, but this is a sanity check on the version numbers, which should be correct.
7 : Loading below 1MB is not supported
This error is returned if the lowest address in a kernel is below the 1MB boundary. The Linux zImage format is a special case and can be handled since it has a fixed loading address and maximum size.
8 : Kernel must be loaded before booting
This error is returned if GRUB is told to execute the boot sequence without having a kernel to start.
9 : Unknown boot failure
This error is returned if the boot attempt did not succeed for reasons which are unknown.
10 : Unsupported Multiboot features requested
This error is returned when the Multiboot features word in the Multiboot header requires a feature that is not recognized. The point of this is that the kernel requires special handling which GRUB is probably unable to provide.
11 : Unrecognized device string
This error is returned if a device string was expected, and the string encountered didn't fit the syntax/rules listed in the Filesystem.
12 : Invalid device requested
This error is returned if a device string is recognizable but does not fall under the other device errors.
13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
14 : Filesystem compatibility error, cannot read whole file
Some of the filesystem reading code in GRUB has limits on the length of the files it can read. This error is returned when the user runs into such a limit.
15 : File not found
This error is returned if the specified file name cannot be found, but everything else (like the disk/partition info) is OK.
16 : Inconsistent filesystem structure
This error is returned by the filesystem code to denote an internal error caused by the sanity checks of the filesystem structure on disk not matching what it expects. This is usually caused by a corrupt filesystem or bugs in the code handling it in GRUB.
17 : Cannot mount selected partition
This error is returned if the partition requested exists, but the filesystem type cannot be recognized by GRUB.
18 : Selected cylinder exceeds maximum supported by BIOS
This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB in general).
19 : Linux kernel must be loaded before initrd
This error is returned if the initrd command is used before loading a Linux kernel.
20 : Multiboot kernel must be loaded before modules
This error is returned if the module load command is used before loading a Multiboot kernel. It only makes sense in this case anyway, as GRUB has no idea how to communicate the presence of such modules to a non-Multiboot-aware kernel.
21 : Selected disk does not exist
This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system.
22 : No such partition
This error is returned if a partition is requested in the device part of a device- or full file name which isn't on the selected disk.
23 : Error while parsing number
This error is returned if GRUB was expecting to read a number and encountered bad data.
24 : Attempt to access block outside partition
This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk or a bug in the code handling it in GRUB (it's a great debugging tool).
25 : Disk read error
This error is returned if there is a disk read error when trying to probe or read data from a particular disk.
26 : Too many symbolic links
This error is returned if the link count is beyond the maximum (currently 5), possibly the symbolic links are looped.
27 : Unrecognized command
This error is returned if an unrecognized command is entered on the command-line or in a boot sequence section of a configuration file and that entry is selected.
28 : Selected item cannot fit into memory
This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won't fit into memory or it is simply too big.
29 : Disk write error
This error is returned if there is a disk write error when trying to write to a particular disk. This would generally only occur during an install of set active partition command.
30 : Invalid argument
This error is returned if an argument specified to a command is invalid.
31 : File is not sector aligned
This error may occur only when you access a ReiserFS partition by block-lists (e.g. the command install). In this case, you should mount the partition with the `-o notail' option.
32 : Must be authenticated
This error is returned if you try to run a locked entry. You should enter a correct password before running such an entry.
33 : Serial device not configured
This error is returned if you try to change your terminal to a serial one before initializing any serial device.
34 : No spare sectors on the disk
This error is returned if a disk doesn't have enough spare space. This happens when you try to embed Stage 1.5 into the unused sectors after the MBR, but the first partition starts right after the MBR or they are used by EZ-BIOS.

Ext3 Partition Optimized for RAID5

Check the output of mdadm. It tells you the block size in chunks, which you will need.
mke2fs -j -E stride=64,stripe-width=320 -L LABEL /dev/md0

In my example the chunks size is 64k. I use 6 disks, out of which 5 carry data, so the stripe-width is chunks*5=320. See man mke2fs for more.

I always add this for even more speed:
tune2fs -o journal_data_writeback -O dir_index /dev/md0

Refresh the Partition Table

sudo blockdev --rereadpt /dev/sda

First make sure nothing is mounted from the disk (here /dev/sda).

Fast interlaced AVCHD (PAL) conversion with Mencoder-SVN

Thanks to a Urkki, I've found out that mencoder-SVN nowadays supports AVCHD transcoding pretty well now. So I'll publish my current (quite easy) script for converting AVCHD into 720p Mpeg4.

First get a current svn version of mplayer and compile and install it:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
CFLAGS= ./configure && make && sudo make install

Then you can use this command:
mencoder 00001.MTS -o 1.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000:threads=2:ilme:ildct -lavdopts threads=2 -vf scale=1280:720:1 -fps 50

Notes
- I need fps 50 because mplayer doesn't yet detect the fps automatically in my files.
- I've used two threads to speed things up on multi-core systems: threads= should be the number of cores your cpu has.
- I have interlaced content and preserve the interlacing: scale=...:1, ilme:ildct.

Copy your SSH Public Key to Another Machine with One Simple Command

ssh-copy-id user@host

KDE 4.2 - Fresh, Hot, Pretty, Efficient - A Release to Enjoy

I've seen quite few real reviews of KDE 4.2 so far. Let me show you a screen shot and begin with my summary: It's a great release.

Plasmoids
The core, no actually every part of the KDE4 desktop consists of plasmoids, little applets comprising parts of the desktop: The menu, the panel, the clock, desktop applets such as wheather and disk space, network and CPU usage displays, news overviews and many more are already included.


After some problems with achieving the high goals of a flexible interface the developers have by now achieved much. You can put the plamoids anywhere on your screens. I have two displays and really enjoy being able to setup each display with its corresponding plasmoids. I really enjoy the prettier new taskbar and the new style. You can now move plasmoids from the panel to the desktop and back, but that's not easy yet.

Platforms
I don't know about the OS X port, but my girl friend is already enjoying the Windows port of KDE including great applications such as Parley in a native Windows build. And they work more or less flawlessly. I think the sounds support was not perfect, but everything else works nicely and the installer is pretty simple to handle while remaining flexible. (It's not easy enough yet that she could install it herself, though.)

Stability
As it's a .0 release, you will definitely be able to crash plasma. Probably during the tryouts for setting up your plasmoids. I recommend quitting and restarting plasma after you've got your basic configuration done with kquitapp plasma && plasma &. Then continue with the fine tuning.

Upgrade
KDE used 4.2 my previous(4.1.4) configuration successfully. Even my applets were still there at the same place. That's a nice thing and I think between 4.0 and 4.1 it didn't work well for me.

Bugs
The screen flickering problem disappeared for me. In KDE 4.1 my second screen kept going blank for about 1,5 seconds about every 10 seconds. I had to work around that bug by starting kde manually. That's solved now. I get one flicker during that startup of KDE but that's it.

Polish
There will of course be some polish in the 4.2.x releases. Some plasmoids are still buggy and can crash plasma. The weather applet crashed plasma if it didn't find the city I was searching for e.g. Sometimes removing an applet can crash plasma. But there are more practical plasmoids and they work better than in 4.1. The rss reader lets you scroll through with your mouse wheel, a memory usage applet is still missing.

Efficiency
You can see how efficient the plasma approach and implementation is when suspending your computer and then resuming it. The clock will take up to a minute to be set to the current time. That's because it gets the time only once a minute - when a new minute starts. That saves CPU usage in between and shows how much thought the programmers put into an efficient implementation. Even my desktop full of plasmoids uses only very little resources of my system. It doesn't slow you down. It even works nicely over NX (remote desktop). When idling, plasma creates about 1 wake per second in powertop on my system.

Porting Chrome back to KDE

Greg just had a great idea. Port the browser (Chrome) based on the browser (safari) that is based on the browser of KDE(konqueror) back to KDE again. Chrome coming home to KDE again would be a great thing. A native, fast browser that can really compete.

I think the code has been improved a lot since the beginning and as KDE is already running on Windows, OS X and Linux, it's an idea that Google probably could have followed from the beginning.

IMHO Google should the very least do everything to help the KDE community to achieve that port, as without them and KHTML they would never have come this far as quickly.

Online Video Chatting with a Flash Plugin

One of the fastest and easiest ways to video chat with someone is with the flash browser plugin. Here are several pages available:
- MeBeam
- feel free to post more in the comments!

Set the Default Sound Card in Ubuntu

If you have more than one sound card, you might want to set the preferred/default one:

You can find out the sound cards' names with
asoundconf list
and change the default one with
sudo asoundconf set-default-card xxx

Comfortable Internet TV on your Linux Box with Boxee

Now here's a company that did it the right way: The software is based upon the XBMC, is thus open source and released for Mac and Linux already while the Windows version is still in development :)
Boxee allows you to easily access popular channels such as BBC, Joost, MTV and Hulu. But right now their apt server is not working properly at all.
Btw. You need to register before you get the download address.

Multi-Threaded Bzip2 Compression

Did you know there's a (weirdly named) zipmt compression program that does only one thing: compress to bzip2 with multiple threads. Crazy that this is still not done automatically with the normal bzip2. You may also you parallel bzip2. The advantage of zipmt is that it can compress from standard input, which pbzip2 unfortunately does not. pbzip2 has the advantage that is can automatically detect the number of CPUs and adjust the cpu usage according to the current system/cpu load.

Backup your File System Better with FSArchiver

Interesting you hardly hear anything about the program. FSArchiver supports many important features, including multi-threaded compression and easy backup from one to another filesystem type. (E.g. from ext3 to btrfs).

The Web as a Picture

If your browser can't diplay a website correctly or your proxy is malconfigured, check out http://pici.picidae.net/.

Linux Video Contest: First Videos

You can now find the first videos posted for the Linux Video Contest.

Easy Open Source Web-Editor

If you're looking for an easy WYSIWYG web editor, komposer might be a good choice for you. It's available for windows, linux and mac.

War 2.0

Heise also informs us about the War 2.0 in Gaza (google translated).

Storm Botnet Cracked

Heise informs us that and how the Storm botnet has been cracked by German students.