Categories
How-To's

Gentoo KVM virtual machine support plus networking

The Gentoo Wiki article about KVM uses the less flexible networking setup with dedicated TAP devices like ‘tap0’. While this setup works fine, other distributions use the bridge device in a different way. By creating a virtual bridge and forcing the host system to connect through this bridge, virtual machines can simply connect to the bridge device and ‘plug in’. No need to manually create TAP devices. In this guide we will set up host and guest networking using the virtual bridge device and DHCP for wired ethernet.

Categories
How-To's

New phonon-vlc backend for KDE 4

According to the devs of Amarok, the new VLC based backend for Phonon delivers better sound quality than the Xine backend. Something like this just begs to be explored of course and the instructions below are based on the generic ones but specifically for Gentoo. Please note that the backend is alpha: it is incomplete and changes daily.

Install VLC 1.1 pre by installing the live version (note that VLC 1.1 is about to be released any time now so this might be available by the time you read this). Note that I had to disable the Gentoo patches in the vlc-9999 ebuild as they prevent VLC from compiling.

ACCEPT_KEYWORDS=** emerge =vlc-9999

Note to self: add the keywords to the /etc/portage/package.keywords file. 😉

Next, fetch the Phonon-VLC backend from GIT. Note that is should become ‘stable’ soonish (it said somewhere it should be moving to kdereview in the near future) so it should be safe to assume it sort of works.

cyberwizzard@cyberxps ~ $ mkdir kde
cyberwizzard@cyberxps ~ $ cd kde
cyberwizzard@cyberxps ~/kde $ mkdir src
cyberwizzard@cyberxps ~/kde $ cd src
cyberwizzard@cyberxps ~/kde/src $ git clone git://gitorious.org/phonon/phonon-vlc.git

Initialized empty Git repository in /home/cyberwizzard/kde/src/phonon-vlc/.git/
remote: Counting objects: 483, done.
remote: Compressing objects: 100% (400/400), done.
remote: Total 483 (delta 330), reused 116 (delta 66)
Receiving objects: 100% (483/483), 102.22 KiB, done.
Resolving deltas: 100% (330/330), done.

cyberwizzard@cyberxps ~/kde/src $ cd phonon-vlc/
cyberwizzard@cyberxps ~/kde/src/phonon-vlc $ cmake -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=/usr $HOME/kde/src/phonon-vlc/

...configure here...

cyberwizzard@cyberxps ~/kde/src/phonon-vlc $ make

...wait a bit more...

cyberwizzard@cyberxps ~/kde/src/phonon-vlc $ su -c "make install"
Password:

[100%] Built target phonon_vlc
Install the project...
-- Install configuration: "debugfull"
-- Installing: /usr/lib/kde4/plugins/phonon_backend/phonon_vlc.so
-- Set runtime path of "/usr/lib/kde4/plugins/phonon_backend/phonon_vlc.so" to "/usr/lib:/usr/lib64/qt4"
-- Installing: /usr/share/kde4/services/phononbackends/vlc.desktop

cyberwizzard@cyberxps ~/kde/src/phonon-vlc $ su -c "kbuildsycoca4 --noincremental"
...password and lot of output here...

And thats it! Just fire up Amarok -> Settings -> Configure Amarok -> Playback -> Configure Phonon (or go through System Settings in KDE) and select the VLC backend (currently shows up as version 0.2).

Categories
Linux / Gentoo Linux

Fixing Vmware mouse flicker

After upgrading a VM from Ubuntu 9.04 to Xubuntu 9.10 I noticed that the mouse cursor works fine in a certain region (say 640×480) but outside that region, it flickers between the actual mouse position and the edge of the region.

After reinstalling X a few times and upgrading the VMware tools I found the solution: it is a bug in the newer GTK versions. Since I amd running Gentoo (unstable aka bleeding edge) I am one of the lucky owners of this new bug.

The solution seems to be to instruct VMWare Player or Workstation (I use 6.5.x) to use its bundled GTK instead of the system one:

echo "VMWARE_USE_SHIPPED_GTK=yes" >> /etc/vmware/bootstrap
Categories
Linux / Gentoo Linux

KDE4: Launching screensaver from commandline or shortcut

Remember the good old days of KDE3? It was so easy to start your favorite screensaver by hand: simply invoke dcop and there we go. But since the dcop framework is no longer part of KDE4 I found myself without a hint of how to create a shortcut to trigger the screensaver.

Until now… use the following commands to lock the screen with the screensaver running or display the screensaver without locking:

qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock

qdbus org.freedesktop.ScreenSaver /ScreenSaver SetActive 1

I hope this helps others as it took me too long to find this…

Categories
Linux / Gentoo Linux

Fixing Midnight Commander Locale errors

If you have a pretty recent Linux system like I have, you most likely have had the pleasure or the following message when starting mcedit:

Chosen display charset or source codeset does not match one set via locale.

You can then “Fix” it or “Skip” and choose to remember it. For me, fixing or skipping the dialog does not seem to do anything but that is most likely because I don’t use the charset completely (no ‘weird’ characters in my text files). Even worse, if you find it to do something — chances are you want to use the Fix option — and tick “Do not ask again”, the next time the file is broken again! This is because the tick box does not respect your choice but rather takes it as “Skip any problem detection in the future”…

Annoying as it may be, the real cause is the fact that you are most likely not using the correct character encoding on your system by default. Chances are, when you update your system you get this annoying “Generating code page” message a million times over. If so, you just generated support to view every text encoding known to man — good for you!

I on the other hand, will only view UTF-8 files and I’m not really interested in anything else. So I decided to reduce codepage support to 2 languages: Dutch and English. Note that the Dutch support in this case tends to translate messages in programs (ugh) but it also adds support for the Euro sign: ‘€’

Open up /etc/locale.gen and add the following lines:

1
2
3
4
5
en_GB ISO-8859-1
en_GB.UTF-8 UTF-8
nl_NL UTF-8
nl_NL@euro UTF-8
nl_NL.utf8 UTF-8

I cheated a bit by replacing the default ISO-8859-1 or ISO-8859-15 character mapping for Dutch with the UTF-8 one. It seems this choice is allowed and gives me proper UTF-8 support with the nl_NL locale.

Save the file and run locale-gen:

cyberxps ~ # locale-gen
* Generating 5 locales (this might take a while) with 1 jobs
*  (1/5) Generating en_GB.ISO-8859-1...   [ ok ]
*  (2/5) Generating en_GB.UTF-8...   [ ok ]
*  (3/5) Generating nl_NL.UTF-8...   [ ok ]
*  (4/5) Generating nl_NL.UTF-8@euro...   [ ok ]
*  (5/5) Generating nl_NL.UTF-8...   [ ok ]
* Generation complete

Looks familiar? Yes that is the dreaded locale generation but this time it only created the locales we will use meaning it completes in a second instead of 10 minutes… Run locale -a to make sure you got what you wanted:

cyberxps ~ # locale -a
C
en_GB
en_GB.iso88591
en_GB.utf8
nl_NL
nl_NL@euro
nl_NL.utf8
nl_NL.utf8@euro
POSIX

Now open up /etc/env.d/02locale and put the locale selection in and reload afterwards:

cyberxps ~ # echo 'LANG="nl_NL.utf8@euro"' >> /etc/env.d/02locale
cyberxps ~ # env-update >> source /etc/profile
>>> Regenerating /etc/ld.so.cache...
cyberxps ~ # export | grep LANG
declare -x LANG="nl_NL.utf8@euro"

All done, we switched to the new locale and mcedit can stop complaining now. As an added bonus each file you edit will be created in UTF-8.

Categories
Gentoo Linux

Fixing ‘interface claimed’ printing problems

After leaving my printer unused for some time I suddenly found myself unable to print to my Canon ip4300 printer (which is connected using USB and should be run by CUPS). Dmesg showed the following after powering up the printer:

usb 1-3.1: new high speed USB device using ehci_hcd and address 5
usb 1-3.1: configuration #1 chosen from 1 choice
usblp0: USB Bidirectional printer dev 5 if 0 alt 0 proto 2 vid 0x04A9 pid 0x10B6
usb 1-3.1: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
usb 1-3.1: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
usb 1-3.1: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
usb 1-3.1: usbfs: interface 0 claimed by usblp while 'usb' sets config #1

The problem here is the USB Printer subsystem of the kernel called ‘usblp’. Some people might have it compiled into the kernel (like me – seemed like a good idea at the time) and others might have it as a module. If you have it as a module, unload it and blacklist it so it won’t be loaded automatically. Power cycle on the printer and it should suddenly become available to CUPS.

If you have it compiled in – like I had – recompile your kernel after disabling USB Printing. The device manager will pick it up if you connect it again so the printing subsystem can use it.

On a side note: it would have been nice to have a warning in the kernel description that using printing subsystems will not work properly if you use ‘usblp’…

Categories
Gentoo Linux

Kill all waiting backup jobs in Bacula

If you are a Bacula user, you most likely had the problem of a Director clogging up on one or more jobs getting stuck while others keep piling up. With the new directives for managing duplicate jobs, this should not happen anymore but last night I found out that 2 of my backup servers managed to dead-lock.

The resulting job queue was over 300 jobs long and restarting the Director did not seem to help. So I threw a little shell script together to use bconsole to cancel all jobs in a waiting state.

Us usual, use on your own risk, I only tested it on my servers and it worked fine…

#!/bin/bash
jobIds=`echo 'status dir running' | bconsole | fgrep 'is waiting' | awk '{print $1}'`
for i in $jobIds
do
  if [ -z `echo "$i" | grep '^[0-9]\+$'` ]
  then
    echo "Error: job ID $i is not a number!"
  else
    echo "Killing waiting Bacula job $i"
    echo "cancel jobid=$i" | bconsole
  fi
done
Categories
Linux / Gentoo Linux

Wine sound errors

After a while, the sound errors from Wine started to annoy me as they seem to indicate something is wrong while it is not. At the start of each program I see the following errors:

err:alsa:ALSA_CheckSetVolume Could not find 'PCM Playback Volume' element
ALSA lib pcm_dmix.c:935:(snd_pcm_dmix_open) The dmix plugin supports 
 only playback stream
err:alsa:ALSA_CheckSetVolume Could not find 'PCM Playback Volume' element
ALSA lib seq_hw.c:457:(snd_seq_hw_open) open /dev/snd/seq failed: No such 
 file or directory

The first errors are related to my Intel HD audio card which has multiple PCM channels. The result is that none of them are called ‘PCM Playback Volume’ and Wine seems to be hard-coded to search for that specific channel to check upon starting.

Harmless but annoying none the less. A bit of searching seems to indicate that this is something I can’t fix.

The second error about dmix seems to mean that the dmix soundcard that Wine is using does not support recording sound. This is correct as it is a softmix device used to let multiple programs ‘claim’ the soundcard without locking each other out. Beats the hell out of the mess called PulseAudio and was a breeze to set up.

The 3rd error is MIDI related: Wine is trying to access the sequencer device. I can’t figure out why Wine has no option to disable midi support altogether but without that device you will keep getting those errors.

To fix this, enable the MIDI drivers in ALSA and load them on boot, the driver will be called ‘snd-seq-device’. In my case this was found in (kernel 2.6.30):

Device Drivers
<*> Sound card support ---->
    <*> Advanced Linux Sound Architecture --->
        <*> Sequencer support
Categories
Linux / Gentoo Linux

Bilbo: Finally a decent blogging program for KDE?

Bilbo interface While the development on KBlogger has somewhat picked up and some features have been pushed back to allow for a semi-working release, I just found a little gem hidden on the big wide web.

In a mailing list post on the development on KDE, someone is suggesting to take a look at Bilbo instead of KBlogger for the ‘extra-gear’ package. Of course, I was expecting a simple blog editor similar to all the other projects out there that never quite made it. Boy, was I in for a surprise!

Bilbo has the features I need in a blogging program (similar to the Windows Live Writer interface) and even better, it should be in working order!

I will report back once I get it to install on KDE 4.3 using Gentoo.

Categories
Gentoo Linux

QuickCam Communicate STX on Linux

Looking for instructions to get your latest Logitech webcam to work on linux? Your in the right place! Need a replacement for gspcav1 or spca5xx? Have no clue what I just said but you need a new webcam driver? Please, read on…