New Intel Xorg Driver Released

It seems the intel driver in the Ubuntu repositories is still pretty old. You can download a new one from their website, though and install it manually.

I wish there was an updated package available for hardy. You can probably use the intrepid package again, though. It has version number 2.3.2. Then you can leave the EXA acceleration enabled without the related problems with e.g. Opera.

Fix for Memory Leak in Ubuntu's NetworkManager

The nasty memory leak in NetworkManager, existing since gutsy times I believe, is finally fixed in the intrepid packages. The bug fixed version 0.6.6-0ubuntu7 is not yet uploaded it seems, but should appear at the intrepid packages link soon.

Correction: The packages seem to be uploaded, but not shown on the linked webpage yet. So just replace ubuntu6 with ubuntu7 and can download it right now.

Second update: The fixed version is no longer available for download from official servers. The file names were network-manager_0.6.6-0ubuntu7_i386.deb and network-manager_0.6.6-0ubuntu7_amd64.deb.

I found the files at http://ubuntu.interlegis.gov.br/ubuntu/pool/main/n/network-manager/.

Just download them and then install them with e.g.
sudo dpkg -i network-manager_0.6.6-0ubuntu7_i386.deb

That fixed the problem just fine for me.

Read Copy Update Preemption

I switched on the RCU Preemption in the Linux 2.6.25.7 kernel and suddenly noticed stuttering video-playback in mplayer. Seems that sometimes it didn't get its data in time anymore. After I added the -cache 4096 parameter, it was fixed. But I really wonder how that could be, as there was nothing going on in the background.

b43 broadcom wireless driver

I really wish the b43 driver would work better... I keep losing the connection after a certain time. It is much better in 2.6.25.7 than in 2.6.26.6, but it's still disappointing to keep having to remove and reinsert the module to stay online. I'm really disappointed in Broadcom. The intel wireless drivers are a lot more reliable and obviously broadcom could do much more to ensure its hardware works well in Linux. The b43 team still does a great job at the open source driver for the seemingly pretty limited hardware. Still I guess if you want good Linux support, avoid Broadcom, prefer Intel or other Linux-friendly hardware manufaturers.

Better Process Monitoring with htop

htop is a much nicer alternative to top, as you can configure it much easier and more interactive. It also has bars for cpu, mem and swap usage for a better overview.

Locking your Screen with dbus from the command line in Gnome, KDE4 and others.

dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call \
--print-reply /ScreenSaver org.freedesktop.ScreenSaver.Lock


This will work with KDE4 and should as well work with newer Gnome versions. Tested with KDE 4.1 beta1. It needs the display variable to be set and be run as the appropriate user.
e.g. su $user -c "DISPLAY=:0 dbus-send... "

In Ubuntu 8.04 you can change your /etc/acpi/resume.d/90-xscreensaver.sh to lock the screen on resume like this:

#!/bin/sh

# now, we should poke xscreensaver so you get a dialog
#if pidof xscreensaver > /dev/null; then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
su $user -c "(xscreensaver-command -deactivate)"
su $user -c "dbus-send --session --dest=org.freedesktop.ScreenSaver \
--type=method_call --print-reply /ScreenSaver \
org.freedesktop.ScreenSaver.Lock"
fi
done
#fi

bios upgrade leads to resume problems

I could not resume from standby anymore after upgrading the bios on my notebook. Turns out I just had to reset the hard disk password in the BIOS settings. The BIOS somehow forgot to unlock the hard disk during resume after the update. Removing it and setting it again fixed the problem.

Finding dbus targets made easy

I have been looking for a tool to display dbus targets for a while...

It's called qdbusviewer and comes with the package qt4-dev-tools. I found it in this howto save your current session in kde4.

How to Help with Linux Kernel Development

"Please do contribute to Linux, and a great way of doing that is to test latest mainline or linux-next or -mm and to report on any problems which you encounter. 

Nothing special is needed - just install it on as many machines as you dare and use them in your normal day-to-day activities.

If you do hit a bug (and you will) then please be persistent in getting us to fix it. Don't let us release a kernel with your bug in it! Shout at us if that's what it takes. Just don't let us break your machines. 

Our testers are our greatest resource - the whole kernel project would grind to a complete halt without them. I profusely thank them at every opportunity I get :)"

(Andrew Morton, from the LinuxWorld interview. )

I recommend using the release candidates(-rcX), you can get them at www.kernel.org and report bugs at bugzilla.kernel.org. The nice thing is that this way you can make sure the next kernel will work on your system before it's even out. And you're usually not the only person who would suffer from these bugs of course.

Opera Speed running under Windows and Linux

I've installed Opera 9.5. It's really nice and I'm actually writing this entry with it right now. But then because of unfortunate resume problems after a BIOS upgrade with my Acer notebook, I've installed and tried the new version in Windows as well.

And frankly, I was amazed. The websites loaded so quickly it seemed they were just there immediately. Awesome work, Opera. But then I started wondering:

Why is Opera so much faster under Windows?

Compare Dmesg Output between boots

First remove the timing information from the dmesg with a sed Regular expression:

cat dmesg.txt| sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > dmesg-clean.txt

Of course you can skip this step if you care about the timing information.

Then compare two kernel boot dmesgs.

diff -y --left-column dmesg1.txt dmesg2.txt | less

And as a script:

#!/bin/bash
# published under GPL v. 3.0
# (c) 2008 linux-tipps.blogspot.com

cat "$1" | sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > DMESGCOMPARE-${1}.txt
cat "$2" | sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > DMESGCOMPARE-${2}.txt

diff -y --left-column DMESGCOMPARE-${1}.txt DMESGCOMPARE-${2}.txt | less

rm DMESGCOMPARE-${1}.txt DMESGCOMPARE-${2}.txt

Linux ACPI Issues

If you should ever get into problems with Linux ACPI, these kernel parameters might help you for a quick fix.

  • hpet=disable
  • nohz=off
  • acpi=noirq
  • acpi=ht
  • pci=noacpi
  • pnpacpi=off
  • noapic
  • nolapic
  • acpi=off
  • disable_8254_timer
  • acpi_os_name="Microsoft Windows" # Linux claims to be Win 98
  • combined_mode=libata # helped me with standby resume problems in Ubuntu
Also check out this ACPI debug page. And if the problem isn't already known, make sure to file a bug report.

Optimize PNGs

OptiPNG is a cool little program to optimize png graphics in size. You can further optimize the size with advpng from the package advancecomp.

E.g.

  1. optipng -q -o5 scummvm00000.bmp
  2. advpng -z -4 scummvm00000.png

901k bmp -> 40k png -> 36k png. Lossless.

And a script: 

#!/bin/sh

echo "ShrinkBMP v. 0.2 (c) 2008, published under GPL 3.0."

for i in $*; do

echo compressing $i...

optipng -q -o5 "$i"

PNG="`echo $i | sed s/bmp/png/ `"

advpng -z -4 "$PNG"

ls -l $i $PNG

echo ...done.

done;

echo All done: $* 

KDE4 Kwin Desktop Effects Howto

If you wonder, just as I just did, what the different options in the Advanced section of System Settings: Desktop: Desktop Effects: Advanced Options in KDE4 means, here is the answer:

  • OpenGL is the fastest solution as it uses your graphics card's 3d acceleration for rendering.
    • Texture from Pixmap is the fastest option, as it stores the texture directly in the graphics card's memory, which is usually faster than the system ram.
    • Shared Memory stores the textures in X's shared memory, which resides in the system RAM and is usually much slower than the graphics card's memory.
    • Fallback tries Texture from Pixmap first and Shared Memory if that does not work.
  • XRender is less fast as it only uses 2d acceleration but much more compatible and works with older graphics cards as well.

The other options:

  • Direct rendering passes the commands directly to the graphics card and bypasses the X server. This is much faster as it the commands have to be copied less, but can be more instable and less compatible.
  • VSync stands for vertical synchrosation and ensures that the pictures are drawn in sync to the vertical display updates. This can be more soothing to the eyes, but is a little slower and just drawing the frames any time the graphics card is ready to do so.

Opera+Intel X Shared Memory Problem Fixed

It turns out it is an issue in the X driver. Thanks to develcuy for the fix! You simply change the accelaration mode from EXA to XAA in the xorg.conf file:

in /etc/X11/xorg.conf

you insert in

Section "Device"
Identifier "Configured Video Device"
Option "AccelMethod" "XAA" # not EXA

It's also supposed to help with some memory issues. I will see if that maybe fixes my problems with plasma x shared pixmap cache I just posted about earlier. Even though its the older one of the two x acceleration infrastructures, the intel driver's support of it seems much more stable and fast.

Update:

It turns out there is a better fix for this issue, just upgrade to the newest driver package.

Update2:

The new driver package does not always fix the issue. I hope that these fixes will not be required for Kubuntu 8.10.

Plasma SHM Memory Leak + plasma Tip, kquitapp

It seems plasma leaks into x shared memory. This would explain why I had such a high value xrestop. After I restarted X it was down to only around 6 MB. It's funny but I don't even really notice these things anymore now that I have 2 GB RAM.

I wonder how many memory won't get noticed because developers have "too much" RAM in their developing systems...

By the way, if plasma constantly crashes for you and your settings get lost, you can just quit it with "kquitapp plasma", this saves its settings and then quits plasma.



Update: I've found a bug report on bugs.kde.org and it seems to be already fixed in SVN trunk.

Xorg growing bigger and bigger?

If you find out that Xorg grows bigger and bigger with time, chances are high that this is not actually Xorg, but a program that uses its pixmap cache.

xrestop will tell you just that. It lists the applications by how much pixmap cache they use. Mine starts with "" using about 226 MB(!), looking up the process id shows that "" stands for plasma! (Nice try at hiding, budddy!)

Crazy...

Ubuntu Remix

Check out the new Ubuntu Remix and its special user interface.

KDE4 Eye Candy

To use the KDE4 eye candy, you don't have to do much. You can activate the effects under System Settings and Desktop. Then you go to All effects and activate cover switch. I really like how it displays the windows while flipping through them with alt-tab.

You can also let it snow on your desktop, show stars around the mouse cursor, etc. And with a simple click you can add one of the high (and probably quickly increasing) number of kde4 plasma widgets, also known as plasmoids.

Plasma Development Resources

Thanks to some nice KDE developers I now have some more plasma development resources:

http://techbase.kde.org/Projects/Plasma

http://api.kde.org/4.x-api/kdebase-workspace-apidocs/libs/plasma/html/index.html

The panel-devel mailing list and irc: #plasma on IRC (irc.freenode.org).

I added them to the Plasma Tutorial wiki as well.

KDE Bugsquat

I just found out there is a KDE Bugsquat

Tracing System Calls

If you want to know what exactly a program is doing, e.g. to find out why it's using 50% cpu right now, you can use the strace command:

strace -r -fF -T -p `pidof someprogram`

As always, you can find out more about the usage with man strace. It often does not respond to Ctrl-C in my experience, which is why I often kill it. killall -QUIT strace

And it also often forgets to restart the program it traced, so try a killall -CONT  someprogram.

Phoronix Compile Benchmarks

  1. Processor: Intel Celeron M 530 @ 1.72GHz (Total Cores: 1) "2008..."
  2. Processor: Intel Celeron 2.60GHz @ 2.62GHz (Total Cores: 1) "compilation"
  3. Processor: AMD Phenom 9850 @ 2.50GHz (Total Cores: 4) "0001"
  4. Processor: Intel Core 2 T7200 @ 2.00GHz (Total Cores: 2) "comp"
Time in seconds, less is better of course. You can see a clear advantage of multiple cores for compiling. I wonder how it looks for audio encoding...

[fix] High Wakeups draining battery power with KDE 4.1 beta 1

There is some issue related to knotify4, which causes around 100 wakes / second to show up in powertop. It looks like there have already been issues with KDE 4.0.x and there has been improvements since. But it's still too much for notebook use.

The suggested fix is to turn off the notifications, which did not work for me, though. What worked for me was a good old killall knotify4. ;)

Better Bug Reports in English

If you get an error in a program and you want to report the exact error, but in English, this short line helps a lot

LANG= apt-get install xxx

KDE 4.1 Beta 1 Update

I just finished the very basic work of my first very own plasmoid. It's pretty fun and very low on resources. 

KDE4 still crashes a lot. Ktorrent crashed while exiting, When the main panel is removed, there is a crash. And when you put the panel back it doesn't stay there. It crashes every time on logout then as well.

But it's really pretty. Finally 3d-cards get some good use! :) And I really like the themes. How automatic and smooth everything runs and looks. It feels totally different to use it. Different than anything I've tried before.

It almost like my keyboard feels softer. That's just how smooth it looks.

I hope that it will stabilize well during the beta testing. And no matter how long it takes, one thing is clear for me:

KDE 4 will be an amazing desktop environment. It will go further than any other desktop environment before it.

It is crossing the borders of not only architectures, but also programming and scripting languages and even operating systems.

Detect and Counter ARP Poisoning under Windows and Linux

It is nowadays simply too easy to manipulate network traffic. There is for example a Chinese Software called Netsense, which makes it so easy, smooth and effortless, the people using it really might not even know it's using illegal techniques. I don't have any idea, though because I don't know what the manual or description says -> I don't speak Chinese.

ARP is the address resolution protocol. It resolves a computer's IP address to a computer's hardware MAC address. ARP poisoning means that one computer(A) claims to be the owner of the IP address of another computer(B). Computer(A) then gets all network traffic destined for that computer(B). This would mean that the computer(B) the network traffic is actually destined to would not get it anymore. Therefore the spying host(A) is usually configured to forward the packages to the actual host(B) after inspecting them.

Now let's see what you can do against ARP Poisoning under Linux.

First let's find out, what's going on. For that purpose wireshark is very helpful. Wireshark displays all network traffic on your interface. For our purposes we do not need to use the promiscuos mode, as we only have to see the packages directed at our machine. If you want to watch for other machines being poisoned you need to activate the promiscous mode. Usually activating it shouldn't hurt, so let's activate it. 

What you will see characteristically is that (1) one hosts keeps announcing its MAC address via ARP without any other hosts actually having asked for it beforehands. Wireshark may detect a duplicate use of IP addresses (3). And the normal ARP resolutions process(2) of a host asking for the IP address and then gettings its answer usually does not happen anymore for that particular address. (1) is called IP spoofing, as a host claims to have an IP address which it actually does not.

Let's see what we can do about it. There are two things you can do. The easy one, which works under Windows as well, is to set the MAC address manually, called static mac assignment. Type in run, or in a console:

arp -s 192.168.0.1 00-12-34-56-78-90
You should replace 192.168.0.1 with the ip address of the host that is constantly shown in (1) and the mac address behind it with the real mac address of that host, which you can either look up manually or if you're lucky, see as in (2), e.g. when the ARP poisoning is not active at the moment.

Under Linux you can often chose a more flexible approach and simply ban the host that is poisoning your machine. Now don't even try using the normal iptables against it, in my tests it had absolutely no effect. But there is a version of it called arptables, which can help you.
sudo arptables -A INPUT -m mac --source-mac ff:ee:dd:cc:bb:aa -j DROP
While ff:ee:dd:cc:bb:aa should be replaced with the mac address of the host that can bee seen as sources mac address in (1). Now the host should not be able to poison your arp table (or communicate with you) anymore at all. Of course you can also just manually set the IP address just as under windows above
sudo arp -s 192.168.0.1 00-12-34-56-78-90
This will still allow the host to communiate with you.

To check what hosts and what mac address are in the arp table simply use
sudo arp

Remember that while the ARP poisoning is active and working, the hosts poisoning your arp table can usually see all your network traffic. This means the host can log and save everything in your network traffic, such as your passwords, emails, instant messages and everything that is not or poorly unencrypted, even some poorly configured online banking pages. It will most probably also have an impact on the connection speed, especially if you're using a wireless network with a bad reception. 

I hope it helped. Any questions or remarks in the comments are welcome.

KDE 4.1 Beta 1

I just downloaded and tried KDE4.1 Beta 1 for Ubuntu. It's got some quirks still, but it really rocks. It's very beautiful and smooth.

You see the desktops with some widgets: Notes, Dictionary, Slideshow, Fuzzy Clock(pretty cool), Logout&Lock, Trash Can.

Here is a list of bugs I have found so far:

  • knotify4 causes a very high wakeup rate (>100/sec) in powertop
  • many screensavers don't seem to show up, esp. kde3 ones
  • the display settings change the display, but don't change the settings of guidance-displayconfig, which is called at/etc/X11/Xsession.d/40guidance-displayconfig_restore
  • when the display resolution is changed, the panel at the bottom does not change until explicitly reset, not even after logout and login
  • it often gets stuck during logout and has to be killed with ctrl-alt-backspace
  • when the panel is quit, plasma segfault "plasma[6449]: segfault at 7f28000dc947 ip 7f28000dc947 sp 7fff8b103e28 error 14 in libnss_nis-2.7.so[7f2870885000+a000]"
  • when you place the "minimize-all" widget in the panel, plasma reproducibly starts using 50% cpu for me.

Get it here: https://launchpad.net/~kubuntu-members-kde4/+archive or from your friendly Linux Distributor. :)

Check it your ISP throttles P2P traffic

Researchers at the German Max Planck Institute for Software Systems put together a website that 

Protect Files

If you want to make sure a file or directory structure can not be modified by anyone, this command helps:

sudo chattr +i