0%

Setup your ubuntu server in iPadOS with UTM

This is the note on serving your Ubuntu server from iPadOS/ iOS with UTM, I am running 0.8 now.

Download image

1
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img

Configure Password for the image, here we use chroot instead of config drive, the reason is at bottom.

Use chroot to set password for the cloud image as follow:

1
2
3
4
5
6
7
8
9
$sudo modprobe nbd max_part=1
$sudo qemu-nbd --connect=/dev/nbd0 bionic-server-cloudimg-amd64.img
$mkdir -p /mnt/nbd
$sudo mount /dev/nbd0p1 /mnt/nbd/ -o noatime
$chroot /mnt/nbd
ubuntu# passwd
ubuntu# exit
$sudo qemu-nbd --disconnect /dev/nbd0
$sudo umount /dev/nbd0p1

Use cloud drive is with ISSUES on UTM, as the nic mac address was fetched as 00:00:00:00 and it won’t proceed to configure the user data we put in the cloud drive…

1
RuntimeError Not all expected physical devices present 00:00:00:00

In case it worked someday, you could simply do it as follow:

Let’s reuse the script created by Jan Walraven, ref: here

1
2
brew install qemu coreutils cdrtools
./createIso.sh --cloud-config cloud-config.yml --name user-data

Or in Debian

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo apt install qemu-utils cloud-utils

cat > user-data <<EOF
#cloud-config
users:
- default
- name: <user>
passwd: <psw>
ssh_pwauth: True
chpasswd: { expire: False }
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
ssh_authorized_keys:
- ssh-rsa <key>
EOF

cloud-localds config_drive.iso user-data

Add above iso image to VM and mounted as a CD device, boot from your HDD device(the cloud image), it should configure yor password and ssh key as above user-data.