Record of some of the computer tech I deal with so that it's documented at least somewhere.

Wednesday, 14 November 2007

Installing Debian to AOE target

I'm using pxeboot to run the Debian installer, though the CD works just as well.

Run the installation as normal, in expert mode. Be running a vblade somewhere on the LAN. After starting the network but before detecting disks download the appropriate kernel aoe.ko for the installer Kernel, no mean feat. I had to install 2.6.18-5.486 on to a machine and copy it off.

Alt-f2 for a new console, Alt-f1 to go back, you get the idea.
Mine was
http://www.proweb.co.uk/~matt/aoe/aoe.ko-2.6.18-5-486
Cripes I have to promise to send you the source code now if you download this or else I'll have Stinky Stallman on my back, imagine that !

Save it in tmp and insmod the fucker. I changed its name to /lib/modules/2.6.18-5-486/kernel/drivers/block/aoe/aoe.ko but I don't know if you have to.

Skip/after detect disks I had to rm /dev/hda && ln -s /dev/etherd/e7.7 /dev/hda before partitioning. It picks up the right block device after de-referencing.

blah blah installing as normal all one partition, no swap, grub can't install on it

Eventually you get "Installation is complete" and a <Go Back >
<Continue> choice.

Now it's hack time. Crack open the initrd.img the installer just made

# chroot /target
# mkdir /tmp/initrd && cd /tmp/initrd
# gunzip < /initrd.img | cpio -i --make-directories

Now /tmp/initrd has a copy of the initramfs it'll boot from. To make it easier later to use mkinitramfs and update-initramfs copy things to /tmp/initrd and /target
I got the scripts from http://www.etherboot.org/wiki/sanboot/debian_and_ubuntu

# apt-get install aoetools
# cp /sbin/aoe-discover /tmp/initrd/sbin/
# cd /etc/initramfs-tools/
# wget http://www.proweb.co.uk/~matt/aoe/hooks -O hooks/aoetools
# wget http://www.proweb.co.uk/~matt/aoe/scripts -O scripts/aoetools
# chmod 755 hooks/aoetools scripts/aoetools
# cp scripts/aoetools /tmp/initrd/scripts/

Then make the initrd.img again

# cd /tmp/initrd
# find . | cpio -o -H newc | gzip -9 > /boot/initrd.aoe


Then get it off the machine and on to the TFTP server.

# scp /boot/initrd.aoe TFTP:/var/lib/tftpboot/



One of the fun things is that you can mount the AOE share on any machine and edit stuff, great if you find you need to tweak /etc/hosts or /etc/fstab later.
I mount mine
/dev/etherd/e7.7p1 / ext3 sync,noatime,errors=remount-ro 0 1
I'm going to try readonly sometime.

Thursday, 8 November 2007

DVD burning using AOE

NB: I went back to copying the ISO to a partition and serving that partition and burning from a regular file, I can't remember why atm.


I was hoping that one could vblade 1 1 eth0 /dev/hdc but I get a "read only filesystem" error.

The extra block is for the ext2 file system

# dd 'if=/dev/zero' 'of=/tmp/iso.vblade' 'bs=1k' 'count=' ^`{du some.iso | awk ' { print $1 + 1 } '}
# mkfs -t ext2 /tmp/iso.vblade
# mount -o loop /tmp/iso.vblade /mnt
# cp some.iso /mnt/iso
# umount /mnt
# vbladekey=$pid
# vblade 2 2 eth1 /tmp/iso.vblade &
# vbladekey=''
# ssh MACHINEWITHDVDBURNER
% sudo mount /dev/etherd/e2.2 /mnt
% wodim -dao - < /mnt/iso
% sudo umount /mnt
% ^D
# kill `{ps axwe | grep 'vbladekey=' ^$pid | grep -v grep | awk ' { print $1 } ' }


I hope this worked because I've burned & printed 50 disks from the master I made. I'd better check them before I hand them over :)

Wednesday, 7 November 2007

Creating a new plan9 kernel config

Add your kernel name to /sys/src/9/pc/mkfile
in my case pcqi, an installer floppy for qemu.
Decide if your kernel is a CONFLIST or a CRAPLIST member.
Seeing as the other craps are cd and floppy I think I want to be CRAP because I'm an installer with a bzroot.

Create your file, I suggest copying a similar config, in my case pcflop

The kernel config file works by concatenating dev with all the first column words to create a filename which should exist in 9/pc or 9/port.

i.e.
dev
root
arch

devroot.c is in 9/port
devarch.c is in 9/pc

the third column is a plain c file dependency i.e.
dev
ether netif
uses pc/devether.c and port/netif.c

+cur and =cur are parameters for using hardware/software cursors

bootdir

these files are copied to /boot/
if there is two words the second is the filename
i.e.
bootdir
/sys/lib/dist/bin/386/bzfs kfs

this will copy bzfs to /boot and call it kfs
the filename bzroot is special as this will be mounted on / on boot
by whatever you rename as kfs

I've gone quite aggressive in pulling bits out of the kernel, it's qemu after all, the file will probably end up on /n/sources/contrib/maht/qemu/pcqi

To fill in bzroot you have to go to /sys/lib/dist/pc and mk /sys/src/9/pc/9pcflop.gz


cd /sys/lib/dist/pc
mk root.bz2
mk /sys/src/9/pc/9pcqi.gz

Monday, 5 November 2007

Roll your own plan9 iso

I wiped my mkfile by accident by killing the wrong qemu

I edited /sys/lib/dist/pc/sub/termrc [edit fixed this from a comment, thanks i]
added the aoe device, forgot to add the sdaoe device but that's just a user bind anyway - bless plan9

You need write permission on /sys/src/9/pc to build 9pcflop.gz

To be horrible and build it from sources do this :
cd ; mkdir -p other/dist; bind -bc other /n/other; cd /sys/lib/dist/cmd; mk install && mk clean; cd multi ; mk install; mk scripts; mk clean; cd ../..; mk /n/other/dist/plan9.iso

I frigged the mkfile to use '#s/root' instead of /n/sources

and then I pressed Ctrl^c while tidying up the desktop while waiting for the iso to build doh! and then when I restarted the mkfile was dargon empty

Friday, 2 November 2007

Booting Debian with AOE

Here's how I did it (after much trial and error :)

Install a fresh system on a HD machine (though I used a 2Gb Flash CF card)

Get the two scripts from here

http://www.etherboot.org/wiki/sanboot/debian_and_ubuntu

/etc/initramfs-tools/hooks/aoetools
/etc/initramfs-tools/scripts/local-top/aoetools

(remember to chmod +x them or you have to do it over like me :)

edit /etc/fstab

proc /proc proc defaults 0 0
/dev/etherd/e686.1p1 / ext3 noatime,errors=remount-ro 0 1
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0


Make the symlink /initrd point to /boot/initrd.aoe
(though this can be set at DHCP time)

then mkinitramfs -o /boot/initrd.aoe

I think you can use update-initramfs but I didn't

The HD should now be the image you want to see when you boot it over AOE so it is time to copy it over.

fdisk /dev/etherd/e686.1
mkfs -t ext3 /dev/etherd/e686.1p1
mkdir /mnt/e686.1p1
mount /dev/etherd/e686.1p1 /mnt/e686.1p1


I wonder if Linux has a program that uses plan9 proto files, they must have started out on Unix

cp -r --preserve=all bin /mnt/e686.1p1/
cp -r --preserve=all boot /mnt/e686.1p1/
mkdir /mnt/e686.1p1/cdrom
cp -r --preserve=all dev /mnt/e686.1p1/ # I think I copied too much though
cp -r --preserve=all etc /mnt/e686.1p1/
cp -r --preserve=all home /mnt/e686.1p1/
cp -r --preserve=all initrd /mnt/e686.1p1/
cp -r --preserve=all initrd.img /mnt/e686.1p1/
cp -r --preserve=all lib /mnt/e686.1p1/
mkdir /mnt/e686.1p1/media
mkdir /mnt/e686.1p1/mnt
cp -r --preserve=all opt /mnt/e686.1p1/
mkdir /mnt/e686.1p1/proc
cp -r --preserve=all root /mnt/e686.1p1/
cp -r --preserve=all sbin /mnt/e686.1p1/
cp -r --preserve=all selinux /mnt/e686.1p1/
cp -r --preserve=all srv /mnt/e686.1p1/
mkdir /mnt/e686.1p1/sys
mkdir /mnt/e686.1p1/tmp
cp -r --preserve=all var /mnt/e686.1p1/
cp -r --preserve=all vmlinuz /mnt/e686.1p1/




On your DHCP/tftp server

this goes in your pxelinux.cfg/default

LABEL e686.1
kernel vmlinuz-2.6.18-5-686
append vga=normal initrd=initrd.aoe root=/dev/etherd/e686.1p1 rootfstype=ext3 --


Set the e686.1p1 to whatever yours is

nothing special in dhcpd.conf just the usual filename="pxeload";