Smokes your problems, coughs fresh air.

Tag: Debian (Page 2 of 3)

RubyGems nuisances

Because I used it successfully before, I decided to use scrAPI to scrape the entries from the old Aihato guestbook. After preprocessing the HTML a bit, I finally got beyond an endless debugging sessions (which cumulated in me discovering a whole collection of nested <html> tags, which forbad any type of sensible parsing of the page).

The scrAPI script calls a simple PHP script to add the extracted comment to the WordPress DB. The next step was copying the script to the development server (which has command-line PHP and the MySQL daemon running). Of course, the development server (which runs Debian Lenny) didn’t have the scrapi package installed. So, I thought I’d install the rubygems package and be done after gem install scrapi.

It seemed to install just fine, but… it just won’t fucking work! Adding require 'rubygems' to the script doesn’t work either.

This whole thing reminded of a similar occasion a while back when RubyGems kept fucking up everything until we discovered through Google that the version of RubyGems shipped with Debian simply couldn’t handle the whole dependency graph we had to deal with (or something). We had to grab a newer version from Debian backports to make the whole thing work. Another couple of hours wasted on a botched up package management system.

This time I’ve already wasted enough time. I’m ready to change my PHP guestbook comment import code to some XML-RPC hack instead so that I can run it on my laptop.

Upgrading Samba from Lenny-backports

For some reason, after upgrading to the Samba version from Lenny-backports I needed to support Windows 7 profiles, the workstations suffered from severe problems. The entire profile seemed to be read-only, even though they weren’t on disk. I couldn’t change any setting and reverting profile configuration from backups didn’t help. In the end, the only thing that fixed it was recreating the user profile, both server and client side. This was an upgrade from 3.2.5 to 3.4.7.

Another issue I had is that the user database got a new backend and all the users were gone. You can import your existing smbpasswd file with pdbedit.

So, when doing this again, be sure to make workstation and server backups.

Adding a virtual network interface on Debian

When clustering machines, you make it possible for a failover node to be accessible on the same address as the primary node by having a virtual network interface. In Debian, you can add one like this:

iface eth0:0 inet static
    address 192.168.1.75
    network 192.168.1.0
    broadcast 192.168.1.255
    netmask 255.255.255.0
    gateway 192.168.1.251

By leaving out the auto eth0:0, I prevent the interface from becoming active automatically. I can do “ifup eth0:0” to enable it. This can also be left to clustering software, but clustering software can also get in the way, so often you just want to do it by hand.

Installing Samba from lenny-backports

With our new Windows 7 machines, we need at least samba 3.3.7. However, our server with Debian stable doesn’t have that in its repository. So, I was forced to install samba with lenny-backports.

I included this line in my /etc/apt/sources.list:

deb http://www.backports.org/debian lenny-backports main contrib non-free 

Because backports are disabled by default, I needed to pin all the packages required for samba:

Package: samba
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: smbclient
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: smbfs
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: samba-common
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: samba-common-bin
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: libwbclient0
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: libtalloc2
Pin: release a=lenny-backports
Pin-Priority: 999

I haven’t actually installed it, but I will soon. So I don’t know if it will work or not. Aptitude -s suggests it does.

Saving and loading iptables rules on Debian

For some reason, Debian can’t do “/etc/init.d/iptables save”. So, we have to fix something ourselves. I used this article as source, which also has some useful comments. Apparently, the iptables initscript used to exist…

To save, type:

iptables-save > /etc/iptables.rules

Make /etc/network/if-pre-up.d/iptables:

#!/bin/sh
iptables-restore < /etc/iptables.rules

Don’t forget to make it executable:

chmod +x /etc/network/if-pre-up.d/iptables

Installing Xen with Lenny guest on a Debian machine

This is supersceeded by my install on Debian Squeeze). On Lenny, everything is just too outdated.

This will explain how to install the paravirtualization software Xen on Debian. It is more involved than KVM, but more elegant if you can setup up a dedicated machine to run virtual machines (in fact, KVM on Debian seems quite clunky). I use this Debian wiki page as base.

First some terminology. On Xen, everything runs virtualised, including what in KVM would be called the “Host OS”. This is because every OS instance shares some kernel space. Xen has a primary virtual machine with which you configure the other virtual machines. This is called Domain-0, or Dom0. The guests are DomU’s.

Begin by installing xen-linux-system-2.6.26-2-xen-686 and xen-tools. It will install all necessary dependencies:

aptitude -P install xen-hypervisor-3.2-1-i386 linux-image-2.6-xen-686 xen-tools

(The wiki page suggests to install linux-image-2.6.26-2-xen-686, but that confuses me. See my forum post. I will update this blogpost if my insights change).

A new kernel is installed and is configured in Grub as primary kernel. (As a sidenote, I wonder what will happen if the standard kernel is upgraded at some point in the future; will that be installed as primary again? Should the standard kernel be uninstalled?)

Before you reboot, add “xenblktap” to /etc/modules. This module is needed to be able to use tap:xxx (like tap:aio) storage back-ends. These are preferred over “file:”, especially when using NFS to store images (although that link also states that ENBD is preferred over NFS. (I was having problems with tap:aio and then I discovered the module problem. It still doesn’t work for me, but the problem lies elsewhere now.)

If you boot into the new kernel you can do “xm list” and you will see that your Domain-0 is active.

You want to setup an ethernet bridge configuration next, because that way, you can plug your virtual machines into your existing ethernet network. You can do this by configuring this in the config file /etc/xend-config.xsp (The network-script option is already defined, so all you have to do is change it):

(network-script network-bridge)

Configuring “vnc-listen” might also be a good idea (although not really needed for linux, since you’ll be using the xen console). Setting it to localhost and then tunnling through SSH would be the safest, obviously.

Now it’s time to add DomU’s. Because the guests need to have DomU support, the OS cannot be installed with the normal installer (although I’m not sure this is still the case for Lenny, because the Wiki says: “In Lenny the distinction between the Xen and non-Xen flavours of the kernel (with respect to domU support) is no longer present.”).

First edit /etc/xen-tools/xen-tools.conf to set some good defaults. You can remove the noatime mount options for ext2 and ext3, for example. I can also set the default mirror to “http://ftp.nl.debian.org/debian/”.

xen-create-image --hostname=virtualnode --size=2Gb --dist=lenny --memory=256M --dhcp --dir /root/xen-images/ --swap 256Mb

You have to mount the image to make some corrections. In my case, the image was still mounted somewhere in /tmp. I assume this is bug. Begin by editing /etc/inittab. Comment out the existing “1:…” tty and add the line :

1:2345:respawn:/sbin/getty 38400 hvc0

to /etc/inittab, otherwise your console won’t work.

Start the virtual machine and attach a console (the -c option) like this:

xm create -c virtualnode.cfg

One of the first things you want to install is udev, because you can’t even ssh to the box without it.

The resulting Debian installation is very bare; it doesn’t even have a mail infrastructure.

On the Dom0, you can mkdir /etc/xen/auto and symlink the config file for this virtual host there to have it auto started by the xendomains bootscript.

Configuring a static IP address on Debian

This is a simple netconfig for a static IP address on a Debian machine. In /etc/network/interfaces, replace your eth0 (or whatever) with this:

auto eth0
iface eth0 inet static
    address 192.168.1.65    
    netmask 255.255.255.0
    gateway 192.168.1.251

Edit: I removed the network and broadcast statements because they are superfluous.

Debian volatile: keep fast moving packages working on Debian stable

The concept of Debian stable is kind of nice, since you don’t have to be affraid of upgrade breakages all the time, but it can also be annoying, because things like spamfilters and virusscanners are fast-moving and you often end up with old versions of those. That is why the Debian volatile project exists.

On new installs, the packages sources will already be in /etc/apt/sources.list, but the sources.list doesn’t seem to be upgraded on old systems, so you may need to add them by hand. These are the sources:

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main 

It’s speaks for itself that you have to change lenny to whatever the release will be…

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑