I'm working on Ubuntu, and I wanted to try BSD. I downloaded a PC-BSD iso (PCBSD9.2-RELEASE-x64-DVD-USB-latest.iso). I wanted to know if it is possible to use "loopback" to run that image even if I have no BSD kernel installed. Here is my 40_custom:


exec tail -n +3 $0

# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "PCBSD" {

      insmod loopback

      echo Loadind...

      set isofile="/PCBSD.iso"

      loopback loop (hd0,2)$isofile

But it doesn't work.

  • What you have so far looks sufficient to establish the loopback, but not enough to actually load and boot the image. -- Have you tried any experiments from the Grub command line? For example, what happens when you try the commands shown here? Do you see a listing of files within the ISO? gnu.org/software/grub/manual/html_node/loopback.html#loopback
    – ewhac
    Dec 16, 2013 at 22:55
  • Oh, also: What version of Grub are you using?
    – ewhac
    Dec 16, 2013 at 23:00
  • I have the 1.99 GRUB version, I red somewhere it might work with 1.97 and greather, right? I'm trying the "ls loop". I'll let you know the result. If I understand, this is a simple way to know the kernel path, isn't it? By the way, is there a way to emulate grub loopback command under Unix-like (actually linux)?
    – kirly
    Dec 16, 2013 at 23:22
  • the loop is correctly established, I've undestood "kernel" command is "linux" on my grub, but when I specify the iso kernel path, grub returns me "bad magic number". It makes sense if kernel and linux commands are not the same... Any idea?
    – kirly
    Dec 17, 2013 at 0:15
  • I suspect (but have not confirmed) that the linux command makes certain assumptions about the kernel image layout that are not true for a BSD kernel. As such, I would experiment with chainloading the boot block from the ISO image.
    – ewhac
    Dec 17, 2013 at 0:43

2 Answers 2


I initially thought this was feasible. Upon reflection, I no longer think so.

Grub is frighteningly capable, and can dive into just about any filesystem and pull files out. So Grub will have no difficulty fishing the kernel out of the ISO image.

However, once Grub hands off control to the loaded kernel, Grub's involvement ends, and whatever code Grub branched to is now wholly responsible for doing the rest of the work. This means the BSD kernel would need to understand that the rootfs is not sitting on a bare block device or CD-ROM disc, but rather inside a file living on an ext[234]-formatted disk partition. While this is technically possible, the kernel being booted needs to be explicitly set up for this. I seriously doubt this is the case with the BSD kernel in your ISO image. Even if Grub were to somehow leave behind a BIOS-level I/O device (highly doubtful), BSD would eventually want to start initializing its own device drivers to replace it, at which point things would fall over.

So no, I'm pretty sure it won't work. Your alternative is either writing the ISO to a disc or a USB key as @Kiwy suggested, or to boot the BSD kernel inside a virtual machine.


Even though I'm supposed to be working on something else at the moment, it still bugged me that there are many Web pages out there detailing how to boot an ISO file, so I did a little more digging.

Yes, you can boot certain Linux distros from an ISO file. Examples illustrating this are done using the Grub linux (nee kernel) command, whose documentation reads as follows:

Command: linux file …

Load a Linux kernel image from file. The rest of the line is passed verbatim as the kernel command-line. Any initrd must be reloaded after using this command (see initrd).

[Emphasis mine.]

The Grub examples for booting Ubuntu from an ISO file typically appear as:

linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd.lz

So I started looking for the kernel docs for the iso-scan argument and discovered... There aren't any. iso-scan is not a standard Linux command line argument. Neither is findiso, which appears in some other examples.

I eventually happened upon a Fedora bug report lamenting the inability to boot from an ISO file, whose comments casually mentioned that find-iso and its ilk are handled not by the kernel, but by the initramfs. Googling from there, it becomes apparent that booting from an ISO is handled in a distro-specific manner (Ubuntu does it differently from Fedora, who does it differently from Grml, etc.).

So, in general, my answer stands: The kernel won't boot out of an ISO file without help. Some (many?) Linux distros have done this work. It is unclear whether the BSD distro you want to test drive has done similar work. And so, you'll have a much easier time booting in to a virtual machine or, as @Kiwy suggested earlier, off a USB stick.

  • Thanks for the vote and the information your post is quiet interesting in fact.
    – Kiwy
    Dec 17, 2013 at 22:00

No chance, BDS is a free Unix system and using your linux kernel to boot on the iso is definitely not going to work, why not just download a live bsd from here :

Burn it or put it on a usb key and boot on it from your bios menu ?

And here a short explanation of why what you're asking for can't work :

Edit 1:
If you want to try freeBSD from a live CD lunched from grub then you need to add the corrct grub entry that contains at least the line :

kernel /path/to/iso/kernel

That indicates the path to the kernel on the iso.

But in My opninion you should use the bios menu to boot onto a live cd or usb key instead of trying to but from grub because at each different cd you want to try you will have to change your grub.

  • He's not asking to boot BSD from Linux; he's asking to boot a BSD ISO from Grub.
    – ewhac
    Dec 16, 2013 at 22:49
  • Well in that that case use the bios to boot on live cd is a solution as the iso he tries to use is an installation only iso according to the name he gives.
    – Kiwy
    Dec 16, 2013 at 22:53
  • I noted it was not a "universal" solution, I thought it might be good to know. Otherwise, seems kernel command is not recognised by my grub (1.99 vesion)
    – kirly
    Dec 16, 2013 at 23:54
  • In fact, kernel function has been replaced by "linux". But when I did linux /path/to/iso/kernel, grub returns me "bad magic number". This is annoying... Any idea?
    – kirly
    Dec 17, 2013 at 0:11
  • anyway thanks for the 2 down votes I'm trying to help someone with offering a possibility it's maybe not the one expected but it is what it is. @kirly I do not know what is the the path in your case but it is unlikely /path/to/iso/kernel and something like /boot/kernel but I don't know bsd tha much. concerning the unkwo kernel command I can't help you I'm no specialist in grub at all...
    – Kiwy
    Dec 17, 2013 at 12:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .