KVM has a virtual IDE disk interface, and my system recognizes the virtual disk as /dev/sda1 and /dev/sda2 during the initramfs (I need initramfs because I use LVM2 for teh root filesystem on all my linux boxes so I can use snapshots during backups.), but when I try to run vgscan during the initramfs, it does not find the volume group, so I think (after much trial and error) that I must have the wrong disk driver installed.

The latest gentoo minimal live cd boots fine under kvm, so there has to be a driver that works; I just don't seem to be able to find it.

do you have DEVTMPFS and mount DEVTEMPFS?
What about partition table support. You probably only need MSDOS Partition Table support but what sort of partition table did you create?_________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

About all thats left is to suggest that you are not booting the kernel you think you are.
Chase the date stamps from the .config, to the bzImage in the build location to the kernel in /boot, they should get progressively later. The last two may be identical.

Check for typos in file names in grub.conf and in /boot, maybe you didn't mount /boot ?_________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

All dates, names, and lengths check out. I am booting the kernel I mean to be booting.

'Tis a puzzlement...

However, since my kernel seems to be able to find /dev/sda, /dev/sda1, and /dev/sda2, does that mean that the correct driver is present and working? Maybe its a device manager LVM problem? The logical volumes show up when I run the live cd, so its OK on the disk. I've checksd and re-checked that LVM2 has been emerged, that the init script is correct in the initramfs, and that the device manager is installed in the kernel .config file.

In reality, I had a completely different problem: a typo in the /etc/conf.d/net file that set up the tap device the vm was connected to.

Also in reality, it really *IS* a 8139cp, and my dmesg told me so, but before I looked at that, I changed to the 8139too driver, and only after that did I discover the above typo.

So now with the /etc/conf.d/net configuring the tap device correctly, and the 8139cp driver, my simple stripped down gentoo vm is working.

So I now have to go take a look at the kernel on my *REAL* gentoo vm and make sure the driver is set to 8139cp, and also figure out why the vgscan in the initramfs is not picking up my volume groups.

I suspect I botched something in the lvm binary in the initramfs /bin directory, but who knows? I will report back when I have investigated deeper. _________________The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

I boot to a root filesystem that is running LVM so that I can use the LVM snapshot target to freeze the state of the filesystem while I take a backup while the system continues to run.

You example looks like it sets up LVM on a second drive/partition after you have already gotten the root filesystem mounted.

I don't know what the problem is. From within the init script, can see /dev/sda, /dev/sda1 (the boot partition, not under LVM), and /dev/sda2 (the partition that acts as the physical volume). When the init script does ls /dev/sd*, it shows these drives and partitions. But when the init script issues lvmdiskscan, it shows NO DRIVES!

I tried rebuilding lvm.static and copying it into the initramfs, but it made no difference.

I use this same technique to boot real physical machines all the time, so I am really boggled why it doesn't also work here. _________________The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Well, yes and no. I have root on LVM, usually on raid5, but that snippet is from a system with SSD, so no raid yet.
Its from the initrd, which is indeed the root elsewhere that you refer too It starts the ssd volume group (on the ssd) and the vg volume group (on raid5), as /home and /usr/portage is still there.

My main point was that vgscan is not required, only vgchange._________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

Yes, I agree, the vgscan is not required, provided everything else is working properly, but if there *ARE* problems, the output of vgscan can provide some diagnostic help.

And right now, I *NEED* help.

I am just learning about kvm and the associated qemu options and types of filesystems and networking to support it. I have networking working with a natted bridge and taps to each vm, but it is not elegant yet, just kind of duct taped together. I still need to learn more about bridge devices and the commands associated with them, and about taps. The closest to these I have come so far is tun devices when setting up openvpn tunnels.

I can boot the gentoo minimal livecd in a vm and lvm works fine there. I use lvm for my root filesystem on all my gentoo boxes already, with an initramfs to set things up, but the same technique is not working for me when I try to do it under a vm.

I have win-xp-pro and w7-32bit working fine, but the images are on an xfs filesystem. At least the images are on their own logical volume. I have since learned that there are definate advantages to using a filesystem that supports sparse files, so the images for the vm's can be over-provisioned on the available filesystem space.

I have also just learned that there is apparently a qemu option to say that a backing store for the vm's memory can be provided, so suspend/resume and migrate operations can work, and that there is an option to specify that the vm is to use the original image as read-only, and provide an additional file to use for copy-on-write. I was thinking how to neatly to that with lvm and snapshots, but that got messy when I thought about sparse filesystems. It wasn't too bad with fully pre-allocated images, each on a separate logical volume. Apparently all that thinking was not necessary, as qemu looks like it takes care of that for me, so running a vm with a throw-away disk, starting with a known good image, should be easy. Can I also spawn multiple levels of copy-on-write disk images, to implement chains of snapshots? That was feature of vmware workstation that I liked a lot.

Where is the man page for qemu-kvm? I do not seem to have one. Is there a good book on qemu and kvm anywhere? I have search my Safari-books-online subscription, but all I see is a bunch of system administration books that just touch on qemu and kvm. The best thing I have found so far is a pdf from IBM on best practices, but it is not a complete reference, and assumes one already knows qemu and kvm pretty well._________________The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.

Last edited by Moriah on Tue Apr 30, 2013 6:43 pm; edited 1 time in total

I think I might have found my problem with lvm in my initramfs. I had just lvm vgscan, but I *SHOULD* have had lvm vgscan --mknodes instead. I also should have had:

Code:

echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

before the vgscan.

Nevertheless, I am now trying to build a guest kernel (3.7.10-gentoo-r1) to use virtio for the disk and network, so I need to set VIRTIO_BLK for the disk, and VIRTIO_NET for the network device. I am using make menuconfig to configure the kernel, along with Pappy's seeds as my starting point, but I cannot seem to find VIRTIO_BLK. When I do "/virtio_blk" in menuconfig, it shows:

In a similar manner, "/virtio_net" shows that the Prompt: Virtio network driver (EXPERIMENTAL) should be in -> Device Drivers -> Network device support (NETDEVICES [=y]) -> Network core driver support (NET_CORE [=y])", but I cannot find that prompt either.

How do I configure for virtio disk and network devices if the prompts aren't there?

I was able to start kvm from the live cd with these virtio devices and it "just worked", so the underlying stuff is there; I just can't see how to configure my kernel to use it.

I cannot even find these symbols in the .config file:

Code:

livecd gentoo # grep VIRT usr/src/3.7.10-gentoo-r1-x86_64-08.config
# CONFIG_PARAVIRT_GUEST is not set
CONFIG_VIRT_TO_BUS=y
# CONFIG_FB_VIRTUAL is not set
# CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_MMIO is not set
# CONFIG_VIRT_DRIVERS is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_VIRTUALIZATION is not set
livecd gentoo #

Your understanding of menuconfig is faulty. The output you posted shows that, as you said, Virtio block driver is under Block devices. However, what you did not remark on, and may not have understood, is that you can only choose a value for that symbol after the expression in the Depends on line is true. The output you posted shows the expression is currently false by way of VIRTIO=n. Find the symbol VIRTIO (not VIRTIO_BLK or VIRTIO_NET), set it to true, and then you should have access to the Virtio block driver entry.

You can use Z in menuconfig to show unsatisfied entries, but you still will not be permitted to change them until you satisfy their dependencies.

menuconfig is a big improvement over the old line by line questionaire we had to use in the early days of slackware circa 1994, but all the current tools are pretty crude compared to what ought to be possible. I have long wished for an expert system type of kernel configurator, and with tools like jess, it ought to be possible. After all, Forgy's R1 that later became VAXCON was production rule based, and was probably the most successful expert system of the 1980's. Maybe this could be a summer intern project for somebody. _________________The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

OK, I have a system all built and ready to boot except grub is giving me a hard time. The system is built using a single /dev/vda virtual disk under kvm, and has 2 partitions: /dev/vda1 and /dev/vda2. When I run grub, it refuses to accept the root command:

Thanks Neddy! I never had to use the --device-map option before; I did not even know it existed. It seems to have done the trick. _________________The MyWord KJV Bible tool is at http://www.elilabs.com/~myword