The cloud images that Canonical provides has the grub and linux console on the VGA port. This doesn't work so well for bhyve, where the graphical console only works with uefi. This document describes how to fix that using SmartOS.
The source image needs to include cloud-init 18.3 or later. Any Ubuntu 16.04 or later image produced by Canonical starting in July, 2018 should fit this criteria. The image in this example is described as Ubuntu 18.04.1 LTS (20180808 64-bit). Certified Ubuntu Server Cloud Image from Canonical..
src_uuid=96768413-88a7-43d6-867b-d74284d616d6
imgadm import $src_uuid
The following output is typical.
Importing 96768413-88a7-43d6-867b-d74284d616d6 (ubuntu-certified-18.04@20180808) from "https://images.joyent.com"
Gather image 96768413-88a7-43d6-867b-d74284d616d6 ancestry
Must download and install 1 image (330.0 MiB)
Download 1 image [======================>] 100% 330.04MB 6.37MB/s 51s
Downloaded image 96768413-88a7-43d6-867b-d74284d616d6 (330.0 MiB)
...8a7-43d6-867b-d74284d616d6 [======================>] 100% 330.04MB 11.51MB/s 28s
Imported image 96768413-88a7-43d6-867b-d74284d616d6 (ubuntu-certified-18.04@20180808)
vmadm create <<EOF
{
"autoboot": false,
"alias": "for-$src_uuid",
"brand": "bhyve",
"ram": "1024",
"vcpus": "2",
"disks": [
{
"image_uuid": "$src_uuid",
"boot": true,
"model": "virtio"
}
]
}
EOF
This requires that prepare-image-ubuntu-console
is in the current working directory.
inst_uuid=$(vmadm list -Ho uuid alias=for-$src_uuid)
desc=$(imgadm info "$src_uuid" | json manifest.description)
desc+=' For kvm and bhyve.'
version=$(date +%Y%m%d)
imgadm info $src_uuid | json manifest -e '
this.manifest.uuid=undefined;
this.manifest.state=undefined;
this.manifest.public=undefined;
this.manifest.version=undefined;
this.manifest.published_at=undefined;
this.manifest.requirements.brand=undefined;
this.manifest.description=undefined;' |
imgadm create $inst_uuid -c gzip -s prepare-image-ubuntu-console \
-m - description="$desc" version="$version"
# imgadm install -m ubuntu-certified-18.04-20181004.imgmanifest -f ubuntu-certified-18.04-20181004.zvol.gz
Installing image 24813a9f-0405-4ddf-819e-3e24bff1c180 (ubuntu-certified-18.04@20181004)
...819e-3e24bff1c180 [=======================>] 100% 340.28MB 26.48MB/s 12s
Installed image 24813a9f-0405-4ddf-819e-3e24bff1c180 (ubuntu-certified-18.04@20181004)
new_uuid=$(json uuid < *.imgmanifest)
vmadm create <<EOF
{
"autoboot": true,
"alias": "test-$new_uuid",
"brand": "bhyve",
"ram": "1024",
"vcpus": "2",
"disks": [
{
"image_uuid": "$new_uuid",
"boot": true,
"model": "virtio"
}
]
}
EOF
inst_uuid=$(vmadm list -Ho uuid alias=test-$new_uuid)
zlogin -C "$inst_uuid"
after
update-grub2
there should probably becloud-init clean