Qemu
A lot has been published on the 9front project/fork/distro installation and running in Qemu. Find and use them all.
So here are a few quick starts and reminders
install
Grab a tutorial or two and get started!
But in essence, download a release iso.
Create a qemu disk image:
qemu-img create -f qcow2 9front_terminal.qcow2 4G
Start Qemu with created disk image and downloaded iso:
qemu-system-x86_64 -cpu host -enable-kvm -m 4096 -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user -device virtio-scsi-pci,id=scsi -drive if=none,id=vd0,file=9front_terminal.qcow2 -device scsi-hd,drive=vd0 -drive if=none,id=vd1,file=9front-9442.amd64.iso -device scsi-cd,drive=vd1,bootindex=0
Start the installation:
inst/start
Follow the instructions in the terminal or any tutorial for more in depth explanation.
run
Once installed, run the qemu instance
Terminal instance
Remove the iso and boot.
qemu-system-x86_64 -cpu host -enable-kvm -m 4096 -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user -device virtio-scsi-pci,id=scsi -drive if=none,id=vd0,file=front_terminal.qcow2 -device scsi-hd,drive=vd0
Terminal instance with multiple Qemu images
Mount multiple Qemu images for accessing data on backup images, transferring data between SD cards or resizing partitions.
emu-system-x86_64 -cpu host -enable-kvm -m 4096 -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user -device virtio-scsi-pci,id=scsi -drive if=none,id=vd0,file=9front_terminal.qcow2 -device scsi-hd,drive=vd0 -drive if=none,id=vd1,file=9front_extra.qcow2 -device scsi-hd,drive=vd1 -drive if=none,id=vd2,file=RpiOne_2023-09-15_baseInstall.img -device scsi-hd,drive=vd2
enable drawterm login on qemu instance
A quality of life step: propper keyboard support, C&P text while testing, easily access host <==> guest files, ...
To achieve this: "just" configure networking to point to cpu and auth service, set a proper password for your user and set boot parameters to boot into cpu service.
set up network (need to know where services are located)
Then write down network settings that were (hopefully) set durring install or acquired with dhcp:
ndb/query sys QemuTerm
or
netaudit
Edit network settings for this machine:
acme /lib/ndb/local
Example of a correct configuration to be placed at the end of the file. Don't forget for an empty line at the end. Yes, the tab formatting in the config is important.
auth=QemuTerm authdom=9front
ipnet=9front ip=10.0.2.0 ipmask=255.255.255.0
ipgw=10.0.2.2
dns=8.8.8.8
auth=QemuTerm
dnsdom=9front
cpu=QemuTerm
fs=QemuTerm
sys=QemuTerm ether=52540000ee03 ip=10.0.2.15
change service from terminal to cpu
Mount FAT boot partition and edit plan9.ini:
9fs 9fat
cd /n/9fat
acme plan9.ini
Add "service=cpu" to the end of the file!
While here also add bootargs:
# For hjfs:
bootargs=local!/dev/sd00/fs -m 256 -A -a tcp!*!564
#For cwfs
bootargs=local!/dev/sd00/fscache -a tcp!*!564
Substitute "sd00" and "-m 265" for your values already present.
Example of edited plan9.ini:
bootfile=9pc64
nobootprompt=local!/dev/sd00/fs -m 256 -A -a tcp!*!564
mouseport=ps2intellimouse
monitor=vesa
vgasize=1280x720x16
user=glenda
tiltscreen=none
service=cpu
reboot
fshalt -r
After rebooting, the system will want to know some parameters:
bad nvram key
bad authentication id
bad authentication domain # You may not see these errors.
authid: <glenda>
authdom: <9front>
secstore key:
password: [glenda’s password]
Enter glenda
for authid
, 9front
(or anything you want) for authdom
, hit return for secstore
key, and enter a password.
Also the instance will be in raw rc terminal.
To enable graphics back, and with that acme:
termrc
rio
set user passwd
Set the actual password for the user
auth/changeuser glenda
(optionaly) start graphics in cpu and/or drawterm
Add a /rc/bin/cpurc.local file with custom commands:
acme /rc/bin/cpurc.local
Example of comands to start graphics in Qemu instance:
# Interject and start a terminal
termrc
. /usr/$user/lib/profile &
#rio -i /usr/$user/bin/rc/riostart # uncomment to start rio
Add extra commands to users profile to stat graphics in Qemu instance (comment out the line in cpurc.local) and drawterm.
Add after "fn cpu%{ $ }": # custom addtition to work woth /bin/cpurc.local if(! webcookies >[2]/dev/null) webcookies -f /tmp/webcookies webfs plumber rio -i riostart -s
start Qemu instance with forwarded ports
Auth service needs ports below 1000, so thez need to be rebinded somewhere to start the Qemu instance without extra privileges
qemu-system-x86_64 -cpu host -enable-kvm -m 4096 -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user,hostfwd=tcp::17019-:17019,hostfwd=tcp::17020-:17020,hostfwd=tcp::17567-:567 -device virtio-scsi-pci,id=scsi -drive if=none,id=vd0,file=/home/j/Projects/Plan9/9front_terminal.qcow2 -device scsi-hd,drive=vd0
connect with drawterm
drawterm -a 'tcp!localhost!17567' -h localhost -s localhost -u glenda