Think Tank Workspaces

VMX Configuration

This ran perfect but only as glenda. Also I had to copy over 9pc from another system. Not sure why cross-compile was not working

Verify before running VMX

cpu% aux/icanhasvmx
VMX is supported

Running 9front on 9front? not sure why

cpu% vmx -M 1G -d 9front-11091.amd64.iso -n ether0 -v 640x480 9pc
vmx: open: permission denied: '#X/clone'
cpu% 

You must run this as glenda or add yourself to /adm/users

cpu% cat /adm/users
-1:adm:adm:glenda
0:none::
1:tor:tor:
2:glenda:glenda:
3:william:william:

Openbsd example

Expired

term% hget https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/bsd.rd > bsd68.rd
term% hget https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/bsd > bsd68
term% hget https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/install68.img > install68.img

This should work

hget https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/bsd.rd > bsd77.rd
hget https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/bsd > bsd77
hget https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/install77.img > install77.img

Download using pager

hget -o install77.img https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/install77.img |[2] aux/statusbar 'big file download'

Make an empty disk

It might be better to make it 20Gig's so you can experiment with packages like

pkg_add -i firefox
pkg_add -i dillo
pkg_add -i netsurf

dd </dev/zero -of obsd.disk -bs 1 -count 1 -seek `{echo 16*1024*1024*1024-1 | pc -n}

The command to run it is as follow:

But you can only run it once then you have to reboot otherwise you just don't have enough memory

vmx -d install77.iso -d install77.fs -v vesa:640x480 bsd.rd

You need to run the following:

echo stop >> '#X/0/ctl'
echo quit >> '#X/0/ctl'

This should free up some memory so you don't have to reboot all the time. Why is this so hard to find in the documentation.

Also bsd.rd is compressed. I had to copy to macbook because for some reason I could not unzip/gunzip or untar or whatever. Mac uncompressed it just fine. Then I copied bsd.rd back and it worked perfectly.

Script install and start

I commented out the first two echo statements because most of the time I manually run the command while doing debugs. But you might need it in the future as good practice. I can't tell you how many times I have crashed my system and these two statements will save you from all of that trouble.

install.rc

#!/bin/rc
ARCH=/usr/william/openbsd
OBSD=77
#echo stop >> '#X/0/ctl'
#echo quit >> '#X/0/ctl'
vmx -M 1G                     \
    -n ether0                 \
    -d obsd.disk              \
    -d $ARCH/install$OBSD.img \
    -v vesa:1600x710          \
    $ARCH/bsd.rd
echo stop >> '#X/0/ctl'
echo quit >> '#X/0/ctl'

Here is the startup script after the installation completes

startup.rc

#!/bin/rc
rfork e
ARCH=amd64
OBSD=77
DISK=/usr/william/openbsd/obsd.disk
BSD=/usr/william/openbsd/bsd$OBSD
fn VmxStop{
  if(test -d '#X/0'){
    echo stop >> '#X/0/ctl'
    sleep 1
    echo quit >> '#X/0/ctl'
    sleep 1
  }
}
fn VmxStart{
  vmx -M 3G             \
    -n ether0         \
    -d $DISK          \
    -v vesa:1600x710  \
    $BSD 'device=sd0a'
}

VmxStop
VmxStart
VmxStop

installing linux

This was not exactly straight forward.

You need to download the iso for the install. You need to mount the iso and extract the initrd or ramdisk and kernel

example linux mint:

vmlinux.mint and initrd.lz

Debian:

initrd.gz and vmlinuz

Its not always easy to find for instance debian was in /install.amd directory. So you do have to hunt around and poke.

mount iso

9660srv
mount /srv/9660 /n/void void.iso
cp /n/void/boot/^(vmlinuz initrd) .
unmount /n/void
rm /srv/9660

gunzip initrd.gz if its zipped

install on linux

vmx -M 1G -n ether0 -d linux.disk -d ./debian-netinst.iso -v vesa:800x600 -m ./initrd.gz ./vmlinuz

To run it you skip the iso but keep track of the drive you run it under

vmx -M 1G -n ether0 -d linux.disk -v vesa:1600x710 -m ./initrd.img-6.1.0-37-amd64 ./vmlinuz-6.1.0-37-amd64 'root=/dev/vda1'

The tricky part here is you have to copy the kernel and ramdisk out of the install to the host system. So either have ssh or ftp or something turned on. You don't have to worry about this with BSD because those files already come with the installation media. Not only that you can run drawterm from OpenBSD to copy things back and forth. But after the install is complete it wants to reboot. I tried breaking out into the console to copy some files over and that was not possible. To get the ramdisk and kernel files I just needed to build them on my Macbook using UTM to install an OS then logged in and copied them over to 9front. So I had to use a completely different machine to get those files.

I did try some experiments with ext4sr4 but nothing seemed to work so I gave up on that path.

Break out of VMX

Use CTRL + ALT should free up the mouse.

Large files

VMX requires large files so its advisable to change the file permission so that its not backed up every night.

chmod +t vm.disk 

linux install script

install.rc

#!/bin/rc
ARCH=/usr/william/linux
OBSD=77
#echo stop >> '#X/0/ctl'
#echo quit >> '#X/0/ctl'
vmx -M 1G                     \
    -n ether0                 \
    -d linux.disk              \
    -d $ARCH/debian-netinst.iso \
    -v vesa:1600x710          \
    -m $ARCH/initrd			\
    $ARCH/vmlinuz
echo stop >> '#X/0/ctl'
echo quit >> '#X/0/ctl'

start.rc

#!/bin/rc
rfork e
DISK=/usr/william/linux/
IMG=linux.disk
fn VmxStop{
  if(test -d '#X/0'){
    echo stop >> '#X/0/ctl'
    sleep 1
    echo quit >> '#X/0/ctl'
    sleep 1
  }
}
fn VmxStart{
  vmx -M 1G             \
    -n ether0         \
    -d $DISK/$IMG        \
    -v vesa:1600x710  \
	-m $DISK/initrd.img-6.1.0-37-amd64	\
    $DISK/vmlinuz-6.1.0-37-amd64 'root=/dev/vda1'
}

VmxStop
VmxStart
VmxStop

Remember to stop and quit

Use this often

echo stop >> '#X/0/ctl'
echo quit >> '#X/0/ctl'

Performance

I spend most of my time on my Macbook with 9front installed in UTM(qemu). It does 90% what I need. But not great at VM. I decided I wanted to try 9front as bare metal to see how well it performs. I erased OSX from my Macmini. This is an older model with Intel chip and installed 9front. Then tried to run VMX. SInce I have an older model I couldn go beyond 'vmx -m 2G'. I just don't have enough memory. It was nice to have Openbsd installed on a 16G disk file. I'm still not sure its big enough.

I used automatic partitioning and I barely have enough space. You really need 20G disk file. I did manage to install dillo, netsurf and firefox. Firefox was simply too slow and unusable. Everything else worked perfectly. Drawterm in OpenBSD worked great as well.

Surprisingly debian performed better than OpenBSD. Not only did firefox work I was able to play youtube files. I just don't think Firefox is optimized to perform well on OpenBSD because of the security focus. Either way 9front on bare metal is very nice and i'm glad to salvage an old Macmini.


To post a comment you need to login first.