Naming of partitions in Grub, and /dev, when building on separate (virtual) disk
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Naming of partitions in Grub, and /dev, when building on separate (virtual) disk
I've been building LFS 6.5 on and off over the last week, and I've nearly got to the end.
I'm building inside VM-fusion with two virtual disks. One has my ubuntu host system, and the other is where I've been putting the lfs.
When chroot-ing to the system, the disks are sda for the ubuntu, and sdb for the lfs, and everything seems fine. But when I try and boot to the lfs disk, it can't find the partition to load. As it is sdb2, I had set the Grub script to root at (hd1,1), but this clearly doesn't work.
If I load from the second disk in VM fusion (setting the option in VM fusion to boot from the second virtual disk), does that make it now the primary disk as far as grub is concerned?If that is the case, I would guess I would need to change my system to root at (hd0,1) instead.
But what should I do with my /dev directory? I set it with "mount -v --bind /dev $LFS/dev" a while back, but is that now valid?
And are there any files I need to change, assuming the sdb disk will be considered sda by the system now?
I think my guesses above were correct, and using root (hd0,1) seemed to get a bit further.
However, I am now getting the dreaded cannot mount partition error that seems to be quite popular around here.
When I look at my /dev folder, it only has null and console in it, which I think is the problem. I mounted the /dev directory from the host, as suggested in section 6.2.2 of the 6.5 LFS book, but when I start up in the new disk everything apart from null and console vanishes. I would guess that the link between the two disks is broken at this point, as the main disk isn't running, and therefore there is no content to go there.
So, how do I populate /dev in my target disk so that there is something there when I try and boot it for the first time? I can't find an easy answer anywhere, but there must be a way.
From your original post, I'm drawing the following conclusions:
1. You have created 1 virtual machine in Fusion.
2. That vm has 2 virtual hard drives assigned to it.
3. You installed Ubuntu on 1 of the vhd's to use as the host system for LFS to be installed on the 2nd VHD.
Just following the instructions in the book should net you with a single virtual machine in Fusion that dual boots between Ubuntu and LFS. (There's one wrinkle to this which I will get into later)
If you wanted LFS to be it's own virtual machine in Fusion, then you've got a few extra steps to take. Here's what I would do:
1. create a new virtual machine in Fusion for LFS. Assign as much RAM as you want and point it's virtual hard drive to the vhd you built lfs on. (You may have to unassign it from the Ubuntu vm first. My experience is with Sun's Virtual Box, not with Vmware's Fusion product)
2.Boot to a live CD (or ISO image). you can use the Ubuntu install CD (choose the option to "try Ubuntu without changing system")
3.Once booted into the live CD, mount the vhd that has LFS built on it.
4.Follow the LFS instructions for entering the chroot environment. The "mount -v --bind /dev $LFS/dev" is just to expose existing devices to the temporary chroot environment. Otherwise grub won't see your proper hard drive(s). You have to redo this because it is undone whenever you reboot the virtual machine.
4.Follow the Grub configuration instructions in the LFS book again. This time LFS will only be on the only vhd so root(hd0,1) would be correct assuming LFS is built on the 2nd partition. If Lfs is on the 1st partition, then it needs to be root(hd0,0).
5.Unmount the CD/ISO from the virtual machine and boot from the vhd.
The dual boot config in 1 vm should work, but... if you used Ubuntu 9.10 as the host system... 9.10 uses Grub2 as it's boot loader. I used 9.10 as my host distro on my PC, and had issues getting the dual boot between LFS and U9.10 to work. I ended up not installing the LFS grub, and I let Ubuntu control the boot, and just added an entry for LFS into Ubuntu's grub config. There was a learning curve there because GRUB2's config is quite a bit different.
I did eventually get the LFS to boot in the virtual machine, but I couldn't get the disks out of the read-only part of the boot, and so the whole filesystem was locked down.
It made me realise that I probably didn't know enough about booting linux, and its start-up sequence, so I've spent some time since then getting the hang of GRUB (both the 0.97 and the 1.97 versions) on a netbook, where I've created a Mint-Linux, Ubuntu and Slackware system that shares the /boot and /home directories across the three distributions. I think this has given me enough knowledge to feel more comfortable about getting the LFS to boot properly under VM Fusion.
I will probably start again with LFS in the future, but at the moment I'm busy with other things, and don't really have the time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.