Skip to content

Instantly share code, notes, and snippets.

@JavaScriptDude
Last active February 5, 2024 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavaScriptDude/d76350beef055ee2737b2893ae4b1e35 to your computer and use it in GitHub Desktop.
Save JavaScriptDude/d76350beef055ee2737b2893ae4b1e35 to your computer and use it in GitHub Desktop.
Installing Debian on Freenas / BHYVE

Freenas -> Virutal Machines -> Add

Operating System

  • Guest OS: Linux
  • Name:
  • clock: (def)
  • Boot: (def)
  • shut. timeout: (def)
  • Start on Boot
  • Enable VNC
  • [-] Delay VM Boot Until VNC Connects
  • Bind: (choose appropriate IP)
  • [NEXT]

CPU and Memory

  • Choose appropriate settings
  • [NEXT]

Hard Disks

  • Disk type: VIRTIO
  • Zvol Loc: (choose appropriate)

Network Interface

  • Adapter type: (def)
  • Mac: change if conflicts with any other on network
  • Attach NIC: Choose nic of Bind option on first screen

Inst. Media

Conf opts

  • review and then [SUBMIT]

Before first boot

  • Virtual Machines -> (new VM) -> (down arrow on right) -> Devices -> VNC -> [...] -> Edit:
    • Change resolution to 640 x 480

Boot and install OS

  • Install as you would normally install
  • Once completed, use Virtual Machine client to shut down VM

Remove CDRom device

  • In order for the VM to be detected, you MUST remove the CDRom device from the VM, is because bhyve does not automatically detect the efi file to boot the debian server and will fallback to the CDRom if left
  • Virtual Machine -> Devices -> CDROM-> [...] -> Delete

Boot VM

  • After booting, open in VNC
  • You will get UEFI Interactive Shell 'Shell>' prompt
  • This is because it does not know where the debian efi file is
  • We will manually boot by:
    • exit [ENTER]
    • BHYVE -> Boot Maintenance Manager -> Boot From File -> "File Exporer"
      • Navigate by hitting [ENTER] -> EFI [ENTER] -> debian [ENTER] -> grubx64.efi [ENTER]
      • This will lauch the debian grub menu

After successfull boot

Networking

  • Get name of adapter:
    • % ip a
    • # read name of vnic adapater (starts with enp*)
    • # write this name down
  • Static IP
    • % nano /etc/network/interfaces
      • # comment out or remove the the two last lines (allow-hotplug, iface enp*)
      • # add the following (change as required)
        • # Static IP
        • auto <adapter_name_from_above>
        • iface
        • address 192.168.0.10
        • netmask 255.255.255.0
        • gateway 192.168.0.1
        • dns-nameservers 8.8.8.8
      • # save and close
      • # restart networking
      • % systemctl restart networking
      • % ip a
      • # you should now have the static IP
      • Note:
        • It was noted that there may be a bug where the adapter changes on reboots. Not sure if this is still an issue but its something that should be watched out for as this will screw up the static configs
  • DHCP
    • % nano /etc/network/interfaces

      • Change the network interface names after "The primary network interface"
        • Is likely different
      • Save and close file
    • # restart networking

    • % systemctl restart networking

    • % dhclient

    • # check dhcp works

    • % ip a

    • # you should see a DHCP address chosen

    • Ensure that network starts automatically on boot

      • This service will automatically detect the adapter name
      • %apt install -y network-manager
    • %nano /etc/network/interfaces

    • % comment out the last two lines (network-manager) will take care of this

Fix Boot Issue

  • mkdir -p /boot/efi/EFI/BOOT
  • cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi
  • Shut down VM

Final boot

  • Before booting, go to Virtual Machine -> Devices -> VNC -> [...] -> Edit :
    • Change resolution to 1024 x 768
  • Now boot the VM and verify that it boots ok and the networking works as expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment