Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing into KVM guest - virtio networking not working
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
M51
n00b
n00b


Joined: 29 Mar 2015
Posts: 11

PostPosted: Sun Mar 29, 2015 3:32 am    Post subject: Installing into KVM guest - virtio networking not working Reply with quote

I feel like I'm missing something. This is my first Gentoo install.

Using install image: install-amd64-minimal-20150319.iso

I am trying to install into a KVM guest running on a Debian Testing host. The kvm guest system is a simple layout, consisting of a (qcow2) 50GB GPT disk with a BIOS boot partition, a root partition with BTRFS, and a swap partition, a single CPU and 1GB of ram allocated and virtio is the NIC type.

Networking works in the installer and eth0 exists, but after rebooting into the installed system, eth0 does not exist. I have enabled everything virtio and kvm related in the kernel that I can find.

The only thing of note I can think of that happened during the install is that when unmounting file systems at the end of the install, either the proc or sys filesystem refused to unmount due to being busy. I rebooted the system anyway and everything seemed fine except for the eth0 issue.

If I change the VM to use an e1000 NIC instead of virtio, I can get it working, but I prefer virtio.

Question: How can I get virtio networking functional?

Additional question: If I switch the NIC type to e1000, I get an adapter called enp0s3. It picks up a dhcp address and works fine despite me not having created a symlink for it in /etc/init.d or adding it to /etc/conf.d/net. Why does it work without those steps?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13848

PostPosted: Sun Mar 29, 2015 3:34 pm    Post subject: Reply with quote

Please pastebin a stripped kernel configuration. You can remove comments with grep -E '^[^#]' config. To confirm, if you use virtio networking, ip link shows no sign of any interface other than lo, correct?

Your adaptor is named enp0s3 because udev is mangling your device name. This is discussed frequently because it confuses so many new users. Search for "Predictable Network Interface Names" to find extensive discussion on what has happened and opinions on whether this should be the default. If you want to revert to using the eth0 name, add net.ifnames=0 to your kernel command line. The user process responsible for mangling the names will then leave them alone, thus retaining the kernel assigned name.

Your interface uses DHCP as the default if no configuration is specified in [b]/etc/conf.d/net[b]. It is probably starting automatically because something else depends on it.
Back to top
View user's profile Send private message
M51
n00b
n00b


Joined: 29 Mar 2015
Posts: 11

PostPosted: Sun Mar 29, 2015 5:01 pm    Post subject: Reply with quote

kernel config: http://pastebin.com/4jX024Ha

ip link shows only lo and sit0@NONE

One thing I have noticed: On the install image I see a lot of stuff under /lib/modules/`uanme -r`/kernel/drivers/net/ including the module virtio_net.ko. On my installed system, the drivers folder is practically empty and there is no net subdir at all. Is my install hosed?


Sorry, I actually already understood why the e1000 adapter name was different.
I guess I was really just curious why that adapter worked out-of-the-box without creating a symlink in /etc/init.d or creating an /etc/conf.d/net entry for it, leading me to wonder what purpose those steps in the install instructions serve.

> "Your interface uses DHCP as the default if no configuration is specified in [b]/etc/conf.d/net[b]. It is probably starting automatically because something else depends on it."

OK, that clears up for me why the /etc/conf.d/net entry isn't needed , thanks. I'm not sure what would depend on the adapter to make it start automatically, as I haven't installed anything beyond the required stuff in the installation instructions yet. Not a big deal I suppose.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13848

PostPosted: Sun Mar 29, 2015 10:06 pm    Post subject: Reply with quote

The drivers directory only has loadable kernel modules. If you use a monolithic kernel, there will be few or no entries in it. This is normal. My system is purely monolithic and does not support loadable modules at all. You can also get a situation like this if you forget to use make modules_install. Your kernel configuration confirms that VIRTIO_NET is not enabled, so your installed kernel has no support for the virtio card. You will need to build and install a new kernel with this option enabled. You do not need to restart the install or otherwise discard your work to this point.

The install instructions tell you to activate networking so that it will start on boot, even if you have no registered services which need it. Pure desktop systems might not have any network-using services, but the user would like to check mail, use a browser, etc. without first using a root shell to activate the network. You can search the running services for need net to find which one caused the network to be brought up.
Back to top
View user's profile Send private message
M51
n00b
n00b


Joined: 29 Mar 2015
Posts: 11

PostPosted: Mon Mar 30, 2015 1:44 am    Post subject: Reply with quote

After your advice I thought I had it...I stumbled across the innocuously named 'Linux Guest' section when running make menuconfig. That sub-menu was empty until I enabled it and then a bunch of paravirtualization stuff showed up in the menu. I enabled everything that looked relevant and did a make, make modules_install, and make install, but after a reboot the situation remains unchanged. I don't suppose you can guide me to the proper options to enable?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13848

PostPosted: Mon Mar 30, 2015 2:55 am    Post subject: Reply with quote

The configure option is VIRTIO_NET, which has the description "Virtio network driver" and requires VIRTIO=y before it is visible.
Back to top
View user's profile Send private message
M51
n00b
n00b


Joined: 29 Mar 2015
Posts: 11

PostPosted: Mon Mar 30, 2015 4:07 am    Post subject: Reply with quote

Hooray it's working. Thanks, I finally found the option under network devices. Trying to find that option reminds me of Arthur Dent trying to find the demolition plans for his house...

Regarding the other stuff: By trial and error, it seems netmount was responsible for starting the interface and even starting dhcpcd if it wasn't set up to start with the default runlevel.

Since it starts anyway, what do I gain by creating the symlink /etc/init.d/net.eth0 ?

Thanks again for the help.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13848

PostPosted: Tue Mar 31, 2015 1:22 am    Post subject: Reply with quote

Configuring the network to start ensures that you always start networking, even if you later remove netmount from the default startup list.
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