Jenkins on minimalistic Debian Virtualbox VM (64bit)

Update 14/Aug/2018: I no longer maintain the package mentioned and the download links below are most likely broken.

A Jenkins build server (LTS release) can now be easily installed on the minimalistic Debian VM:

  1. Download and install Virtualbox
  2. Download debian-stable-amd64-minimal.ova and import it into Virtualbox
  3. Start the “debian-stable-amd64-minimal” VM in Virtualbox
  4. If you are outside Nova Scotia, please review debian-stable-amd64-minimal.txt and adjust locale, timezone and Debian mirror based on your location
  5. Start an ssh session to localhost, port 1111 (using PuTTY, for example)
  6. Log in as user (default password is “user”)
  7. Issue “sudo install.sh jenkins” (default root password is “root”)
  8. Press enter for any questions during installation
  9. Open http://localhost:8888/ in a browser on the host OS for Jenkins web ui

You can go to “Manage Jenkins” – “Configure System” and see that JDK, Ant and Maven entries are already configured for you.

Both OpenJDK 6 and OpenJDK 7 are installed automatically for you in the VM. Please note that openjdk-6 is the Debian stable system default, while openjdk-7 is configured as the default for Jenkins build jobs.

Important: Make sure to change root and user passwords to something secure, as mentioned in debian-stable-amd64-minimal.txt.

Convert Virtualbox VDI for VMware Player

Regarding the VM that I mentioned in my previous post – this way I also got it to work in VMware Player:

  • Install and start Virtualbox (https://www.virtualbox.org/wiki/Downloads)
  • Go to File – Import Appliance (and import the ova file mentioned in my last post)
  • Close Virtualbox
  • Use VBoxManage on the command line to clone the VDI to VMDK, roughly as described here (but do not try to uninstall guest additions):  http://scottlinux.com/2011/06/24/convert-vdi-to-vmdk-virtualbox-to-vmware/
  • Create a new empty Linux/Debian VM in VMware Player
  • Close VMware Player
  • Edit the new vmx file so that it points to the cloned vmdk
  • Then open the VM in VMware player again. Now it should boot into Debian.

Minimalistic Debian VM (64bit)

Update 14/Aug/2018: I no longer maintain the package mentioned and the download links below are most likely broken.

I uploaded a VM image to dev.doepner.net: It is a minimalistic Debian VM that can be used as a base for lean servers. It is in OVA format, exported from Virtualbox 4.1.6. Details are in the corresponding txt file.

You can add the VM to your Virtualbox using “File” – “Import Appliance …”. VMware should also work but might require some compatibility conversion of the ova file.

Recipes for specific Nexus, Jenkins, Wiki, Bugzilla setups will follow … I will publish those as scripts/instructions relative to the minimal base image, rather than maintaining several VMs.

My /etc/apt/sources.list (for Debian squeeze)

My sources.list entries:

# local repo (manually downloaded debs, etc.):
deb file:/usr/local/packages ./

# The closest Debian mirror is at Dalhousie University, Halifax:
deb http://mirror.its.dal.ca/debian/ squeeze main contrib non-free
deb http://mirror.its.dal.ca/debian/ squeeze-updates main
deb http://mirror.its.dal.ca/debian/ squeeze-proposed-updates main
# See http://www.debian.org/mirror/list for mirrors closer to you

# Security updates (not mirrored)
deb http://security.debian.org/ squeeze/updates main

# Official backports repo for squeeze (I install the Linux kernel from it)
deb http://backports.debian.org/debian-backports squeeze-backports main

# Debian multimedia, a must-have for mplayer et al.
deb http://mirror.its.dal.ca/debian-multimedia squeeze main non-free

# Repo that provides latest Iceweasel (aka Firefox)
deb http://mozilla.debian.net/ squeeze-backports iceweasel-release

Simple webradio playback

I listen to web radio stations but I don’t want to use any player ui for that. All I want is:

  1. Select a station from a list of my favorites and listen to it
  2. Be able to stop current web-radio playback
  3. Never have more than one station playing at the same time

I do it like this:

  • For each radio station save a playlist file (*.pls, *.m3u or sometimes *.asx) in a folder called “radio” on my local machine. I download most of them from the shoutcast or icecast stream directories. I also add one special (empty) file called “none.pls” (which serves to turn off all radio).
  • Add a toolbar to the taskbar that lists the content of the radio folder, i.e. all the webradio playlist files as clickable items. In XFCE add a “Directory Menu” item to the panel.
  • Configure the default app for the playlist mime types mentioned above to be my bash script “radio.sh”. It kills any existing webradio playback and plays the selected playlist file. See below for how to configure mime-type association defaults.
  • Install mpv – the de-facto successor of the now dormant mplayer – to do the actual playback.

This is my little “radio.sh” script (requires the pkill and mpv commands):

#! /bin/bash
pkill -f "mpv --playlist" 
mpv -playlist "$@"

To set this script as the default handler for the most common playlist file types, put the following into ~/.local/share/applications/defaults.list:

[Default Applications]
audio/x-mpegurl=radio.sh.desktop
audio/x-scpls=radio.sh.desktop

Make sure you have a file “radio.sh.desktop” in ~/.local/share/applications or in /usr/local/share/applications with contents like this:

[Desktop Entry]
Exec=radio.sh %U
MimeType=audio/x-mpegurl;audio/x-scpls;video/x-ms-asf
Name=radio.sh
StartupNotify=false
Terminal=false
Type=Application

If I have to use M$ Windows then I do something similar using a taskbar toolbar for the radio folder and the VLC player, configured to run minimized as systray icon.

Set up sudo on Debian

Debian does not use sudo by default. I like sudo for admin tasks when being logged in as a regular user (mostly based on my experience with Ubuntu) for several reasons:

  • No risk of an open root shell
  • Logging of “who did it”
  • Selective access can be configured flexibly

What I don’t like in Ubuntu is that the sudo password is the regular user’s password and that the root account is actually disabled:

  • We lose one level of security (root password) and the regular user password is often not carefully chosen and maybe not kept secret enough (because maybe friends or family know it to do “regular user stuff” using your account.
  • In a “one admin person” system like your typical laptop or desktop there is no concern that the root password would have to be shared among several admins.

So for these reasons I usually configure a “one admin person” Debian system like this (replace REGULAR_USERNAME with your regular username that will be the admin):

su -
apt-get install sudo
adduser REGULAR_USERNAME sudo
visudo

In the visudo editor edit the “Defaults” line to use “targetpw”:

Defaults env_reset,targetpw

Then exit the root shell, log out as regular user and log in as regular user again (required to activate group membership).

Now your regular user should be able to do everything that root can do using sudo and the root password.

Fix udevd warnings after hplip installation

After installation of the latest hplip package (for HP printer support on GNU/Linux systems) you might see boot warnings like this:

udevd[281]: SYSFS{}= will be removed in a future udev version, please use ATTR{}= to match the event device, or ATTRS{}= to match a parent device, in /etc/udev/rules.d/86-hpmud-hp_laserjet_p1008.rules:6

To fix the problem I did this (on a Debian system):

sudo sed -i -e "s|SYSFS|ATTRS|g" -e "s|sysfs|attrs|g" /etc/udev/rules.d/*hpmud*.rules

APT pinning, Iceweasel upgrade, hide Facebook Ads

I am a pretty happy user of Debian 5 stable (“Lenny”). But some Lenny packages are a little too old for my taste.

For example, Iceweasel is version 3.0.6 in Lenny. But the latest Adblock Plus (1.1.1 and later) requires Firefox/Iceweasel 3.0.12 and Adblock Element Hiding Helper does not work correctly with Adblock Plus versions older than 1.1.1 (keeps ignoring the configured hiding patterns).

So I decided that I want Iceweasel 3.0.14 from Debian testing (“Squeeze”). I googled for APT Pinning and found this page

http://wiki.debian.org/AptPinning

The lower half of it explains a “conservative approach” to pinning that only installs testing packages when the user explicitly requests it. I created /etc/apt/preferences to look like this:

Package: *
Pin: release a=stable
Explanation: prefer stable
Pin-Priority: 900

Package: *
Pin: release o=Debian
Explanation: require approval
Pin-Priority: -10

Then I added the Debian testing repository to /etc/apt/sources.list, told apt to update itself and installed Iceweasel from testing:

apt-get update
apt-get install -t testing iceweasel

That worked nicely and upgraded only the Iceweasel package, nothing else.

Now I can use Adblock Plus with the Element Hiding Helper to get rid of the ads in Facebook by adding these Element Hiding Rules:

facebook.com##DIV.adcolumn
facebook.com##DIV.UIEMUASFrame.UIEMUASSLikeFrame
facebook.com##DIV.UIEMUASFrame

Yay! That was worth the effort …

Windows in a box

Until quite recently I did not use any operating system virtualization software. On my main PC I ran only Kubuntu and on my laptop I had a dual boot setup with the Windows XP installation that came pre-installed and Kubuntu.

VMware was not very appealing to me since it is proprietary software, not Open Source. A few weeks ago I gave VirtualBox a try. It is available as an Open Source Edition (OSE). There are packages included in the Ubuntu distribution so it was quite easy to install.

I must say that I am very impressed. The UI is intuitive, well documented and straightforward to use. I installed Windows XP Professional as a guest system and it worked without problems.

I had to realize, though, that “Shared Folders” are only supported in the Commercial Edition. That is not a problem since Folder Sharing can be done with Samba.

“Seamless mode” makes the experience even better: The windows from the Win XP desktop and the Kubuntu desktop appear as parts of one united desktop, with the taskbar and desktop background changing according to what window is currently active.

VirtualBox is developed by the German company InnoTek. Keep up the good work, guys!

Make Bugzilla’s whine.pl work on Ubuntu or Debian

I use Bugzilla as a taskplanner. The “Products” include “Household”, “Bureaucracy”, “Career” and so on. The “Components” are used to further refine these fields of activity.

For each task that I assign to myself I choose a priority to set a timeframe within which I want to tackle the task. To do that I have changed the default priorities (“P1”, “P2”, etc.) to “Today”, “Tomorrow”, “1 week”, “2 weeks” and so on.

I want Bugzilla to remind me that I have to work on the task before the specified time is over. To do that I have set up so-called “Whining events”. (see Bugzilla’s online documentation)

I have defined one search for each priority, using “Advanced Searching Using Boolean Charts”. For example the search for “New, assigned or reopened bugs where Priority is equal to 1 week and Days since bug changed is greater than 5” is saved under the name “5d unchanged (1w)” and matches everything I wanted to do within a week but didn’t touch for 5 days. The whining event for this search is set up to send me an hourly email if there are any bugs that match this search.

But to make this actually work, the Perl script “whine.pl” has to be executed every 15 minutes. I have set up a system cron job to do this (as the system user “www-data”). The entry in /etc/crontab looks like this:

*/15 * * * * www-data cd /usr/share/bugzilla/; /usr/local/share/bugzilla/whine.pl

Unfortunately, the file “whine.pl” is not included in the bugzilla packages of Kubuntu and Debian GNU/Linux, although it is part of the upstream Bugzilla distribution (see my Bug report). So I had to download the official tar.gz of the matching version (Bugzilla 2.22.1 in my case) from bugzilla.org, unpack it and copy whine.pl to /usr/local/share/bugzilla.

At first the execution of whine.pl aborted with an error which is due to a bug of the Perl DBD package that enables MySQL access. See this Thread on the mozilla.support.bugzilla newsgroup and this Bug report for Perl DBD MySQL.

It turned out I had to slightly upgrade the libdbd-mysql-perl package (from 3.0006-1 to 3.0007-1) to get rid of the bug. I downloaded libdbd-mysql-perl_3.0007-1_i386.deb from the Debian testing repositories and edited its control file to change the Perl depency to “perl (>= 5.8.8-6)” (the version in Edgy) rather than the slightly newer Perl version in Debian testing at the time (5.8.8-6.1).

After all that I finally got the whining feature working.