installs

Debian GNU Hurd K16 with Qemu

[Updated Tuesday, December 29, 2009 1100 IST]

This is documentation for Debian GNU Hurd K16 with qemu on Compaq nx7400 laptop with a Finnish keyboard.

I set "us" keyboard layout before using it with qemu:

$ setxkbmap us

Create a test directory

$ mkdir k16
$ cd k16/

Download grub-0.97-i386-pc.ext2fs from:

$ wget http://mirrors.ibiblio.org/pub/mirrors/gnu/alpha/gnu/grub/grub-0.97-i386-pc.ext2fs

Hurd-K16 .iso creation

If you have an .iso image, you can use it directly, else, insert the CD and create an .iso image first. Replace /dev/hda with your CD device file:

$ dd if=/dev/hda of=debian-K16-hurd-i386-CD1.iso
$ qemu-img create hurd-k16.img 3G

Install the base system

Run the following:

$ qemu -boot d -hda hurd-k16.img -cdrom debian-K16-hurd-i386-CD1.iso

and proceed with GNU Hurd installation:

3.1 Selected the US qwerty keyboard layout (or others of your choice).

3.2 Choose "Partition a Hard Disk" and create a primary partition with type 0x83.

3.3 Initialize the GNU Hurd partition.

3.4 Install the Base System

Reboot.

Setup grub (with -s)

$ mkdir grub
$ sudo mount -o loop grub-0.97-i386-pc.ext2fs grub

Edit the menu.lst file with your favorite editor:

$ sudo emacs grub/boot/grub/menu.lst

Use the following in your menu.lst file:

title GNU Hurd
root (hd0,0)
kernel (hd0,0)/boot/gnumach.gz root=device:hd0s1 -s
module /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create)$(task-resume)
module /lib/ld.so.1 /hurd/exec $(exec-task=task-create)

Remember to put the "-s" option to kernel to boot in single user-mode.

$ sudo umount grub

Native-installer (twice)

$ qemu -boot a -hda hurd-k16.img -fda grub-0.97-i386-pc.ext2fs -M isapc

At the Hurd prompt, do the following:

hurd# export TERM=mach
hurd# ./native-install

Reboot.

hurd# export TERM=mach
hurd# ./native-install

Set ENABLE to 'true' in /etc/default/hurd-console.
Halt.

Remove -s in kernel option in grub

$ sudo mount -o loop grub-0.97-i386-pc.ext2fs grub

Remove the -s from the kernel line:

$ sudo emacs grub/boot/grub/menu.lst

title GNU Hurd
root (hd0,0)
kernel (hd0,0)/boot/gnumach.gz root=device:hd0s1
module /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create)$(task-resume)
module /lib/ld.so.1 /hurd/exec $(exec-task=task-create)

$ sudo umount grub

Run Hurd in multi-user mode

This time run without "-M isapc".

$ qemu -boot a -hda hurd-k16.img -fda grub-0.97-i386-pc.ext2fs

Login as root using "login root".

Configuring ethernet

Add the following to a set-eth.sh script, so it can be used to configure ethernet.

hurd# settrans -fgap /servers/socket/2 /hurd/pfinet -i eth0 -a 10.0.2.16 -g 10.0.2.2 -m 255.255.0.0
hurd# echo "nameserver 10.0.2.3" > /etc/resolv.conf

Enable executable permission for it, and execute it:

hurd# chmod +x set-eth.sh
hurd# sh set-eth.sh

Updating sources.list

Update /etc/apt/sources.list file using nano:

nano /etc/apt/sources.list

deb http://ftp.de.debian.org/debian unstable main
deb-src http://ftp.de.debian.org/debian unstable main
deb http://ftp.debian-ports.org/debian-hurd unstable main
deb http://ftp.debian-ports.org/debian-hurd unreleased main
deb http://ftp.debian-ports.org/debian-hurd experimental main

ssh between host and Hurd

Boot into Hurd running on qemu and set a root password:

hurd# passwd

Setup random, urandom:

hurd# cp /bin/bash /dev/random
hurd# cp /bin/bash /dev/urandom

Install ssh, openssh-client, openssh-server:

hurd# apt-get install ssh openssh-client openssh-server

Set UsePrivilegeSeparation to no in /etc/ssh/sshd_config:

UsePrivilegeSeparation no

Create rsa, dsa keys at /etc/ssh:

hurd# ssh-keygen -t rsa -b 1024
hurd# ssh-keygen -t dsa -b 1024

You should have ssh_host_dsa_key, ssh_host_dsa_key.pub, ssh_host_rsa_key and ssh_host_rsa_key.pub in /etc/ssh.

Add sshd entry at the bottom of /etc/passwd:

sshd:x:101:65534::/var/run/sshd:/usr/sbin/nologin

You can test if sshd is running properly by starting the server using:

hurd# /etc/init.d/ssh start

Stop Hurd running on qemu and restart it with the following options, now with redir:

qemu -boot a -hda hurd-16.img -fda grub-0.97-i386-pc.ext2fs -redir tcp:2222:10.0.2.16:22

Login to GNU Hurd, and make sure you use the set-eth.sh script above to configure the IP address to 10.0.2.16. Check to see if sshd is running, else start it (with /etc/init.d/ssh start):

hurd# ps -ae | grep ssh
root 88 - Ssfo 0:00.05 /usr/bin/sshd

From the host system ssh into GNU Hurd running on qemu using:

hurd# ssh root@localhost -p 2222

If you would like to transfer files from the host into GNU Hurd, you can scp:

hurd# scp -P 2222 filename root@localhost:/tmp

If you don't want root access, create a user account, set a password for it and use it. You can ssh from the Hurd to the host system (that is running sshd) using:

hurd# ssh user@10.0.2.2