Posts tagged ‘debian’

Creating a Xen DomU on Debian “squeeze” (6.0.6)

This applies to a default (=debian-packages) installation of Xen on “squeeze” using LVM for storage management.

Tested with these package versions:

  • xen-hypervisor-4.0-amd64: 4.0.1-5.5
  • xen-tools: 4.2-1

Choose a name for the DomU host and select the LVM volume group to be used for the new filesystem:


Assuming a physical extent (PE) size of 256 MB, create a new logical volume with 10GB (= 40 × 256MB).

sudo lvcreate --verbose --extents 40 --name ${VM_NAME}_root $LVM_VG_NAME

Now the DomU can be installed using the following command. The new LV will be used for the root filesystem, the RAM will be set to 1GB and a private IP will be assigned. The xen-create-image tool will use the current testing distribution for installation via debootstrap.

Using the --pygrub switch is essential, as otherwise the DomU won’t be able to boot (no kernel and bootloader would be installed).

sudo xen-create-image \
  --hostname=$VM_NAME \
  --image-dev=/dev/$LVM_VG_NAME/${VM_NAME}_root \
  --noswap \
  --size=10G \
  --memory=1024M \
  --ip= \
  --netmask= \
  --gateway= \
  --broadcast= \
  --dist=testing \
  --pygrub \

Now, create a mount point for the root filesystem and mount it there. This is done since we need to fix the kernel image before we can actually start up the DomU:

sudo mkdir -pv /mnt/domUs/$VM_NAME/root
sudo mount /dev/mapper/$LVM_VG_NAME-${VM_NAME}_root /mnt/domUs/$VM_NAME/root

The above described Xen installation unfortunately can’t boot the bzImage kernels shipped by Debian (see bugs 519149 and 695056). Therefore we need to extract them and re-compress them with gzip. For the first part we use a script that is part of the official Linux kernel source tree: extract-vmlinux.

cd /mnt/domUs/$VM_NAME/root/boot/
KERNEL_IMG=$(ls vmlinuz-*-amd64 | tail -n 1)
sudo cp -v ${KERNEL_IMG} ${KERNEL_IMG}.orig
cd /tmp
wget --no-check-certificate
chmod +x extract-vmlinux
./extract-vmlinux /mnt/domUs/$VM_NAME/root/boot/${KERNEL_IMG} > ${KERNEL_IMG}
gzip ${KERNEL_IMG}
sudo cp -v ${KERNEL_IMG}.gz /mnt/domUs/$VM_NAME/root/boot/${KERNEL_IMG}

Finally, we can unmount the DomU root filesystem and start up the host:

sudo umount  /mnt/domUs/$VM_NAME/root
sudo xm create /etc/xen/domUs/${VM_NAME}.cfg --console_autoconnect

dpkg vs. rpm: list of installed packages

my language & locale settings on a fresh ubuntu-install

the following steps are required to adjust a fresh ubuntu to my personal language-preferences, including the default character encoding for gnome-terminal set to UTF-8

# install the required packages to generate the appropriate locales:
sudo aptitude install language-pack-de-base language-pack-de
# set the default environment variables:
echo '
# locale stuff
# Character classification and case conversion:
# Date and time formats:
# Non-monetary numeric formats:
# Collation order:
' | sudo tee -a /etc/environment

IMPORTANT: you have to log out after these changes to make them work!!

hp-snmp-agents on debian 6.0 (squeeze)

hp-snmp-agents error: Service snmp has to be enabled to start service hp-snmp-agents

If you get an error like:

Setting up hp-snmp-agents ( ...
insserv: Service snmp has to be enabled to start service hp-snmp-agents
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing hp-snmp-agents (--configure):
subprocess installed post-installation script returned error exit status 1

Edit the file:


and change the “update-rc.d “ to “update-rc.d -f “, then
apt-get -f install
and you should be back in business.

(copied 1-on-1 from craighoffman)

installing redmine on debian/lenny using mod_passenger

this is based on redmine-1.0.0

we need a more recent version of rails and rubygems than those shipped with lenny, so first add the backports-repository to your sources.list:

deb lenny-backports main contrib non-free

then, update your package list:

sudo apt-get update

and install the above mentioned packages Continue reading ‘installing redmine on debian/lenny using mod_passenger’ »

list obsolete and/or locally installed packages in debian/ubuntu

aptitude has a specific list-category to display those when using the curses-GUI, but I do not like it. fortunately, you can use the search-command from the cli-interface with the appropriate search-pattern:

aptitude search "?obsolete"

or as a shorthand:

aptitude search "~o"

See the aptitude Reference Guide for more information.

restoring a MySQL dump on a freshly installed debian/ubuntu system

to restore a dump from a MySQL database created on a debianish Linux system, just feed the dumped SQL to the command-line mysql client like this:

mysql -u root -p < mysql-all-2010-03-28-0515.sql

since the whole content of all MySQL databases are overwritten with that stored in the dump, credentials are affected as well. that’s the reason why debian’s system tools won’t work any more after restoring the old dump, since debian creates a maintenance-user called “debian-sys-maint” during the installation and stores the randomly generated credentials in “/etc/mysql/debian.cnf” so it’s sufficient to just copy the “password” values from the old file into the new one and restart mysql. otherwise, you will run into an error like this:

/etc/mysql/debian-start[3181]: Running 'mysqlcheck'...
/etc/mysql/debian-start[3181]: /usr/bin/mysqlcheck: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) when trying to connect
/etc/mysql/debian-start[3181]: FATAL ERROR: Upgrade failed

building “schroot” on RHEL-5.4

“schroot” is a secure chroot tool that allows a non-privileged user on a system to switch to a chroot in a secure manner. This can be used to set up automated builds etc. that don’t have to run as root.

Unfortunately, RedHat Enterprise doesn’t ship with schroot-packages, so here’s a way to build them: Continue reading ‘building “schroot” on RHEL-5.4’ »

find changes in config files (debian/ubuntu)

want to know which files in /etc have been changed on your debian-like Linux system?

one part can be done with the package debsums, which compares the md5sums delivered with a debian-package with those of the current files:

$ sudo debsums -a -s
debsums: checksum mismatch apache2.2-common file /etc/apache2/sites-available/default
debsums: checksum mismatch apache2.2-common file /etc/apache2/ports.conf

Note 1: this does NOT cover configuration files that are not part of the .deb-package itself, e.g. those manually created by a user AND as well those built by a package’s configuration/post-install scripts. You have been warned!

Note 2: debsums can give hints about a compromised system, but it’s absolutely no guarantee that a non-suspicious output comes from a clean system – if the system’s compromised, an attacker could as well change the md5sums-database of a package (residing in /var/lib/dpkg/info/PKGNAME.md5sums)

configuring TSM and testing the config is a real PITA…

just to remember how to test if a certain directory and its files are included in the backup using the TSM commandline interface:

./dsmc preview backup -console /path/to/dir/

delete one or more files from your backup (NOTE: the quotes in the second command are important, otherwise bash will expand the pattern and produce a list of files, which will confuse the TSM-client):

./dsmc delete backup /backups/mysql/mysqldump-complete-2010-01-20-1823.sql.gz
./dsmc delete backup '/backups/mysql/*.gz'