XEN/PVH CRUX guest

grab the ISO from a mirror and prepare the required file-system archive

cd ~/ISO-IMAGES/
wget https://crux.mirror.garr.it/latest/iso/crux-3.6.1.iso
wget https://crux.mirror.garr.it/latest/iso/crux-3.6.1.md5
mkdir loop/
mount crux-3.6.1.iso loop/

proceed with the guest skeleton

mkdir -p ~/guests/crux/lala/
cd ~/guests/crux/

dd if=/dev/zero of=crux.butterfs bs=1GB count=0 seek=8
mkfs.btrfs -O list-all
mkfs.btrfs crux.butterfs
mount crux.butterfs lala/

dd if=/dev/zero of=crux.reiser4 bs=1GB count=0 seek=8
mkfs.reiser4 -dfy crux.reiser4
mount crux.reiser4 lala/

deploy the file-system

#bsdtar xJf ~//ISO-IMAGES/loop/rootfs.tar.xz -C lala/
for pkg in ~/ISO-IMAGES/loop/crux/core/*.tar.xz; do
    echo -n $pkg ...
    bsdtar xJf $pkg -C lala/ && echo done
done; unset pkg

du -sh lala/
# v3.6.1 -- 671M

push some kernel modules in there

ll lala/lib/modules/
tar xzf /data/kernels/5.2.21.domureiser4.modules.tar.gz -C lala/lib/modules/

and proceed with system preparation

echo modprobe tmem >> lala/etc/rc.modules
ls -lF lala/etc/rc.modules # already executable

vi lala/etc/rc # remove hwclock
vi lala/etc/rc.shutdown # remove hwclock
cp -pi lala/etc/fstab lala/etc/fstab.dist
vi lala/etc/fstab

/dev/xvda1 / btrfs defaults 0 0
#/dev/xvda1 / reiser4 defaults 0 1

cp -pi lala/etc/inittab lala/etc/inittab.dist
vi lala/etc/inittab

#c1:2:respawn:/sbin/agetty --noclear 38400 tty1 linux
c1:2:respawn:/sbin/agetty --noclear 115200 hvc0 xterm

(and remove c2 to c6)

vi lala/etc/rc.conf

TIMEZONE=Europe/Moscow
#TIMEZONE=Europe/Paris
HOSTNAME=crux

SERVICES=(lo net crond sshd)

vi lala/etc/profile

case "$-" in *i*)
    alias ll='ls --color=auto --group-directories-first -alh'
    alias ls='ls --color=auto --group-directories-first'
    alias cp='cp -i'
    alias mv='mv -i'
    alias rm='rm -i'
    ;;
esac

in case you want to reach the console without a password, you need first to define a password (renewal is enforced somehow) and only then delete it

chroot lala/ passwd root
chroot lala/ passwd --delete --unlock root
#chroot lala/ usermod --expiredate "" --inactive -1 --unlock root
#chroot lala/ usermod -p '*' root

setup networking

vi lala/etc/rc.d/net

TYPE="static"
...
DEV=eth0
ADDR=x.x.x.x
MASK=24
GW=x.x.x.x

# dedibox
cat > lala/etc/resolv.conf <<EOF
nameserver 62.210.16.6
nameserver 62.210.16.7
EOF

ready to go

umount lala/
rmdir lala/
vi crux

kernel = "/data/kernels/5.2.21.domureiser4.vmlinuz"
root = "/dev/xvda1 ro console=hvc0 net.ifnames=0 biosdevname=0 mitigations=off"
name = "crux"
vcpus = 2
memory = 1024
disk = ['file:/root/guests/crux/crux.butterfs,xvda1,w']
#disk = ['file:/root/guests/crux/crux.reiser4,xvda1,w']
vif = [ 'bridge=br0,vifname=crux0','bridge=br0,vifname=crux1' ]

#maxvcpus = 32
#memory = 7168

xl create crux -c

Post-installation & acceptance

curl -I https://www.opendns.com/

TODO

Make it a template

updatedb
history -c
#rm -f .bash_history
^]

xl shu crux

Toubleshooting

You are required to change your password immediately (administrator enforced)
login[266]: pam_unix(login:account): expired password for user root (root enforced)

I did not manage to avoid this issue while trying to setup a password-less root account

You are required to change your password immediately (administrator enforced)
usermod: PAM: Authentication token is no longer valid; new one required

Resources

crux

https://crux.nu/gitweb/?p=system/iso.git;a=tree

https://crux.nu/gitweb/?p=system/iso.git;a=blob;f=Makefile

https://crux.nu/Wiki/SignedPorts

handbook chapter 3 https://crux.nu/Main/Handbook3-4#ntoc9

handbook chapter 4 https://crux.nu/Main/Handbook3-4-Install

tar append

https://www.gnu.org/software/tar/manual/html_node/appending-files.html

https://www.crybit.com/add-files-to-an-existing-tar-archive/

https://www.tecmint.com/18-tar-command-examples-in-linux/

xen

https://pravinchavan.wordpress.com/2013/08/16/creating-paravirtualized-domain-on-xen/

https://wiki.xen.org/wiki/Blktap2


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5
Copyright © 2022 Pierre-Philipp Braun