I'm on Focal desktop, running kvm like so
qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \ -drive id=disk0,if=none,format=qcow2,file=bionic-bcache-links.qcow2 \ -device virtio-blk-pci,drive=disk0,bootindex=0 \ -drive id=disk1,if=none,format=raw,file=bcache1.img \ -device virtio-blk-pci,drive=disk1 \ -drive id=disk2,if=none,format=raw,file=bcache2.img \ -device virtio-blk-pci,drive=disk2 \ -drive id=cdrom0,if=none,media=cdrom,file=seed.img \ -device virtio-blk-pci,drive=cdrom0,bootindex=1 \ -net user,hostfwd=tcp::22222-:22 -net nic,model=virtio \ -monitor stdio -vnc 0.0.0.0:0 \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-pci,rng=rng0 \ -serial telnet:localhost:2446,nowait,server
The images are created with:
wget https://cloud-images.ubuntu.com/daily/server/server/bionic/current/bionic-server-cloudimg-amd64.img qemu-img create -f qcow2 -b bionic-server-cloudimg-amd64.img \ bionic-bcache-linux.qcow2 20G qemu-img create -f raw bcache1.img 10G qemu-img create -f raw bcache2.img 10G
cat <<EOF >user-data #cloud-config password: passw0rd chpasswd: { expire: False } ssh_pwauth: True ssh_authorized_keys: - | <your ssh key here> EOF
# you'll need cloud-image-utils package installed cat <<EOF >boot.sh #!/bin/bash BOOT=$1 SEED=${2-"seed.img"} USERDATA=${3-"user-data"}
[ ! -e ${SEED} ] && { [ ! -e ${USERDATA} ] && { echo "You need a 'user-data' file" exit 1; } [ ! -e meta-data ] && { echo "instance-id: $(uuidgen || echo i-abcdefg)" > meta-data } echo "Creating seed..." cloud-localds ${SEED} ${USERDATA} meta-data }
qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \ -drive id=disk0,if=none,format=qcow2,file=${BOOT} \ -device virtio-blk-pci,drive=disk0,bootindex=0 \ -drive id=disk1,if=none,format=raw,file=${DISK1} \ -device virtio-blk-pci,drive=disk1 \ -drive id=cdrom0,if=none,media=cdrom,file=${SEED} \ -device virtio-blk-pci,drive=cdrom0,bootindex=1 \ -net user,hostfwd=tcp::22222-:22 \ -net nic,model=virtio \ -monitor stdio \ -vnc 0.0.0.0:0 \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-pci,rng=rng0 \ -serial telnet:localhost:2446,nowait,server \ EOF
# watch the server boot with telnet localhost 2446
# ssh into the instance with ssh -p 22222 ubuntu@localhost
I'm on Focal desktop, running kvm like so
qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \ if=none, format= qcow2,file= bionic- bcache- links.qcow2 \ blk-pci, drive=disk0, bootindex= 0 \ if=none, format= raw,file= bcache1. img \ blk-pci, drive=disk1 \ if=none, format= raw,file= bcache2. img \ blk-pci, drive=disk2 \ if=none, media=cdrom, file=seed. img \ blk-pci, drive=cdrom0, bootindex= 1 \ tcp::22222- :22 -net nic,model=virtio \ filename= /dev/urandom, id=rng0 \ rng-pci, rng=rng0 \ localhost: 2446,nowait, server
-drive id=disk0,
-device virtio-
-drive id=disk1,
-device virtio-
-drive id=disk2,
-device virtio-
-drive id=cdrom0,
-device virtio-
-net user,hostfwd=
-monitor stdio -vnc 0.0.0.0:0 \
-object rng-random,
-device virtio-
-serial telnet:
The images are created with:
wget https:/ /cloud- images. ubuntu. com/daily/ server/ server/ bionic/ current/ bionic- server- cloudimg- amd64.img server- cloudimg- amd64.img \
bionic- bcache- linux.qcow2 20G
qemu-img create -f qcow2 -b bionic-
qemu-img create -f raw bcache1.img 10G
qemu-img create -f raw bcache2.img 10G
cat <<EOF >user-data keys:
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
ssh_authorized_
- |
<your ssh key here>
EOF
# you'll need cloud-image-utils package installed 2-"seed. img"} ${3-"user- data"}
cat <<EOF >boot.sh
#!/bin/bash
BOOT=$1
SEED=${
USERDATA=
[ ! -e ${SEED} ] && {
[ ! -e ${USERDATA} ] && {
echo "You need a 'user-data' file"
exit 1;
}
[ ! -e meta-data ] && {
echo "instance-id: $(uuidgen || echo i-abcdefg)" > meta-data
}
echo "Creating seed..."
cloud-localds ${SEED} ${USERDATA} meta-data
}
qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \ if=none, format= qcow2,file= ${BOOT} \ blk-pci, drive=disk0, bootindex= 0 \ if=none, format= raw,file= ${DISK1} \ blk-pci, drive=disk1 \ if=none, media=cdrom, file=${ SEED} \ blk-pci, drive=cdrom0, bootindex= 1 \ tcp::22222- :22 \ filename= /dev/urandom, id=rng0 \ rng-pci, rng=rng0 \ localhost: 2446,nowait, server \
-drive id=disk0,
-device virtio-
-drive id=disk1,
-device virtio-
-drive id=cdrom0,
-device virtio-
-net user,hostfwd=
-net nic,model=virtio \
-monitor stdio \
-vnc 0.0.0.0:0 \
-object rng-random,
-device virtio-
-serial telnet:
EOF
# watch the server boot with
telnet localhost 2446
# ssh into the instance with
ssh -p 22222 ubuntu@localhost