29e27
![]() |
|
|
|
|
|||||||
| General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
I have a USB stick with a grub2 bootloader installed. Great tool when you want boot an iso without burning CD's.
I now want to boot the FreeBSD installer from the stick and have disc1.iso on an ext2 partition of the stick. I chose to use disc1.iso because I figured FreeBSD memstick.iso would install the FreeBSD bootloader on the stick and remove grub2. My menu entry in grub.cfg is: Code:
insmod loopback
insmod iso9660
insmod ufs2
insmod zfs
search --no-floppy --fs-uuid --015e657c-etc..
menuentry "FreeBSD 8.1 iso" {
set isofile="/boot/FreeBSD-8.1-RELEASE-amd64-disc1.iso"
loopback loop (hd0,1)$isofile
freebsd (loop)/boot/kernel/kernel
freebsd_loadenv (loop)/boot/device.hints
set FreeBSD.vfs.root.mountfrom=cd9660:/dev/ad1s1
set FreeBSD.vfs.root.mountfrom.options=rw
}
mountroot> prompt where "? = list valid disk boot devices". In my menu entry I have also tried to change set FreeBSD.vfs.root.mountfrom=cd9660:/dev/ad1s1to set FreeBSD.vfs.root.mountfrom=ufs:/dev/ad1s1with no result (obviously). The ? option at the command line does list available slices on the USB stick! Question is: Given that grub has completed its job and passed command the FreeBSD bootloader, what would be the correct menu entry for successful boot to the setup menu? Of course, I may also be missing a line in grub like ramdisk= or such... Unrelated but for the record, grub did not recognize the kfreebsd command but worked alright with the freebsd command. Whereas when booting from my already working hdd, the command grub is using is kfreebsd.
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by Beeblebrox; December 14th, 2010 at 09:34. Reason: [file] tags are better |
|
#2
|
||||
|
||||
|
Does grub's loopback mount create a device that can even be seen by the FreeBSD bootloader? If it does, what kind of device does it pretend to be: IDE hard disk (ad), IDE CD (acd), SCSI (da)?
|
|
#3
|
||||
|
||||
|
I just realized that the loopback command which grub uses probably does not get passed to the FreeBSD loader. The
mountroot> ? option lists (stick has 2 partns):Code:
msdosfs/kng32, ext2fs/kng1, ad1s2, ad1s1, ad2
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by DutchDaemon; March 18th, 2011 at 18:12. Reason: [file] instead of [color] |
|
#4
|
||||
|
||||
|
Unless grub is creating an emulated device in RAM, it seems unlikely to work. Something would have to remain to handle reading the ext2 filesystem underneath the CD image. And all of that goes away when the FreeBSD loader takes over, unless grub has created something that sticks around. The FreeBSD loader should be able to see the USB stick as da0, but then it would have to be able to understand ext2, and then mdconfig(8) and mount the CD image.
syslinux can copy CD images to RAM and make them bootable, but of course it eats RAM. It wasn't successful when I first tried it, but might be better now. |
|
#5
|
||||
|
||||
|
I have thought about your comments and I disagree. I think loopback creates an iso9660 fs in memory. Without that, the FreeBSD installer would not start at all - the FreeBSD installer starts because it thinks its on a cd (iso9660 fs) - and that is what sticks around. If my premise is correct, ext2 fs is irrelevant.
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by DutchDaemon; November 28th, 2010 at 03:55. Reason: Please use [file], not [color] |
|
#6
|
||||
|
||||
|
Looks like you're right. loopback in grub2 creates a RAM-backed "drive".
When you say the installer starts, you mean the loader, right? If sysinstall runs, then the filesystem is being read. |
|
#7
|
||||
|
||||
|
Yes, I do mean the loader. Load process stops at
Code:
ROOT MOUNT ERROR:
If you have invalid mount options, reboot, and first try the following from the loader prompt:
set vfs.root.mountfrom.options=rw
and then remove invalid mount options from /etc/fstab.
mountroot>Like I stated, ? curiously lists only the partitions on the stick and none of the hdd slices...
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE |
|
#8
|
|||
|
|||
|
This thread is marked [Solved] but I don't see any successful reports of booting a FreeBSD iso image file from grub2. Am I missing something?
I would love to show more people FreeBSD. It would be useful if the kernel was able to do the right thing when booted from a Grub2 USB stick that contains other files. Last edited by DutchDaemon; March 18th, 2011 at 18:11. |
|
#9
|
||||
|
||||
|
@ grantbow:
Threads a lot of times get marked "solved" just for having been on the forum for a while. "Solved" also, in a sense means closed regardless whether a solution exists or not. Re your question about booting from usb, FreeBSD is bootable from a usb and there are many howto's about that (one such exhaustive sample here). My post, as you know, was about getting it to work with the iso file intact, which saves space on the usb and additionally, switching the menu for other iso's in grub is very easy. Currently no solution to this (that I have found) and I suspect the issue has to do with grub's loopback compatibility with FreeBSD's memory device handling. Hope this helps!
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE |
|
#10
|
|||
|
|||
|
Hello @Beeblebrox, thanks for your reply and the link. You and @wblock seem to have narrowed down many of the unknowns. As USB sticks get larger and larger the requirement to use a whole stick for an OS seems more and more wasteful to me. Grub2's feature is one seemingly attractive way around this limitation.
Is there currently no way for the FreeBSD kernel with an appropriate parameter to recognize the "RAM-backed drive" created by grub2 & mount this as it's root volume? What missing functionality seems to be required? |
|
#11
|
||||
|
||||
|
Recently, I found that syslinux could PXE boot a FreeBSD install CD. Maybe there's an equivalent for grub2? Or use syslinux instead of grub2.
Code:
label freebsd-install menu label FreeBSD Install kernel memdisk initrd tftp://192.168.1.1/images/freebsd-install/bootonly.iso append iso raw Code:
label freebsd-install menu label FreeBSD Install kernel memdisk initrd bootonly.iso append iso raw |
|
#12
|
||||
|
||||
|
What I meant by:
Quote:
1. mdconfig -a -t vnode -f /path/to-image.iso -u 1 2. mount -t cd9660 /dev/md0 /mountpointGranted, grub already has mounted the iso as a memory device, hence no need for mdconfig etc. However, I just wonder whether FreeBSD recognizes the loopback'ed device in the manner necessary to continue with the boot process, and whether there is a mis-communication because of how the memory devices are specified/handled?
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by DutchDaemon; March 23rd, 2011 at 17:59. |
|
#13
|
|||
|
|||
|
I tried to do the same as Beeblebrox. Got the same problem. The boot process stops with a rootmount prompt. I have absolutely no idea how Grub2 works and what's behind it. So it would be nice if someone could post a working grub2 FreeBSD entry to boot from usb.
Last edited by DutchDaemon; March 24th, 2011 at 01:26. |
|
#14
|
||||
|
||||
|
@wblock:
I think (and I am just speculating here) the key to your post is the type of iso being used: bootonly.iso as opposed to a regular kernel / iso. Again speculation, the bootonly is somehow different than the "regular" iso
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE |
|
#15
|
||||
|
||||
|
Quote:
Just tested, and a full disc1 install CD also boots fine, provided the target system has enough RAM to hold it with some left over to run. |
|
#16
|
|||
|
|||
|
To install FreeBSD from grub or grub2, add the following to grub.cfg:
Code:
### BEGIN of grub.cfg ###
# Boot automatically after 30 secs.
set timeout=30
# By default, boot the first entry.
set default=0
menuentry "1 FreeBSD 8.2 i386 boot only" {
set isofile=/FreeBSD-8.2-RELEASE-i386-bootonly.iso
loopback loop $isofile
kfreebsd (loop)/boot/kernel/kernel iso-scan/filename=$isofile noeject noprompt splash --
kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
}
menuentry "2 FreeBSD 8.2 amd64 boot only" {
set isofile=/FreeBSD-8.2-RELEASE-amd64-bootonly.iso
loopback loop $isofile
kfreebsd (loop)/boot/kernel/kernel boot=casper iso-scan/filename=$isofile noeject noprompt splash --
kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
}
### END of grub.cfg ###
Last edited by DutchDaemon; May 2nd, 2012 at 16:39. Reason: Formatting & Style: http://forums.freebsd.org/showthread.php?t=8816 / http://forums.freebsd.org/showthread.php?t=18043 |
| The Following User Says Thank You to jola For This Useful Post: | ||
Nukama (September 16th, 2011) | ||
|
#17
|
|||
|
|||
|
I wonder if it's possible to put FreeBSD into a separate partition on the USB stick, install the FreeBSD bootloader on that partition, then use chainloader +1 option in /etc/grub.d/40_custom before running update-grub, all right on the USB stick. The USB stick would have to be rather big but maybe it will work?
Thanks. |
|
#18
|
|||
|
|||
|
Quote:
There seems to be a lot of confusion in this thread about what Grub2 is doing. It's not magic. It's not creating a device that either Linux or FreeBSD kernels can see. It can't. It is opening the iso file you provide it and allowing grub2 (and only grub2) to access files inside of it. The only purpose of loopback on grub2 is to allow one to extract the kernel and init image (initrd or freebsd_module). After that, it is entirely up to the booted kernel and init scripts to find the ISO if necessary and continue booting. Once the kernel has taken over, the loopback "device" created by grub vanishes. It doesn't matter if you're booting Linux, FreeBSD, or Windows, the ISO you're booting is not able to see anything grub did and needs to support this method of booting. For many small ISOs (TinyCore Linux, and I suspect the FreeBSD netinstaller), everything of value exists in the Kernel and Init image. For bigger live CDs, such as Ubuntu, the Init scripts need to support this method of booting. The way it works on Ubuntu is the init script (casper on Ubuntu... they like naming things goofy) recognizes the iso-scan/filename parameter. If that parameter is non-empty, casper mounts every partition on the system one after another until it finds the ISO. Then it mounts the ISO as a loopback device and continues as if that loopback device were the CD-ROM. Only if FreeBSDs init scripts included the ability to parse a kernel parameter such as Ubuntu's poorly named "iso-scan/filename" could we boot a full image. But it sounds like the bootonly.iso works, so there you go... |
|
#19
|
||||
|
||||
|
All the excitement aside, jola's proposed solution does not work. Tried and Tired, so did not respond.
The main problem with iso boots (and grub does a great job of it) is the mount root stage of the process. So you can get the loop working, you can get kernel and init to boot, but it hits its head against a wall at the mount root from stage. Each group of distro (debian/rhl/etc) has different mount root options and this info is not easily found on the intertubes. xBSD releases are no exception, mainly for the reason that they do not use grub as the main bootloader. Another, but related problem, is that you may manage to boot from the iso but not manage to install it on your drive. The error in this case is usually a message that the filesystem or some package did not like the setup. These errors are really a result of incorrect mount options for root in the grub.cfg line. RESULT: How do you mount root from loopback as posted in #1 post: Quote:
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by Beeblebrox; October 28th, 2011 at 21:14. |
|
#20
|
|||
|
|||
|
Quote:
If your CD is failing to mount root, then you are not using the Boot Only CD. The Boot Only CD does not contain any packages on the CD-Rom itself; everything is in the mfsroot.gz, which gets extracted into ram. The proper configuration, which I am using without problems, is: Code:
menuentry "FreeBSD 8.2 i386 boot only" {
set isofile=/boot/isos/FreeBSD-8.2-RELEASE-i386-bootonly.iso
loopback loop $isofile
kfreebsd (loop)/boot/kernel/kernel
kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
}
menuentry "FreeBSD 8.2 amd64 boot only" {
set isofile=/boot/isos/FreeBSD-8.2-RELEASE-amd64-bootonly.iso
loopback loop $isofile
kfreebsd (loop)/boot/kernel/kernel
kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
}
I just completed an i386 install of FreeBSD using this method. It works, but only as described. |
| The Following User Says Thank You to bobpaul For This Useful Post: | ||
Nukama (November 17th, 2011) | ||
|
#21
|
||||
|
||||
|
The funny thing is, I have booted ISO files off USB for the likes of DSL and Pentoo before. Unfortunately I lost my notes when moving, so no help on that issue fromme at the moment. Whether the booted ISO is able to do an install or correctly run the installation script/program is another issue and the reason why I started the thread (but your comment on the problem are certainly welcome).
Re the same problem for FreeBSD, I do think it is possible to boot the liveCD as ISO, and as you stated, sysinstall will probably have problems (exact similar issue recently with Backtrack-5). To explain my explanation, what I meant by: Quote:
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE |
|
#22
|
|||
|
|||
|
Quote:
I'm not familiar with Pentoo, but DSL certainly might have added support for Grub2 ISO style booting since I last attempted, either by shoving everything into the init ram image (ala FreeBSD boot only, the 20MB Ubuntu Mini ISOs, etc ) or by making the init scripts on the init ram image support searching and mounting the ISO. I guess this is off topic. It really doesn't matter at all what method the OS kernel uses to mount ISOs as loopback devices. There's 0 communication between Grub2 and the OS kernel about the loopback "device" that Grub2 creates; that vanishes as soon as the kernel starts executing (whether it's Linux or FreeBSD). All you can do is pass a "kernel parameter" (which on Linux shows up in /proc/cmdline; not sure what FreeBSD does) and needs to be specifically detected by the init scripts. If you want to boot the FreeBSD 'Disk1', 'DVD1', or 'LiveFS' ISO files, the init scripts on the 'mfsroot.gz' will need to be edited. If you want to boot the 'bootonly' ISO, you already can; I finished an AMD64 install with this method this morning, so now I know install works on both architectures in this way. Have you had issues with the 'bootonly' ISO image? Or do you really need one of the other ISOs for some reason? |
|
#23
|
|||
|
|||
|
I understand this was marked solved but I hope you guys get this, you started me in the right direction, I am interested in BSD, currently I am Linux Debian. I wanted to check out the Debian BSD distro but it wouldnt install from a USB DVD Rom. I tried all of the Debian solutions with USB's etc and failed then I searched for booting from grub info as that was also one of the debian solutions more or less. I ran across your posts and it gave me sone information I was lacking. I modified your examples a little and came up with a working solution.
Code:
menuentry "Debian BSD 1" {
echo "Loading ..."
set isofile=(hd0,7)/debian-6.0.3-kfreebsd-amd64-CD-1.iso
loopback loop $isofile
set root=(loop)
kfreebsd (loop)/boot/kernel/kfreebsd.gz
kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/md0
}
Hope one of you finds this! And thanks for the needed direction. --jerry Last edited by DutchDaemon; November 5th, 2011 at 17:25. Reason: proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
|
#24
|
||||
|
||||
|
@jk*:
I must say good job! I'll have to try it myself as well. The Code:
mountfrom=ufs:/dev/md0
__________________
branch:head - root on zfs - amd64 BLUES, ELWOOD ILLINOIS LICENSE : B263-1655-2187 CURRENTLY UNDER SUSPENSION WARRANTS OUTSTANDING : PARKG. 116 MOVING VIOLATIONS : 56 ARREST DRIVER ... IMPOUND VEHICLE Last edited by DutchDaemon; November 7th, 2011 at 02:52. |
|
#25
|
|||
|
|||
|
Hi and thanks happy you found it, The
Code:
mountfrom=ufs:/dev/md0 --jerry Last edited by DutchDaemon; November 7th, 2011 at 02:51. Reason: proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
![]() |
| Tags |
| grub2, install, usb stick |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] FreeBSD does not start on a triple boot with Grub2 | Halberdier | Installing & Upgrading | 7 | May 30th, 2012 23:06 |
| Install FreeBSD 8.0 using a USB stick, failed: No /boot/loader | everypot | Installing & Upgrading | 10 | February 29th, 2012 19:34 |
| How to boot FreeBSD 9 installed in dedicated disk using Grub2. | Michael | Installing & Upgrading | 4 | February 4th, 2012 09:32 |
| Grub2 Configuration (Dual boot linux + FreeBSD is it possible?) | marcinnn | Installing & Upgrading | 4 | October 10th, 2011 01:35 |
| [Solved] dual boot FreeBSD with linux using grub2 | favor | Installing & Upgrading | 22 | January 20th, 2010 14:26 |