boltblog

Moving or removing ~/.xsession-errors

Posted on April 23, 2009

The location of ~/.xsession-errors is, at the time of writing, specified in /etc/X11/Xsession in Debian Squeeze (testing).

ERRFILE=$HOME/.xsession-errors

To disable logging, change this to

ERRFILE=/dev/null

I use several computers with the same, networked, home directory, and having all of them output to the same file was a hopeless mess. However, this solved the problem for me:

ERRFILE=$HOME/.xsession-errors-$(hostname -s)
rm -f "$ERRFILE"

This makes a separate .xsession-errors for each of my machines and also removes the file each time X is started so it doesn't grow too big. If X itself crashes, the errors to to /var/log/messages anyway, so there's no need to save the .xsession-errors for this.

Filed under: Linux, Reference No Comments

Wake on Lan on an Intel Mac Mini with Linux

Posted on April 22, 2009

Both Wake on Lan and turning on after a power loss can be enabled on the Intel Mac Mini with the use of the setpci command. I stuffed this into my /etc/rc.local (to run them at boot time. yes, they need to be run on each boot)

# reboot on power loss
setpci -s 0:1f.0 0xa4.b=0

# wake on lan
setpci -d 8086:27b9 0xa4.b=0
ethtool -s eth1 wol g

Don't ask me what they mean. I have no idea.

Note: this requires ethtool to be installed

EDIT: For some newer mac mini's, here are two other setpci commands for the WOL part, if the one above doesn't work:
setpci -s 00:03.0 0xa4.b=0
setpci -s 00:03.0 0x7b.b=19
Try one at a time, see which works.

Filed under: Linux, Reference 3 Comments

Improve the mouse response and acceleration in Debian

Posted on March 4, 2009

Note: This information is now slightly outdated, as the patch is already in Debian Squeeze.

One of my biggest issues with moving from Windows to Linux as my desktop is how the mouse is handled in xorg. In xorg, the mouse had (and still has, in Debian Lenny) two settings for mouse speed: acceleration and threshold. Simply put, what these do is that whenever the mouse is moving faster than the threshold, it gets accelerated by the acceleration value, and otherwise it's unaccelerated.

While this may work for some people, I found it horribly annoying. Before anyone jumps up and bites me, I do know that I can set the threshold to 0 and get some sort of normal acceleration, but I hate that one too. Luckily, Simon Thum has come up with a solution.

His solution has been patched into the newer versions of xorg. The bug is available at freedesktop.org, and the latest patch is here. However, while this patch goes into version 1.4 or xorg without a hitch, the Debian (and probably Ubuntu) build system requires an additional change in the Makefile.in file.

In short, here's a howto for Debian Lenny on getting the new and much improved mouse handling in:

Become root

su (type root password)

First, make sure you've installed everything required to build stuff in the first place:

apt-get update && apt-get install build-essential fakeroot

Become a normal user again

exit

Make a temporary directory, cd to it, then get the sources for xserver-xorg-core

mkdir mousepatch
cd mousepatch
apt-get source xserver-xorg-core

apt-get will download the sources, extract them and apply the Debian-specific patches.
Next, we need all the build-dependencies. These are the libraries used in xserver-xorg-core, which we'll need to compile the source code.

apt-get build-dep xserver-xorg-core

Now make a backup of the source code (This is not strictly necessary, but I like to do so anyway before messing around with it. Saves doing another apt-get download.)

cp -r xorg-server-1.4.2 xorg-server-1.4.2-orig

Now we want to apply the mouse patch. You can either use Simon's original patch from the link above, or you can download a Debian-specific version of it here. This is the exact same patch as the one above, except it only fits into this specific source code, and it contains the changes to the Makefile.in file, which allows dpkg-buildpackage to successfully compile it.

LINK TO DEBIAN-SPECIFIC PATCH

cd xorg-server-1.4.2
patch -p1 <path to mouse patch>

Now build the package.

dpkg-buildpackage -rfakeroot

This will generate quite a few .deb files in the parent directory, and will probably also exit with a return value of 1, complaining it is unable to find Julien Christau's private key. You are most likely not Julien Christau, so you will not be able to sign the package as him. This is irrelevant, as we're not going to distribute this package anyway.

The only .deb you have actually changed is the one named xserver-xorg-core_1.4.2-10_i386.deb, so this is the one we want to install:

cd ..
su   (root password again)
dpkg -i xserver-xorg-core_1.4.2-10_i386.deb

Now, assuming all went well, you may restart X or reboot, whatever your preference, and enjoy your newfound mouse bliss. I actually prefer my new Linux mouse-setup to my dualbooted WinXP IntelliMouse drivers now.

To learn how to set up your new mouse acceleration, please refer to the developer documentation. For the record, these are the relevant lines from xorg.conf for my current setup:

Section "InputDevice"
    Identifier	"Configured Mouse"
    Driver		"mouse"
    Option		"Device"	"/dev/input/mice"
    Option		"Protocol"	"auto"
    Option		"Buttons"	"7"
    Option		"ButtonMapping"	"1 2 3 6 7"
    Option		"ZAxisMapping"	"4 5"
    Option		"AccelerationProfile" "1"
    Option		"VelocityScale" "10"
EndSection

Only the AccelerationProfile and VelocityScale is specific to this patch. Also, I use "xset m 18/10 0" to set my mouse speed.

Filed under: Howto's, Linux 3 Comments

Compiling and patching debian packages from source

Posted on March 2, 2009

A quick reference on how to compile Debian packages from source, and possibly patching them along the way.

Enlightened XFCE4

Posted on February 27, 2009

A howto stolen from http://ubuntuforums.org/showthread.php?t=101066 for later use. All credit to its writer, Iandefor.

Fixing Windows Update errors

Posted on February 27, 2009

The ultimate .bat-file for completely resetting and fixing all sorts of stupid Windows Update errors

VMware Server and Windows Firewall

Posted on January 21, 2009

VMware server uses port 902/TCP for remote connections. It is easy enough to allow outside connections to this port through the Windows Firewall interface in the Control Panel.

However, if you want to do it the "Windows Way (TM)" the trick is to add "vmware-authd.exe", found in the VMware Server folder in your installation directory, to the list of allowed programs. Then, even if you change which port number VMware should use, the Windows Firewall will allow it.

Filed under: Reference, Windows No Comments

How to kill a process that uses too much CPU

Posted on October 23, 2008

Cleaning up my 'dump' directory, I found this aging script I got from somewhere, which will check the current CPU usage of a program and kill it if it uses too much. This is useful if you are for some reason forced to run buggy, closed source software which get stuck in endless loops when things go wrong. I've been there, it wasn't fun, but this thing solved it. Thank you, french christmas...




Norwegian Windows edition on suicide mission

Posted on October 23, 2008

So I downloaded this Debian netinstall image... and Windows went suicidal?

Filed under: Linux, Rants Continue reading

Fun with “beep”

Posted on October 22, 2008

At the end of my huge list of stuff I always install on a Debian box, I put a "beep" to let me know when it's done, because I will no doubt be doing something else, most likely on a different screen, when it's done.

Now, suppose you run a lot of processes you want to know when are done, it's nice to have separate, easily distinguishable sounds for each event. Of course you could do this by playing a short mp3 or something with mpg321 or mplayer if you have a sound card set up on that particular box, but even if you do, playing short tunes on the PC speaker is so much more geeky, and thus cool, since you've already proven yourself to be a geek by working on the linux box in the first place.

Beep has the ability to play a sound at any frequency your PC speaker can do, and with configurable length... do I hear music?

Filed under: Linux Continue reading