Pages

January 02, 2011

Fixing overzealous hard drive head parking

Debian Squeeze on my Samsung R510 has been working very well, with one exception: pause... pause... click... pause... pause... pause... click... The hard drive seems to be overzealous about parking its heads. There are some (strawman alert?) who feel that heavy head parking actually reduces the life of a drive. Whether or not that's the case, I find the frequent clicking to be downright annoying on this otherwise intensely quiet computer.

As is the case with many things in Linux, a fix is at hand. Many thanks to SammyNetbook for pointing the way. The frequency of head parking can be changed by lowering the aggressiveness of APM power saving through the hdparm command. In the case of my lappy, running

# hdparm -B 254 /dev/sda

(as root) solved the headparking issue. (There maybe lower levels that work as well, but I'm happy enough with the result now that I haven't experimented.)

Running the command at startup
The effect of the above command ends at restart. To automatically run it when my lappy starts up, I used init.d. I first created a file mfk-hdsilence.sh in /etc/init.d:
#! /bin/sh
# /etc/init.d/mfk-hdsilence.sh
#

# Some things that run always
hdparm -B 254 /dev/sda

exit 0

Then to activate this:
# update-rc.d mfk-hdsilence.sh defaults

I got a warning when I did this, but it seemed safe to ignore. Result? A non-clicky, super silent lappy. Life is good.

Update: it seems suspending the lappy resets the drive's APM, so I'll need to figure out a way to rerun hdparm when waking up. I am currently experimenting with placing a file 30_mfk-hdsilence.sh in /etc/pm/sleep.d:

#! /bin/sh
# 30_mfk-hdsilence.sh
#

# silence aggressive head parking
case ${1} in
 resume|thaw)
  hdparm -B 254 /dev/sda
  ;;
esac

exit 0

It seems to be working, but I'll need to live with it for a while to make sure. Suspending under Linux is always stressful for me.

December 20, 2010

XDG menus in Openbox

Now I feel stupid. For year(s) I've been sorta griping about how the Openbox menu doesn't give you a program listing that coincides with what you get in GNOME, Xfce, and even fbpanel. I've hunted for solutions to this before but came up short. Turns out the solution is insanely simple.

The following is a direct quote from from the excellent ArchWiki. I tried it in Ubuntu Maverick and it works.

Obm-xdg

obm-xdg is a command-line tool that comes with Obmenu. It can generate a categorized sub-menu of installed GTK/GNOME applications.

To use obm-xdg, add the following line to ~/.config/openbox/menu.xml:

{menu execute="obm-xdg" id="xdg-menu" label="xdg"/}

(note: the curly brackets above should actually be angled brackets, but this crazy Blogger interface makes it close to impossible to write the above with angled brackets.)

Then run openbox --reconfigure to refresh the Openbox menu. You should now see a sub-menu labeled xdg in your menu.

Note: If you do not have GNOME installed, then you need to install gnome-menus package for obm-xdg to work.

Update: This is having issues on Squeeze. More later as I (if I) figure it out.

December 18, 2010

Java Swing anti-aliased font rendering

[Update 2011-04-03:  The Arch Wiki describes lots of options for the export below. I've been having good results with export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting']

Today I noticed fonts in my Swing-based Java apps were utterly hideous. They were no longer being rendered with anti-aliasing. I don't know if this is because today I logged into a minimal Openbox+fbpabel setup and GNOME was handling this automatically or if it's caused by some other subtle thingy.

No matter, it's pretty easy to fix. Add

export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"

to your ~/.profile file. You'll probably then have to logout and back in. After this anti-alised rendering will be the default.

Supposedly, you can do this system-wide by adding

_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"

to your /etc/environment file, but I have not tried this.

Update There is one downside to this: the JVM will write Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on to the console. It's not a deal-breaker, but it is a little annoying.

October 21, 2010

No Gnome in Maverick Meerkat

I am a little surprised that no one has yet commented on how there is no longer a Gnome entry in the Ubuntu Maverick Meerkat login screen. Instead, you have various options for "Ubuntu Desktop Edition." When you select "Ubuntu Desktop Edition" you get something that looks, acts, smells, and sounds almost exactly like Gnome. For now.

October 19, 2010

Enabling touchpad clicking and edge scrolling in Squeeze

Gnome has a mouse configuration interface that lets you enable touchpad clicking and scrolling. But if you are a Debian Squeeze user and prefer Xfce, LXDE, or some handmade alternative, you will find that your touchpad's clicking and edge scrolling won't work [1]. You'll also find that those functions don't work in the GDM login screen even if you do use Gnome. No probs. The fix is easy.

To fix:
  1. Open  /usr/share/X11/xorg.conf.d/50-synaptics.conf (as root) in an editor.
  2. Add the text
    Option "TapButton1" "1"
    Option "VertEdgeScroll" "1"

    between Section "InputClass" and EndSection.
  3. Save, reboot and enjoy.
Note that if you use Gnome, you might find that your old mouse settings are messed up after the above. Set them again and all should be fine.

If you don't like the idea of changing system config files, you can use synclient in a startup script to enable things as well.

Useful links:

[1] At least at the time of this writing. When Squeeze is eventually released, this may change.

October 14, 2010

Fixing brightnes control, etc. on a Samsung R510 with Debian Squeeze

I finally got around to installing Linux on my Samsung R510 laptop. One of the problems with Samsung laptops is that they don't play well with some Linux standards. One example is the brightness control--it just doesn't work. There are some other issues that are less irritating, but this one is the worst for me.

There is a fix for these ails that was developed for Ubuntu (some of which is also at Google code.). The problem is that my current distribution of choice is Debian Testing (Squeeze). The good news is that these bits developed for Ubuntu can be used in Squeeze as well.

We need to install three different packages: easy-slow-down-manager, samsung-backlight, and samsung-tools. Here's what I did after installing Squeeze with Gnome on the R510:

easy-slow-down-manager
Download the Maverick *.deb for easy-slow-down-manager from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. It's all DKMS source code, so installing the package in Squeeze should be ok.

samsung-backlight
Downloaded the Maverick *.deb for samsung-backlight from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. Like easy-slow-down-manager, it's all DKMS source, so installing the package in Squeeze should be ok.

With a lot of Samsung laptops, we'd be done with these two packages. Sadly, the R510 needs some extra love. The following is taken almost verbatim from http://www.voria.org/forum/viewtopic.php?f=3&t=516&start=0&hilit=r510

First (as root):
# gedit /lib/udev/rules.d/95-keyboard-force-release.rules

In the Samsung section you will see a line with *N130*|*N140* etc. Add |*R510* there

Do the same for:
# gedit /lib/udev/rules.d/95-keymap.rules

Next, add "acpi_backlight=vendor" to grub:
# gedit /etc/default/grub

and add "acpi_backlight=vendor" to the line GRUB_CMDLINE_LINUX_DEFAULT so it looks like
GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_backlight=vendor"

Save the file and then update grub:
# update-grub

samsung-tools
It may or may not be ok to install the Ubuntu package for samsung-tools on Squeeze, but since it's got binaries in it, this is risky. I decided to download the sources and build a package on the Squeeze-equipped R510 instead. Start by getting some build tools:
# apt-get install build-essential devscripts fakeroot

Then from https://launchpad.net/~voria/+archive/ppa get the Maverick *.tar.gz sources for samsung-tools. Expand the *.tar.gz and inside the directory that has the debian directory (i.e., not in the debian directory, but in the directory immediately above), open a term and:

dch -l {your initials}

and add comment like "Compiled for Debian." Close the editor and in the term build the package with:
dpkg-buildpackage -rfakeroot -us -uc

You may need to add additional dependencies if it fails. Pay attention to the error messages. Assuming it completes, this will generate a *.deb package file. Install it using gdebi or whatever.

After rebooting, you should now have working brightness buttons and a host of other working {Fn}-{Fsomething} keys. You will also have a new app under System->Preferences->Samsung Tools Preferences that you can use to change keybindings, etc and/or run as a Gnome panel app.

If it doesn't work
If the above doesn't work, you may be interested in playing with brightung. I haven't played with it except to confirm that (as root)

# setpci -s 00:02.0 F4.B={some-hex-number}

changes the brightness on my R510.

Workaround for installing desktops in Squeeze

I've done a couple new Debian Testing installations in the last couple days and have noticed something strange in the installer. At a point in the installation process, you will be offered a menu of choices for major package bundles to be installed. If you want a desktop environment, you're supposed to select "Desktop environment." In the past when I did this, the following screen would offer you a choice of DTEs including Gnome, KDE, Xfce, and LXDE. However, the last few installs I tried did not. And exactly what it installs I'm not sure because I wasn't willing to wait 3 hours (at my connection speeds) for the download and install process to complete. So here's the workaround:

First, using the installer, install the system you want but do not install a desktop environment. 

When the installation completes, login using the command line. Then become root
su

Next, make sure you have tasksel installed:
# apt-get install aptitude tasksel

Finally, use tasksel to install your desktop. To install Gnome:
# tasksel install gnome-desktop --new-install

Reboot:
# reboot

and when your computer restarts, you should be good to go.