How to install a Ubuntu guest in Bhyve

HaHaHa

New Member


Messages: 10

There is no GUI in bhyve or in vm-bhyve. I use Ubuntu 14.04 ISO. But the installation need a GUI to choose the installation configuration. How to get the GUI mode if possible, or how to install Ubuntu without GUI? If I could install without GUI, then could I connect the Ubuntu GUI via remote desktop from this FreeBSD host?
 

usdmatt

Daemon

Reaction score: 544
Messages: 1,459

In order to get GUI access you need to boot using UEFI and provide a vnc frame buffer to bhyve. You can then connect with a VNC client (I'm using TightVNC on my Windows desktop).

The following vm-bhyve worked for me to boot 17.04.
Note that you need the uefi-edk2-bhyve package installed if you don't already have it.

Code:
uefi="yes"
graphics="yes"
xhci_mouse="yes"
cpu=2
memory=2G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
 
OP
H

HaHaHa

New Member


Messages: 10

I follow this link https://github.com/churchers/vm-bhyve/wiki/Quickstart
Skipped step 8 because failed: "8. vm switch add public em0", I used bge0. but I do not think this is the reason it stoped .
I already modified the config file by "vm configure myguest". And also ".templates/default.conf":
loader="grub"
cpu=1
memory=512M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="linux.img"
Where should I create and put this file linux.img?
It stoped here, (I choose 'Install Ubuntu' ):
# vm -f install myguest ubuntu-14.04.5-desktop-amd64.iso


GNU GRUB version 2.00

+--------------------------------------------------------------------------+
|Try Ubuntu without installing |
|Install Ubuntu |
|OEM install (for manufacturers) |
|Check disc for defects |
| |
| |
| |
| |
| |
| |
| |
| |
+--------------------------------------------------------------------------+

Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, `e' to edit the commands
before booting or `c' for a command-line.



Generating locales...
en_US.UTF-8... done
Generation complete.
pwconv: failed to change the mode of /etc/passwd- to 0600
Using CD-ROM mount point /cdrom/
Identifying... [13ca05a159a1bdb82d0b43ecb72b49b0-2]
Scanning disc for index files...
Found 2 package indexes, 0 source indexes, 0 translation indexes and 1 signatures
Found label 'Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)'
This disc is called:
'Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)'
Copying package lists...gpgv: Signature made Wed Aug 3 17:49:26 2016 UTC using DSA key ID FBB75451
gpgv: Good signature from "Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>"
Reading Package Indexes... Done
Writing new source list
Source list entries for this disc are:
deb cdrom:[Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)]/ trusty main restricted
Repeat this process for the rest of the CDs in your set.
* Starting Initialize or finalize resolvconf [ OK ]
* Starting Clean /tmp directory [ OK ]
* Stopping Clean /tmp directory [ OK ]
* Starting set console keymap [ OK ]
* Starting Signal sysvinit that virtual filesystems are mounted [ OK ]
* Starting Signal sysvinit that virtual filesystems are mounted [ OK ]
* Starting Bridge udev events into upstart [ OK ]
* Starting device node and kernel event manager [ OK ]
* Starting Signal sysvinit that local filesystems are mounted [ OK ]
* Starting D-Bus system message bus [ OK ]
* Stopping set console keymap [ OK ]
* Starting Signal sysvinit that remote filesystems are mounted [ OK ]
* Starting load modules from /etc/modules [ OK ]
* Starting cold plug devices [ OK ]
* Starting log initial device creation [ OK ]
* Stopping Mount filesystems on boot [ OK ]
* Stopping load modules from /etc/modules [ OK ]
* Starting flush early job output to logs [ OK ]
* Starting SystemD login management service [ OK ]
* Stopping flush early job output to logs [ OK ]
* Starting bluetooth daemon [ OK ]
* Starting system logging daemon [ OK ]
* Starting mDNS/DNS-SD daemon [ OK ]
* Starting Reload cups, upon starting avahi-daemon to make sure remote queues are populated [ OK ]
* Stopping Reload cups, upon starting avahi-daemon to make sure remote queues are populated [ OK ]
* Starting Bridge file events into upstart [ OK ]
* Starting Uncomplicated firewall [ OK ]
* Starting configure network device security [ OK ]
* Starting configure network device [ OK ]
* Starting configure network device security [ OK ]
* Starting Mount network filesystems [ OK ]
* Starting Failsafe Boot Delay [ OK ]
* Stopping Mount network filesystems [ OK ]
* Stopping Failsafe Boot Delay [ OK ]
* Starting System V initialisation compatibility [ OK ]
* Starting modem connection manager [ OK ]
* Starting configure network device security [ OK ]
* Starting configure network device [ OK ]
[ 12.956695] intel_rapl: no valid rapl domains found in package 0
* Stopping cold plug devices [ OK ]
* Starting network connection manager [ OK ]
* Starting early crypto disks... * Stopping log initial device creation [ OK ]
[ OK ]
* Starting configure network device security [ OK ]
* Starting enable remaining boot-time encrypted block devices [ OK ]
* Setting up X socket directories... * Starting Bridge socket events into upstart [ OK ]
[ OK ]
* Stopping System V initialisation compatibility [ OK ]
* Starting configure virtual network devices [ OK ]
* Starting System V runlevel compatibility [ OK ]
* Starting Restore Sound Card State [ OK ]
* Starting regular background program processing daemon [ OK ]
* Starting ACPI daemon [ OK ]
* Starting save kernel messages [ OK ]
* Starting Ubuntu live CD installer [ OK ]
* Stopping save kernel messages [ OK ]
* Stopping Restore Sound Card State [ OK ]
* Stopping crash report submission daemon [ OK ]
[9;0] * Starting automatic crash report generation [ OK ]
* Starting cups-browsed - Bonjour remote printer browsing daemon [ OK ]
* Stopping Restore Sound Card State [ OK ]
* speech-dispatcher disabled; edit /etc/default/speech-dispatcher
saned disabled; edit /etc/default/saned
* Restoring resolver state... [ OK ]
* Stopping System V runlevel compatibility [ OK ]
Generating locales...
en_US.UTF-8... done
Generation complete.
pwconv: failed to change the mode of /etc/passwd- to 0600
Using CD-ROM mount point /cdrom/
Identifying... [13ca05a159a1bdb82d0b43ecb72b49b0-2]
Scanning disc for index files...
Found 2 package indexes, 0 source indexes, 0 translation indexes and 1 signatures
Found label 'Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)'
This disc is called:
'Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)'
Copying package lists...gpgv: Signature made Wed Aug 3 17:49:26 2016 UTC using DSA key ID FBB75451
gpgv: Good signature from "Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>"
Reading Package Indexes... Done
Writing new source list
Source list entries for this disc are:
deb cdrom:[Ubuntu 14.04.5 LTS _Trusty Tahr_ - Release amd64 (20160803)]/ trusty main restricted
Repeat this process for the rest of the CDs in your set.
* Starting Initialize or finalize resolvconf [ OK ]
* Starting Clean /tmp directory [ OK ]
* Stopping Clean /tmp directory [ OK ]
* Starting set console keymap [ OK ]
* Starting Signal sysvinit that virtual filesystems are mounted [ OK ]
* Starting Signal sysvinit that virtual filesystems are mounted [ OK ]
* Starting Bridge udev events into upstart [ OK ]
* Starting device node and kernel event manager [ OK ]
* Starting Signal sysvinit that local filesystems are mounted [ OK ]
* Starting D-Bus system message bus [ OK ]
* Stopping set console keymap [ OK ]
* Starting Signal sysvinit that remote filesystems are mounted [ OK ]
* Starting load modules from /etc/modules [ OK ]
* Starting cold plug devices [ OK ]
* Starting log initial device creation [ OK ]
* Stopping Mount filesystems on boot [ OK ]
* Stopping load modules from /etc/modules [ OK ]
* Starting flush early job output to logs [ OK ]
* Starting SystemD login management service [ OK ]
* Stopping flush early job output to logs [ OK ]
* Starting bluetooth daemon [ OK ]
* Starting system logging daemon [ OK ]
* Starting mDNS/DNS-SD daemon [ OK ]
* Starting Reload cups, upon starting avahi-daemon to make sure remote queues are populated [ OK ]
* Stopping Reload cups, upon starting avahi-daemon to make sure remote queues are populated [ OK ]
* Starting Bridge file events into upstart [ OK ]
* Starting Uncomplicated firewall [ OK ]
* Starting configure network device security [ OK ]
* Starting configure network device [ OK ]
* Starting configure network device security [ OK ]
* Starting Mount network filesystems [ OK ]
* Starting Failsafe Boot Delay [ OK ]
* Stopping Mount network filesystems [ OK ]
* Stopping Failsafe Boot Delay [ OK ]
* Starting System V initialisation compatibility [ OK ]
* Starting modem connection manager [ OK ]
* Starting configure network device security [ OK ]
* Starting configure network device [ OK ]
* Stopping cold plug devices [ OK ]
* Starting network connection manager [ OK ]
* Starting early crypto disks... * Stopping log initial device creation [ OK ]
[ OK ]
* Starting configure network device security [ OK ]
* Starting enable remaining boot-time encrypted block devices [ OK ]
* Setting up X socket directories... * Starting Bridge socket events into upstart [ OK ]
[ OK ]
* Stopping System V initialisation compatibility [ OK ]
* Starting configure virtual network devices [ OK ]
* Starting System V runlevel compatibility [ OK ]
* Starting Restore Sound Card State [ OK ]
* Starting regular background program processing daemon [ OK ]
* Starting ACPI daemon [ OK ]
* Starting save kernel messages [ OK ]
* Starting Ubuntu live CD installer [ OK ]
* Stopping save kernel messages [ OK ]
* Stopping Restore Sound Card State [ OK ]
* Stopping crash report submission daemon [ OK ]
[9;0] * Starting automatic crash report generation [ OK ]
* Starting cups-browsed - Bonjour remote printer browsing daemon [ OK ]
* Stopping Restore Sound Card State [ OK ]
* speech-dispatcher disabled; edit /etc/default/speech-dispatcher
saned disabled; edit /etc/default/saned
* Restoring resolver state... [ OK ]
* Stopping System V runlevel compatibility [ OK ]
 
OP
H

HaHaHa

New Member


Messages: 10

In order to get GUI access you need to boot using UEFI and provide a vnc frame buffer to bhyve. You can then connect with a VNC client (I'm using TightVNC on my Windows desktop).

The following vm-bhyve worked for me to boot 17.04.
Note that you need the uefi-edk2-bhyve package installed if you don't already have it.

Code:
uefi="yes"
graphics="yes"
xhci_mouse="yes"
cpu=2
memory=2G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
Can I use the VNC client from the host, which is freeBSD?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,932
Messages: 33,331

I follow this link https://github.com/churchers/vm-bhyve/wiki/Quickstart
Skipped step 8 because failed: "8. vm switch add public em0", I used bge0. but I do not think this is the reason it stoped .
I already modified the config file by "vm configure myguest". And also ".templates/default.conf":

Where should I create and put this file linux.img?
It stoped here, (I choose 'Install Ubuntu' ):
Instead of just blindly typing in commands, learn what they actually do. Then apply that knowledge to your situation.
 

usdmatt

Daemon

Reaction score: 544
Messages: 1,459

https://github.com/churchers/vm-bhyve/wiki/Quickstart
Lines 7-8
Create a virtual switch called 'public' and attach your network interface to it. Replace em0 with whatever interface connects your machine to the network.
I already modified the config file by "vm configure myguest". And also ".templates/default.conf":
There is no need to mess with the templates.

I would just create a guest using the default template, then modify to my needs. If you want to run Ubuntu with uefi, then I would run vm configure guest, increase the cpu & memory, remove the loader line and add the uefi, graphics & xhci_mouse settings as in the example above.

Can I use the VNC client from the host, which is freeBSD?
Yes you can vnc from the bhyve host if you have a GUI and and vnc client.

Where should I create and put this file linux.img?
When you create a guest, by default it should have one disk called disk0.img. There will be an empty file with this name in the guest directory. You shouldn't need to create this or change the name.
 
OP
H

HaHaHa

New Member


Messages: 10

Now I installed the System. Thanks~ But I can not enter into it by : vm start myguest
Here is the output:

Boot Failed. EFI DVD/CDROM
Boot Failed. EFI Misc Device
 

usdmatt

Daemon

Reaction score: 544
Messages: 1,459

Looks like that's probably because Ubuntu decided to not put their EFI boot file in the standard location. The UEFI code looks for /EFI/BOOT/bootx64.efi by default, but Ubuntu's code is in /EFI/ubuntu/grubx64.efi. I think the installer tries to set an EFI variable during install pointing to the correct place, but the UEFI support in FreeBSD/bhyve doesn't yet have a way of saving these variables. (In all fairness to Ubuntu, using an ubuntu folder, then directing the boot to use that probably makes it easier to multi-boot)

The easiest fix is described on this page -
https://forums.freenas.org/index.php?threads/howto-how-to-boot-linux-vms-using-uefi.54039/

Basically you need to get out to the main UEFI menu, then manually point it at the grubx64.efi file which will get the system running. Once it's running, go into a terminal and run the following -

Code:
# cd /boot/efi/EFI
# sudo mkdir BOOT
# sudo cp ubuntu/grubx64.efi BOOT/bootx64.efi
Hopefully it should boot automatically after that. Not the perfect solution because if grubx64.efi ever gets changed by an upgrade, ideally you'd need to copy it again. At some point we might get support for EFI variables in the bhyve firmware.
 
OP
H

HaHaHa

New Member


Messages: 10

I connected it to the local area network. The host ping another computer successfully but guest fails, error with 'connect: Network is unreachable'. Here is the host network:
Code:
$ ifconfig
bge0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c0099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE>
        ether 18:03:73:e5:xx.xx
        hwaddr 18:03:73:e5:xx.xx
        inet 10.239.xx.xx netmask 0xffffff80 broadcast 10.239.115.127
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: lo
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vm-public
        ether 02:5a:18:03:a6:00
        nd6 options=1<PERFORMNUD>
        groups: bridge
        id 00:00:00:00:00:00 priority 0 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 2000000
        member: bge0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 55
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet-myguest-0-public
        options=80000<LINKSTATE>
        ether 00:bd:03:d4:xx.xx
        hwaddr 00:bd:03:d4:xx.xx
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap
        Opened by PID 17xx
 

usdmatt

Daemon

Reaction score: 544
Messages: 1,459

Host networking looks fine, although could do with being in a cod block so it's easier to read.

What does the networking in the guest look like?
Is there a firewall on the host? If so, disable it and see if the guest still has no network access.
 
OP
H

HaHaHa

New Member


Messages: 10

Guest should not have problem, because host and guest both use dhcp, and I also tried with guest enter 'Try Ubuntu'.
I did not find any firewall on host freebsd. I assume firewall is not installed by default.
Guest network text cannot copy to host. There is eth0 and lo, without any IP in it.
 

usdmatt

Daemon

Reaction score: 544
Messages: 1,459

Hmm, Well I can't see a lot wrong unless there's some strict network policies further up stream that are restricting access.

The host has an IP assigned, so that seems to be working. That interface (bge0) is bridged with the guest's interface (tap0), and both the guest interface and bridge are running.

At this point I'd probably try assigning an IP from the same range manually to the guest and see if I can ping the host.
 

nihr43

Member

Reaction score: 19
Messages: 45

I've definitely had two physical FreeBSD bhyve servers happen to create the same MAC address for bridges, causing a lot of confusing regarding my virtual machines. The dev version of vm-bhyve has a bridge ether random feature to work around this.

Also, like usdmatt said, enterprise network switches commonly have "border mode" which prevents more than one MAC being learned per port. Which would cause something like you're describing.
 
OP
H

HaHaHa

New Member


Messages: 10

I've definitely had two physical FreeBSD bhyve servers happen to create the same MAC address for bridges, causing a lot of confusing regarding my virtual machines. The dev version of vm-bhyve has a bridge ether random feature to work around this.

Also, like usdmatt said, enterprise network switches commonly have "border mode" which prevents more than one MAC being learned per port. Which would cause something like you're describing.
Guest and host MAC address are totally different.
I also have Windows and Hyper-V VM on it, with the same network policy(DHCP), both of them can connect to this local network successfully, so it should not be this "border mode" problem.
 
OP
H

HaHaHa

New Member


Messages: 10

My network is good now, but I did nothing different from yesterday. Thanks all!~
 
Top