Tip: booting mfsbsd iso file from grub2 (depenguination..)



Reaction score: 46
Messages: 78


Someone here just asked about depenguination i.e. installing FreeBSD from (usually remote) Linux, and since mfsbsd kind of is the successor to the Depenguinator (there's Depenguinator version 2.0 but it it's still from the days of sysinstall) I wondered if one couldn't just put an mfsbsd iso on a Linux (or msdos) filesystem and boot it from an existing Linux install's grub2. Since Google wasn't helpful I thought maybe I should post what I found for the next guy wanting to do this... :)

So here is the grub.cfg snippet:
menuentry "mfsbsd-10.0-RELEASE-amd64.iso" {
# Path to the iso
        set isofile=/boot/boot-isos/mfsbsd-10.0-RELEASE-amd64.iso
# (hd0,1) here may need to be adjusted of course depending where the partition is
        loopback loop (hd0,1)$isofile
        kfreebsd (loop)/boot/kernel/kernel.gz -v
#       kfreebsd_loadenv (loop)/boot/device.hints
#       kfreebsd_module (loop)/boot/kernel/geom_uzip.ko
        kfreebsd_module (loop)/boot/kernel/ahci.ko
        kfreebsd_module (loop)/mfsroot.gz type=mfs_root
        set kFreeBSD.vfs.root.mountfrom="ufs:/dev/md0"
        set kFreeBSD.mfsbsd.autodhcp="YES"
# Define a new root password
#       set kFreeBSD.mfsbsd.rootpw="foobar"
# Alternatively define hashed root password
#       set kFreeBSD.mfsbsd.rootpwhash=""

You can also enter these lines manually at the grub prompt (usually reachable via "c" or maybe ESC at the grub menu), in that case don't type the menuentry line and replace the final } line by "boot"; and you can use "ls" as well as tab completion then too to help locate the iso.


(mfsbsd homepage)
https://github.com/mmatuska/mfsbsd/blob ... pts/mfsbsd
(for kFreeBSD.mfsbsd variables, goes to /etc/rc.d/mfsbsd in the mfsroot)

http://www.daemonology.net/blog/2008-01 ... r-2.0.html
(Depenguinator 2.0)

http://www.supergrubdisk.org/category/d ... kdownload/
http://forja.cenatic.es/frs/download.ph ... s2-rc5.iso

(grub2 fix needed so "too old" grub2 may not work)

I used super grub disk in qemu to test this, see: http://people.freebsd.org/~nox/tmp/grub.cfg.mfsbsd.txt
(super grub disk is also useful burned/dd'd to a cd or usb key to boot an existing FreeBSD install in case of bootloader issues...)

HTH, :)



Reaction score: 1,323
Messages: 2,351

This looks a lot like what I need to at least try installing FreeBSD on a virtual server where the hoster only supports Linux.

In my case, the VM is xen based, and installing "grub-xen" in the Debian system seems to work fine, but I can't really check because I don't see anything -- I don't have a serial console, only a VNC connection based on XEN's virtual framebuffer (pvfb), and grub can't use it as it seems (I tried a lot of things).

I built an mfsbsd ISO based on my 12.0-RELEASE-p4 and the only thing I can see is .. it isn't coming up to the point where I could login via ssh :(

I tried to add
insmod loopback
insmod iso9660
and even
insmod udf
which didn't change anything.

Does the GENERIC FreeBSD kernel know and use XEN's virtual framebuffer? If I could see anything on my VNC, this way I could rule out booting from grub as the issue.

Or if the problem is indeed grub, any ideas what I could additionally change in the menuentry?