Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't get /boot in Linux Guest (QEMU) GRUB2 working [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Mon Jun 08, 2015 12:18 am    Post subject: Can't get /boot in Linux Guest (QEMU) GRUB2 working [SOLVED] Reply with quote

I'm in the final stages of building a Gentoo based VM (Virtual Machine). At the moment, when I attempt to boot the new VM, it does not see the correct location for the installed kernel and falls back (and fails) to trying a network boot.

To build the new VM, I boot to the file which holds the VM using 'sysrescd' as the bootable cdrom with this script:
Code:
#!/bin/bash

# script for initialising qemu w/KVM based VM as /pubroot/qemu/guynonet-q01
#
# Because we're defining a bridge based network topolgy. we need to execute
# qemu with root privileges. This means starting qemu through sudo.

sudo \
        qemu-system-x86_64 \
        -enable-kvm \
        -cpu host \
        -m 1024 \
        -smp 2 \
        -vga qxl \
        -netdev bridge,id=vnet0 -device virtio-net-pci,netdev=vnet0,mac=$( printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) ) \
        -boot order=d \
        -cdrom /sysrescd/systemrescuecd-x86-4.5.2.iso \
        -drive file=/pubroot/qemu/myuser-q01,if=virtio

Explanatory notes:
  • Use 'sudo' because the 'bridge' networking utilities require root priviledges for use with QEMU.
  • Use '-vga qxl' because I also plan on using SPICE to support cutting and pasting between host and quest.
  • Use '-drive file=/pubroot/qemu/myuser-q01,if=virtio'. This sets the path to my VM. It also sets access to the VM's hard drive through the host kernel's KVM 'virtio_blk' module. This results in my VM hard drive in the guest being listed as '/dev/vda'.

I tried following the QEMU/Linux guest instructions regarding the installation of GRUB2, but they appear to be dated and no longer correct. For example, '--device-map' option is no longer available. Also, the instructions call for 'grub-install' which doesn't seem to exist. The install command appears to be 'grub2-install'.

I did try to simply follow the handbook and both 'grub2-install' and 'grub2-mkconfig' and these seemed to work as expected and didn't report any errors. The '/boot/grub/grub.cfg' script seems reasonable and correct. The respective correct UUIDs for the '/' {root} and '/boot' directories appear in the script.

The shell script/command I want to use to boot the newly created VM is:
Code:
#!/bin/bash

# script for linux quest in qemu w/KVM based VM as /pubroot/qemu/myuser-q01
#
# Because we're defining a bridge based network topolgy. we need to execute
# qemu with root privileges. This means starting qemu through sudo.

sudo \
        qemu-system-x86_64 \
        -enable-kvm \
        -cpu host \
        -m 1024 \
        -smp 2 \
        -vga qxl \
        -netdev bridge,id=vnet0 -device virtio-net-pci,netdev=vnet0,mac=$( printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) ) \
        -drive file=/pubroot/qemu/guynonet-q01,if=virtio \
        -boot order=c,once

The problem appears to be that grub doesn't correctly see the virtual hard drive at boot time.

I did see some notes in GRUB2 {section 3} regarding the setting of GRUB_DEVICE, but I haven't done much with that yet. I'm still a bit confused by what I read.

Does anyone have what the currently correct steps are to make the linux guest grub2 bootable?
_________________
People whom think M$ is mediocre, don't know the half of it.


Last edited by dufeu on Thu Jun 18, 2015 1:12 am; edited 2 times in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7132
Location: almost Mile High in the USA

PostPosted: Mon Jun 08, 2015 5:43 pm    Post subject: Reply with quote

Does grub2 run at all and gets stuck, or the VMM think there's no boot sector at all?

How did you try to install grub on the virtual image? Did you boot the virtual image (using the livecd or something) and used grub-install on the virtual hard disk in the VM, or some other way?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Mon Jun 08, 2015 10:50 pm    Post subject: Reply with quote

eccerr0r wrote:
Does grub2 run at all and gets stuck, or the VMM think there's no boot sector at all?

VMM thinks there is no boot sector at all. That's what I meant that it drops to attempting to boot via network boot. I should have been more clear on that.
eccerr0r wrote:
How did you try to install grub on the virtual image? Did you boot the virtual image (using the livecd or something) and used grub-install on the virtual hard disk in the VM, or some other way?

I initially booted the VM using the 'sysrescd' cdrom image and an 'empty' virtual disk. I then did the normal install process as per the Gentoo handbook. According to the official QEMU docs, setting up the virtual hardrive by using 'virtio' as the drive interface results in /dev recognizing instantiated disks as /dev/vd[a-z]. This is what my virtual hard drive looks like:
Code:
/dev/loop0: TYPE="squashfs"
/dev/sr0: UUID="2015-03-28-11-54-44-00" LABEL="sysrcd-4.5.2" TYPE="iso9660"
/dev/vda1: UUID="a47da14a-a96b-41aa-8125-aadd17854de7" TYPE="ext2" PARTUUID="df1c0ba0-01"
/dev/vda2: UUID="44a8e896-d60f-4971-9e7a-e40632e0831f" TYPE="swap" PARTUUID="df1c0ba0-02"
/dev/vda3: UUID="36dd96d6-2d5f-479b-b856-c87effe8fe6d" TYPE="ext4" PARTUUID="df1c0ba0-03"
/dev/vda4: UUID="f2c2d87b-b077-47bc-8d42-fc385b7e84cf" TYPE="ext4" PARTUUID="df1c0ba0-04"

As I noted above, 'grub2-install' and 'grub2-mkconfig' report there were no errors. The resulting /boot/grub/grub.cfg file contains the correct UUIDs in the correct places.

I've been playing around trying different things and the '-boot order=[3-4]' seems problematic at times. i.e. I can sometimes get it so that the cdrom image won't boot either and I get the fallback to qemu attempting a network boot.

I'm certainly open to suggestions!

I'd really appreciate seeing some known working qemu scripts which incorporate 'qxl', 'spice', etc.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Tue Jun 09, 2015 1:19 am    Post subject: Reply with quote

this ?
https://forums.gentoo.org/viewtopic-t-871501-start-0.html
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jun 09, 2015 3:52 am    Post subject: Reply with quote

cal22cal wrote:
this ?
https://forums.gentoo.org/viewtopic-t-871501-start-0.html

Unfortunately .. no.

However, that thread did provide me with some clues which were helpful in eliminating some of my misunderstandings. The comment by cach0rr0 in that thread was paticularly helpful.

  • The discussion of Grub/QEMU in the Gentoo QEMU/Linux guest wiki article is dated and applies to original Grub only. I probably have to do something similar but use environmental variables instead with 'grub2-install' as mentioned in GRUB2/Config Variables
  • The qemu '-drive' options have changed. These are the current options are:
    Code:
    -drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
           [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
           [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]
           [,serial=s][,addr=A][,rerror=ignore|stop|report]
           [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]
           [,readonly=on|off][,copy-on-read=on|off]
           [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]
           [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]
           [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]
           [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]
           [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]
           [[,iops_size=is]]
                    use 'file' as a drive image
    The above is from running:
    Code:
    qemu-system-x86_64 -help
    Notice there is no longer a 'boot=on' sub-option and now gives a warning that it is deprecated and ignored. I believe that the '-boot order=#' option replaces the 'boot=on' sub-option.

Anyway, I'm still working on the problem and would appreciate any other advice regarding this issue.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 09, 2015 10:57 am    Post subject: Reply with quote

if grub2 is correctly install and cannot see your kernel, it should tell you: cannot find file x or z.
so having a host that boot grub2 and doesn't gave you any message than try to boot network is telling you grub2 is not working at all.

i don't think you have install grub2 correctly (not about configuration, but just about installing it as bootloader).
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jun 09, 2015 11:59 am    Post subject: Reply with quote

krinn wrote:
if grub2 is correctly install and cannot see your kernel, it should tell you: cannot find file x or z.
so having a host that boot grub2 and doesn't gave you any message than try to boot network is telling you grub2 is not working at all.

i don't think you have install grub2 correctly (not about configuration, but just about installing it as bootloader).

You may be correct but at I think at this point it may be a problem with QEMU.

This is the message I'm now getting from QEMU after I attempt to boot into the new VM image:
Code:
line 17: -drive: command not found

The boot script now looks like this:
Code:
#!/bin/bash

# script for linux quest in qemu w/KVM based VM as /pubroot/qemu/myuser-q01
#
# Because we're defining a bridge based network topolgy. we need to execute
# qemu with root privileges. This means starting qemu through sudo.

sudo \
        qemu-system-x86_64 \
        -enable-kvm \
        -cpu host \
        -m 1024 \
        -smp 2 \
        -vga std \
#       -cdrom /sysrescd/systemrescuecd-x86-4.5.2.iso \
#       -hda /pubroot/qemu/guynonet-q01 \
        -drive file=/pubroot/qemu/guynonet-q01,if=virtio \
        -boot order=c,once \
        -netdev bridge,id=vnet0 -device virtio-net-pci,netdev=vnet0,mac=$( printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) )
Line 17 is exactly the same line as from the corresponding script I use when booting from the cdrom image.

In other words, qemu properly sees the virtual hard disk in the 'init_q01.sh' script but gives me a bad '-drive' when I try to actually boot from the virtual hard drive.

I've also tried executing the command in full directly from the command line:
Code:
sudo qemu-system-x86_64 -enable-kvm -cpu host -m 1024 -smp 2 -vga std -drive file=/pubroot/qemu/guynonet-q01,if=virtio -boot order=c,once -netdev bridge,id=vnet0 -device virtio-net-pci,netdev=vnet0,mac=$( printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) )
and I get this error:
Code:
qemu-system-x86_64: Invalid boot device for PC: 'o'

I get the same error if I try to directly run the same command from 'root'.

In other words, the problem doesn't appear to be a matter if 'grub2' is properly installed at this point but rather that qemu fails before I even get to the virtual disk.

Tonight, just for something else to try, I'm going to downgrade qemu from '2.3.0-r1' to 2.2.1-r2 and see what happens.

The second thing I'm going to try is to build another VM but not use the 'virtio' interface for the virtual hard drive. This will take a bit longer for me to do. The reasoning here is that virtio ends up assigning the virtual hard drive to /dev/vda while the other drive interfaces assign to either /dev/sda or /dev/hda (i'm not certain which yet. The docs aren't clear on this).

I'll report back on the results when I have them. Other suggestions are certainly welcome! I'd really like to solve this.

BTW, the "'Invalid boot device for PC: 'o'" message tells me that qemu doesn't see the virtual hard drive and then fails on attempting to boot from the second virtual NIC device. This is a fallback boot strategy built into qemu which follows the usual PC boot strategies. harddisk --> nic1 --> nic2 (corresponds to C --> N --> O).
_________________
People whom think M$ is mediocre, don't know the half of it.


Last edited by dufeu on Tue Jun 09, 2015 12:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 09, 2015 12:12 pm    Post subject: Reply with quote

dufeu wrote:
Code:
qemu-system-x86_64: Invalid boot device for PC: 'o'

I get the same error if I try to directly run the same command from 'root'.


Well if qemu is complaining about "o" from boot-order=c,once it's easy to guess it only look at one char next to the ,

So either boot-order accept {drive letter, drive_letter} format or {drive_letter, drive_part_num}, anyway i think you are configuring a new qemu using some doc that was build for an old qemu.
Of course downgrading qemu may fix it as previous version may use previous config style, but you will not seriously stay with that version for ever, so i think it would just be easier to directly learn the new config style.

look my qemu man says:
-boot
[order=drives][,once=drives]

so boot order=cd,once=d
should do "boot from hardisk, than cdrom, but boot once to cdrom"
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jun 09, 2015 12:22 pm    Post subject: Reply with quote

krinn wrote:
dufeu wrote:
Code:
qemu-system-x86_64: Invalid boot device for PC: 'o'

I get the same error if I try to directly run the same command from 'root'.


Well if qemu is complaining about "o" from boot-order=c ..

Sorry! I was in the middle of adding some clarification to my previous post while you were replying.

The letter 'o' in the message comes from the qemu boot strategy. It's reporting the failure of the last boot method it tries. The letter 'o' corresponds to attempting to boot from the second NIC. This is in the qemu documentation. For x86 based PCs, the boot letters follow the usual convention of
  • a) floppy 1,
  • b) floppy 2,
  • c) hard drive,
  • d) cdrom,
  • n) nic1 and
  • o) nic2.

If I could post a screen shot of the qemu boot window it would be a lot clearer.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Tue Jun 09, 2015 12:31 pm    Post subject: Reply with quote

jormartr's tip let me boot my vm up.
I followed his/her comment and created an initrd file and my vm finally boot up. :)

I was using grub2 with sata vm, cow image orginially created by virtualbox to test btrfs.
Every went fine until switching to the virtio disk by libvirt.

Finally, gave up and used grub lagcy but still no luck.
grub shell ls can't find any /dev/vda
So, grub and vm installation were fine but only the vitrio drivers.

Having more test, even all the vitrio drivers compiled in kernel.
the initrd file have to be there in order to boot up the vm.

Suggest fire up the vm by sata. If everything goes fine, then follow jormartr's tip.

Good luck.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 09, 2015 12:36 pm    Post subject: Reply with quote

I don't need a screenshot, but you really need to review the config params.
"once=o" is not the same as "once o", this kind of stuff should be made conforming to the doc, so you don't get into surprise like you might be in.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jun 09, 2015 12:41 pm    Post subject: Reply with quote

OK - some good news. I finally got qemu to recognize the virtual hard drive. And yes, grub2 is properly installed. However, I still need to work out some issues with 'grub2-mkconfig'. Apparently, I need to avoid using UUIDs. I need to leave the house soon so I'll report on how I got qemu to recognize the drive now and follow up on the rest later.

I modified the '-boot' option to:
Code:
-boot order=c,once=c,strict=on

As I understand the qemu documentation
  • order=c --> boot from hard drive
  • once=c --> only try to boot 1 time
  • strict=on --> do not try any other boot methods

The grub2 screen came up as expected with the correct options.

At this point, I have the boot screen waiting with a message that is can't find the 'root' block device so I know it properly found '/boot', loaded my kernel and started booting my system.

Progress! ;)
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 09, 2015 12:46 pm    Post subject: Reply with quote

dufeu wrote:

As I understand the qemu documentation
  • order=c --> boot from hard drive
  • once=c --> only try to boot 1 time
  • strict=on --> do not try any other boot methods


That's not how i read it myself
order=c,once=d
mean boot order hardisk first, and nothing more, but boot once using cdrom (and the next boot will respect the order you have set)

as a more complex sample: boot=cod,once=d
that mean try boot from hdd, network, than cdrom, but first time, try to boot from cdrom, it's like in your bios you setup boot order to hdd, network, cdrom but when booting you hit the F8 (classic boot menu prompt for bios) and pickup cdrom
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Jun 09, 2015 3:14 pm    Post subject: Reply with quote

Nice info, krinn.

So does "once" mean "try it once on first initialisation"?
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Wed Jun 10, 2015 12:31 am    Post subject: Reply with quote

steveL wrote:
Nice info, krinn.

So does "once" mean "try it once on first initialisation"?

Personal observation of the messages displayed in the SDL window {case where virtual hard drive isn't found - no floppy drives defined} - my interpretation:
  • -boot order=c qemu 'bios' equivalent cycles endlessly attempting to boot from c: (hard drive) n: nic1 o: nic2
  • -boot order=c,once qemu 'bios' equivalent attempts to boot from c: n: o: one time each. Screen just sits after attempting o:
  • -boot order=c,once=c functionally same as above. I assume you'd have to add a flag to disable attempting to boot via nic since nic is enabled by default.
YMMV. My observations subject to misinterpretation. ;)
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Wed Jun 10, 2015 12:56 am    Post subject: Reply with quote

Two steps forward, next roadblock smashed into ..

This is the current boot progress:
  • qemu command executes and opens and SDL window to display BIOS equivalent messages {which usually flash by too fast to notice}.
  • Virtual disk is successfully found.
  • Grub2 boot start.
  • /boot partition is identified.
  • Grub2 boot screen displays.
  • Control passes to initramfs/kernel.
  • Kernel messages start scrolling down screen.
  • Kernel progess halts due to not being able to find '/' {root} partition.

The {transcribed} messages are:
Code:
>> Determining root device...
!! Block device /dev/vda4 is not a valid root device...
!! Could not find the root block device in .
..

.. and blah blah blah.

If I select the 'shell' option to 'busybox' and do:
Code:
ls /dev
no hard disk devices are listed.

A moment of head banging desk ensues.

Just a guess here, but I'm pretty sure I need to load one or a few modules into initramfs to support the 'virtio' disk interface ..

Except I have no clue what to module{s} to insert at the moment. I think I just need to tell 'genkernel' which kernel modules need to be modprobed or perhaps compile them in as part of the kernel. Further research is indicated.

FWIW - I'm pretty sure I have qemu executing correctly as far as I've gotten with it. I'm also pretty certain grub2 is installed and functioning correctly. I'm just quessing here that I need to modify initramfs at this point.

As usual; tips, suggestions, guidance are all avidly welcomed.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 10, 2015 1:43 am    Post subject: Reply with quote

steveL wrote:
Nice info, krinn.

So does "once" mean "try it once on first initialisation"?

That's really how i understand that myself.
manpage wrote:
To apply a particular boot order only on the first
startup, specify it via once.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 10, 2015 1:46 am    Post subject: Reply with quote

dufeu wrote:

Just a guess here, but I'm pretty sure I need to load one or a few modules into initramfs to support the 'virtio' disk interface ..

Agree. You lack kernel or initramfs drivers for the controller and disks cannot be seen.
Suggestion: i never saw anyone said you cannot lspci -k on a vkm host too ;)
Just load your install cd and run lspci to find the drivers name (could it be that easy? well, maybe...).
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Wed Jun 10, 2015 10:48 am    Post subject: Reply with quote

Actually, that is the point I wanted to tell you in my first post :wink:
https://forums.gentoo.org/viewtopic-t-871501-start-0.html

After the grub had been installed without any problem.

jormartr's tip
Code:

add to /etc/genkernel.conf
   
MODULES_KVM="virtio virtio_balloon virtio_ring virtio_pci virtio_blk virtio_net"

to generate the initrd
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Fri Jun 12, 2015 11:53 am    Post subject: Reply with quote

krinn wrote:
Agree. You lack kernel or initramfs drivers for the controller and disks cannot be seen.
Suggestion: i never saw anyone said you cannot lspci -k on a vkm host too ;)
Just load your install cd and run lspci to find the drivers name (could it be that easy? well, maybe...).

Nice tip! Had to review the man page for 'lspci'. Even though I use it all the time, I wasn't familiar with the '-k' option.

FWIW: These are the results from using the 'sysrescd' image as the qemu guest with all the 'virtio' options:
Code:
root@new-host-3 /root % lspci -k
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
        Subsystem: Red Hat, Inc Qemu virtual machine
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
        Subsystem: Red Hat, Inc Qemu virtual machine
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
        Subsystem: Red Hat, Inc Qemu virtual machine
        Kernel driver in use: ata_piix
        Kernel modules: pata_acpi, ata_generic
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
        Subsystem: Red Hat, Inc Qemu virtual machine
        Kernel driver in use: piix4_smbus
        Kernel modules: i2c_piix4
00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
        Subsystem: Red Hat, Inc QEMU Virtual Machine
        Kernel driver in use: qxl
        Kernel modules: qxl
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
        Subsystem: Red Hat, Inc Device 0001
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
        Subsystem: Red Hat, Inc Device 0002
        Kernel driver in use: virtio-pci
        Kernel modules: virtio_pci

Or more succinctly:
Code:
root@new-host-3 /root % lspci -k | grep -i 'kernel driver'
        Kernel driver in use: ata_piix
        Kernel driver in use: piix4_smbus
        Kernel driver in use: qxl
        Kernel driver in use: virtio-pci
        Kernel driver in use: virtio-pci


cal22cal wrote:
Actually, that is the point I wanted to tell you in my first post :wink:
https://forums.gentoo.org/viewtopic-t-871501-start-0.html

After the grub had been installed without any problem.

jormartr's tip
Code:

add to /etc/genkernel.conf
   
MODULES_KVM="virtio virtio_balloon virtio_ring virtio_pci virtio_blk virtio_net"

to generate the initrd

This is very helpful! Thanks.

I'm reviewing {yet again} my guest kernel configuration and comparing all the KVM settings as well. I know I covered all the ones explicitly mentioned in everything I've read but I've also hit a few I haven't seen in any guides. It's a little frustrating because some CONFIG parameters don't appear in '.config' without their respective prerequisite 'CONFIG' parameters. I'm still doing some experimentation and will report back later when I have more.

FWIW, I'm using the '.config' from the 'sysrescd' kernels as a guide to finding all the needed settings I may have missed.

Thanks for the great pointers!
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Jun 12, 2015 3:03 pm    Post subject: Reply with quote

dufeu wrote:
I'm reviewing {yet again} my guest kernel configuration and comparing all the KVM settings as well. I know I covered all the ones explicitly mentioned in everything I've read but I've also hit a few I haven't seen in any guides. It's a little frustrating because some CONFIG parameters don't appear in '.config' without their respective prerequisite 'CONFIG' parameters.

You can always search for the parm you want (with or without CONFIG_ on the front), which will also tell you what it needs, and enables.

I use make nconfig which displays the buttons (F8,F9 etc) at the bottom of the terminal; traditionally you use '/' to search, afair.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Thu Jun 18, 2015 1:12 am    Post subject: Reply with quote

I've finally got qemu to boot the new kernel.

As a recap, the last problem I was dealing with was that qemu wasn't finding the '/' partition after grub2 handed off conftrol to the guest's kernel. The actual problem was that the 'virtio' based hard drive bus driver wasn't getting loaded no matter what I tried. No disk bus meant no visible disks.

I tried a number of different things including working with the above {very excellent and informative} tips.

Nothing I tried worked. I still believe that I can create a proper initramfs which includes:
Code:
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
        Subsystem: Red Hat, Inc Virtio block device
        Kernel driver in use: virtio-pci

I just haven't figured out exactly what I need to include in my 'genkernel.conf' file.

What finally worked was to go back into the guest's kernel configutration and change CONFIG_VIRTIO_BLK from [=m] to [=y]:
Code:
Symbol: VIRTIO_BLK [=y]
 Type  : tristate
 Prompt: Virtio block driver
  Location:
    -> Device Drivers
(1)  -> Block devices (BLK_DEV [=y])
  Defined at drivers/block/Kconfig:515
  Depends on: BLK_DEV [=y] && VIRTIO [=y]

In other words, the hard disk bu driver for 'virtio' needs to be compiled into the kernel instead of being a module.

I'm still not sure why the genkernel option "--all-modules-initramfs" didn't include the 'virtio' modules even though the modules were in the correct /lib/modules/ subdirectory.

I'll leave that question for another time. For now, I've updated the OP to reflect that I do have a working solution.

Thanks everyone for some great tips!
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum