Archive for the 'Linux' Tag

How to make a UML image on Debian

Tuesday, February 13th, 2007

Out there, on the Internet, there is a lot of conflicting information on how to properly build a UML image on Debian. These instructions are for Debian Sid, but should work on Etch and Sarge as well. The instructions are partially based on the ones available here.

First, you want to apt-get install user-mode-linux uml-utilities bridge-utils debootstrap realpath. Then, become root either by su or sudo bash. Make an empty directory (such as ~/uml) and cd into it. Now, follow this psudeo script:

# setup environment, feel free to change DEBIAN_MIRROR to your closest mirrror, IP to an IP not already being used on your network, and GATEWAY to your LAN’s gateway (not your host machine)
export TMPDIR=`pwd`"/tmp"
export IMAGE="root_fs"
export DEBIAN_MIRROR="ftp://ftp.debian.org/debian/"
export HOSTNAME="NameThisMachine"
export IP="a.ip.to.use"
export GATEWAY="ip.to.talk.to"
mkdir $TMPDIR

# produce a 1GB image, fudge with seek to change size
dd if=/dev/zero of=$IMAGE bs=1 count=1 seek=1G

# make partition, and mount it; Debian Sid kernels can only mount ext2, ext3, cramfs, iso9660, and reiserfs, ext3 is the only one worth using
mkfs.ext3 $IMAGE
mount -o loop $IMAGE $TMPDIR

# download and install Debian into your image: change arch to the arch you’re using, and change sid to sid, etch, or sarge; this step takes awhile
debootstrap --arch i386 sid $TMPDIR $DEBIAN_MIRROR

# install a correct fstab, proc and sys are automatically loaded on boot
echo "/dev/ubd0 / ext3 defaults 0 0" > $TMPDIR/etc/fstab
echo $HOSTNAME > /etc/hostname

# tweak inittab
cp $TMPDIR/etc/inittab $TMPDIR/etc/inittab.save
grep -v "getty" $TMPDIR/etc/inittab.save > $TMPDIR/etc/inittab
echo "# We launch just one console for UML:" >> $TMPDIR/etc/inittab
echo "c0:1235:respawn:/sbin/getty 38400 tty0 linux" >> $TMPDIR/etc/inittab
echo "# UML modification: use tty0 or vc/0" >> $TMPDIR/etc/securetty
echo "tty0" >> $TMPDIR/etc/securetty
echo "vc/0" >> $TMPDIR/etc/securetty

# add networking stuff
echo "auto lo" >> $TMPDIR/etc/network/interfaces
echo "iface lo inet loopback" >> $TMPDIR/etc/network/interfaces
echo "" >> $TMPDIR/etc/network/interfaces
echo "auto eth0" >> $TMPDIR/etc/network/interfaces
echo "iface eth0 inet static" >> $TMPDIR/etc/network/interfaces
echo "address $IP" >> $TMPDIR/etc/network/interfaces
echo "netmask 255.255.255.0" >> $TMPDIR/etc/network/interfaces
echo "gateway $GATEWAY" >> $TMPDIR/etc/network/interfaces

# clean up
umount $TMPDIR
rmdir $TMPDIR

You now have an image full of Debian named root_fs. To run, simply execute linux mem=64M ubd0s=root_fs. If you need more memory, increase the mem paramater. By default, there is no password for root, so just use root as your login and press enter when it asks for password.

A little aside on networking:the auto tuntap method (eth0=tuntap,,,the.ip.to.use, which basically does ARP proxying on the host machine) does not work properly as it only allows host->UML traffic. The only way I’ve been able to get UML networking to work properly is to build a full bridge setup. The following commands in /etc/network/interfaces/ sets up the bridge. You probably have something like:

auto eth0
iface eth0 inet dhcp

Comment that out with #s, and change it to:

auto br0
iface br0 inet dhcp
pre-up tunctl -u user-to-run-uml -t tap0
pre-up ifconfig eth0 0.0.0.0 promisc up
pre-up ifconfig tap0 0.0.0.0 promisc up
pre-up brctl addbr br0
pre-up brctl stp br0 off
pre-up brctl setfd br0 1
pre-up brctl sethello br0 1
pre-up brctl addif br0 eth0
pre-up brctl addif br0 tap0
post-down tunctl -d tap0

allow-hotplug eth0
iface eth0 inet manual
pre-up ifconfig eth0 0.0.0.0 promisc up
pre-up brctl addif br0 eth0
pre-down brctl delif br0 eth0
pre-down ifconfig eth0 down

Add the additional parameter to linux’s command line: eth0=tuntap,tap0. That will make UML connect to tap0, and use the IP set above when you built the image. If you use a firewall, you need to change the interface to firewall from eth0 to br0, and to allow br0->br0 traffic.

New Video Card: XFX Geforce 6800XT

Wednesday, October 11th, 2006

Well, I’m finally done with ATI’s poor driver support. For 12 months I’ve waited for fglrx drivers to improve, and to no avail, they still suck as bad as the day I installed my Radeon 9600 Pro. And, to no actual fault of DRI’s (they work as fast as they can), my card is not yet supported by the DRI R300 driver, as documented earlier.

So, I’ve replaced it with a new video card: XFX PVT42KUDE3 Geforce 6800XT 256MB 256-bit GDDR3 AGP for only $110 after rebate. It’s not worth buying a top of the line card, as AGP is already dead, and my next system will not be able to use it; plus, this is card is a good three or four times more powerful than the one I have now. moo

Switch to Debian

Thursday, September 7th, 2006

I’ve finally decided to switch back to Debian. In fact, I did so about a week ago. Both my workstation and laptop now run Debian; and I’m much happier with Debian than I ever was with Ubuntu.

Way back when, I was one of the first people to switch to Ubuntu, under the promise of both Mark Shuttleworth and his people, and all of the Debian developers switching sides (apparently, since then, many of those developers either develop for both Debian and Ubuntu now, or switched back to Debian only), that Ubuntu would be what Debian was supposed to be: an easy to maintain, perfectly stable, often updated, desktop distro.

I believe, now, that Ubuntu is none of those things. Ubuntu, instead, is nothing but an attempt to turn Debian into something like Fedora: a desktop distro that puts user friendlyness over sane software development.

I deleted my /bin, /sbin, and /usr/* directories, and appended .old to /etc, /home, and /var, and used the 20060829 daily built Etch Debian-Install netinst CD to install in my already existing parition. I can say the new installer is way better than the one I used back in the Potato days (which was the last time I actually installed Linux on my workstation, I only dist-upgraded to Ubuntu instead of reinstalling).

I’m actually surprised how modern this installer is. For one, which surprised me, is that it automatically detects and sets up my Firewire port to be able to network on, the only flaw here is that it gives me an option of using eth1 as my default network adapter but doesn’t actually tell me eth1 is my Firewire port.

Second, it can automatically retrieve my computer’s hostname and domain because I statically assign IP and FQDN based on MAC with dnsmasq (which provides both dhcpd and dnsd) on my router. It saves me a few keystrokes, sure, but it is still a neat feature.

The only missing features I’d like to see is a mention of console output on F5, and a terminal on F2, which I only knew were there from previous experience with Debian installers. Plus, I’d also like to see the ability to add a pre-existing directory to use debs from, so I don’t have to re-download things if I already have downloaded them once.

After install, I quickly ugraded to Sid.

A few other things I noticed Debian has and Ubuntu doesn’t, is that Debian’s apt-get now has the abilty to download just the updated parts of a package index instead of the whole index (on supported mirrors, anyways). Even on DSL, downloading 5+ megs of package indexes takes a good 30 to 45 seconds, now it just takes less than 5.

In addition, and I’m not sure what caused this, I no longer have very sluggish apt-get performance when installing or removing packages. I think this may be because my Debian install was ancient and had eventually gotten dpkg’s various state files gummed up, but where a simple apt-get install of a small package would take a few minutes, it now takes a few seconds.

All in all, Debian is still the distro I remember it: clean, lean, well designed, a dream to administer, and not bloated to hell and back with lots of defaultly installed packages no one uses. Also, is it me, or does Debian also boot a good ten seconds faster than Ubuntu?

Religion and Linux

Thursday, August 3rd, 2006

“Almighty God hath created the mind free; that all attempts to influence it by temporal punishments, or burthens, or by civil incapacitations, tend only to beget habits of hypocrisy and meanness, and are a departure from the plan of the Holy author of our religion who being Lord both of body and mind, yet chose not to propagate it by coercions on either . . .; that to compel a man to furnish contributions of money for the propagation of opinions which he disbelieves, is sinful and tyrannical; that even the forcing him to support this or that teacher of his own religious persuasion, is depriving him of the comfortable liberty of giving his contributions to the particular pastor, whose morals he would make his pattern …”

– Thomas Jefferson, A Bill for Establishing Religious Freedom

“Believing with you that religion is a matter which lies solely between man and his God, that he owes account to none other for his faith or his worship, that the legislative powers of government reach actions only, and not opinions, I contemplate with sovereign reverence that act of the whole American people which declared that their legislature should “make no law respecting an establishment of religion, or prohibiting the free exercise thereof,” thus building a wall of separation between church and State.”

– Thomas Jefferson, 1802 letter to the Danbury Baptist Association

Today I found out about a little Ubuntu fork called Christian Ubuntu. As far as I can tell, it exists with the full knowledge of not only Mark Shuttleworth, but with his and many of the developer’s blessing. As such, Ubuntu inadvertantly promotes Christianity.

And I find this offensive.

I messaged the Ubuntu-devel mailing list over my concerns over the existance of Christian Ubuntu, and at the time, I did not know that Ubuntu apparently supports their efforts. For my attempt to warn the Ubuntu developers of this gross misuse of the Ubuntu name, logo, and trademark, I was called a troll because I found Christian Ubuntu offensive.

Yeah, you heard me; apparently finding Christian Ubuntu offensive and alerting Ubuntu about the existance of the distro, I am trolling. According to this logic, Thomas Jefferson is trolling because he believes in a seperation of church and state.

To paraphrase Jefferson: to compel a man to furnish contributions of code and development resources for the propagation of opinions which he disbelieves, is sinful and tyrannical. I contemplate with the sovereign reverence that act of the whole Linux development community which declaired that their code be used to help all of mankind no matter race, religion, or class, that their licensing should, “make no rule respecting an establishment of religion, or prohibiting the free exercise thereof,” thus building a wall of seperation between church and Linux.

Linux Kernel Mailing List Size

Saturday, July 29th, 2006

Wow, I just was cleaning out my Gmail account to cut down on the size (it was over 75% full), and I deleted all the mail sent to LKML. Over 23 thousand conversations since July 2004, taking up a little over 500 megs.

Effectively, the LKML produces a quarter of a gig of archives every year, which is amazing.