# Debian LVM as guest with bhyve



## b:z (Jun 2, 2015)

Hi,

I am very new with bhyve and getting several issues with bhyve and Debian LVM, this is how I start the guest,


`bhyvectl --destroy --vm=debian`
`grub-bhyve -m /opt/data/bhyve/vm0-device.map -M 2048 debian`
`bhyve -c 2 -m 2048M -H -P -A \
    -s 0:0,hostbridge \
    -s 1:0,lpc -s 2:0,virtio-net,tap0 \
    -s 3,ahci-cd,/opt/tmp/iso/debian-7.8.0-amd64-netinst.iso \
    -l com1,/dev/nmdm0A \
    -s 4,ahci-hd,/dev/zvol/zroot/vm0 debian &`
(1) My first issue is that I couldn't start the Debian normally after executing the command b), I have to input these grub commands every time I reboot the guest:

```
grub> linux (hd0,msdos1)/vmlinuz-3.2.0-4-amd64 root=/dev/mapper/vpool-root
grub> initrd (hd0,msdos1)/initrd.img-3.2.0-4-amd64
grub> boot
```
Is there anyway to do it one time without input extra grub commands?

(2) I use `tip vm0` to access virtual console, but it's really not good, always getting message "All ports are busy" for every time I reconnect back to guest. if I kill the tip process, the guest will be shutdown, and I have to start the guest from beginning.

Which is the best way to connect virtual console to guest?

Thanks a lot


----------



## SirDice (Jun 2, 2015)

Handbook: 22.4.3. Creating a Linux® Guest
22.4.4. Virtual Machine Consoles

Please note that bhyve is still very much an experimental service and it's not fully integrated yet.


----------



## b:z (Jun 2, 2015)

Thanks for the answers. I have also gone through these instructions to create the Debian guest, but got that issues.
I just tried to change as following:

`grub-bhyve -m /opt/data/bhyve/vm0-device.map -r hd0,msdos1 -M 2048 proxy`

`bhyve -c 2 -m 2048M -H -P -A \
    -s 0:0,hostbridge \
    -s 1:0,lpc \
    -s 2:0,virtio-net,tap0 \
    -l com1,/dev/nmdm0A \
    -s 4,ahci-hd,/dev/zvol/zroot/vm0 proxy &`

but it doesn't work, need to input the kernel info at grub> after executing the grub-bhyve command.


----------



## grehan@ (Jun 3, 2015)

When LVM is selected in a Debian/Ubuntu install, the grub config file is put into a non-default location: /grub/grub.cfg instead of /boot/grub/grub.cfg.

grub-bhyve can be told to look into the alternate directory with the `-d <dir>` option. The boot should be fine if you change your grub-bhyve command line to `grub-bhyve -d /grub -m /opt/data/bhyve/vm0-device.map -r hd0,msdos1 -M 2048 proxy`


----------



## b:z (Jun 3, 2015)

That's cool, it's working, iI can see the grub selection menu displays.
For now, to start a bhyve guest, iI have to run at least two commands:
`bhyvectl --destroy --vm=proxy`
(this may an option, except restart/reboot)

`grub-bhyve -m /opt/data/bhyve/vm0-device.map -r hd0,msdos1 -M 2048 proxy -d /grub

bhyve -c 2 -m 2048M -H -P -A \
    -s 0:0,hostbridge \
    -s 1:0,lpc \
    -s 2:0,virtio-net,tap0 \
    -l com1,/dev/nmdm0A \
    -s 4,ahci-hd,/dev/zvol/zroot/vm0 proxy &`

Is that possible to use /usr/share/examples/bhyve/vmrun.sh script, to control start/stop/reboot the guest?
How could iI set the guest auto start when host is rebooted?

Thank you.


----------



## SirDice (Jun 3, 2015)

There aren't any startup scripts yet. So it's still a bit of a manual job (or script something yourself).


----------

