LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Host PC has internet connection but virt-man VMs don't. (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/host-pc-has-internet-connection-but-virt-man-vms-dont-4175700769/)

linustalman 09-17-2021 02:21 PM

Host PC has internet connection but virt-man VMs don't.
 
Hi.

It did work before.

Does anyone know a fix?

Thanks.

Note: I should have mentioned earlier that I upgraded from Debian 10 to 11 instead of doing a clean install. Perhaps that's a cause?

John VV 09-17-2021 07:27 PM

you need to create a new bridge

I am on opensuse ( KDE) and not on Debian so as to just how you go about it ?
i do not know .

linustalman 09-18-2021 04:03 AM

I also use AQEMU and have a FreeBSD VM. It can connect to the internet without issue.

linustalman 09-18-2021 04:04 AM

Quote:

Originally Posted by John VV (Post 6285029)
you need to create a new bridge

I am on opensuse ( KDE) and not on Debian so as to just how you go about it ?
i do not know .

Hi John. I never had to create a bridge [AFAIR] when I was on Debian 10.

linustalman 09-18-2021 07:31 AM

These steps did get internet working again in virt-man, before. I tried them again and it works again.

Code:

sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils libguestfs-tools genisoimage virtinst libosinfo-bin virt-manager
Code:

sudo adduser $USER libvirt
sudo adduser $USER libvirt-qemu
sudo reboot

I just hope something doesn't again stop the internet working in VM.

linustalman 09-19-2021 12:42 AM

Upon bootup this morn, the internet is again not working in virt-man. :-(

linustalman 09-19-2021 01:05 AM

Some lines from bootup (perhaps useful?):

Sep 18 12:44:52 mypcname NetworkManager[887]: <info> [1631965492.1979] device (lo): carrier: link connected
Sep 18 12:45:10 mypcname kernel: r8169 0000:03:00.0: firmware: failed to load rtl_nic/rtl8168f-1.fw (-2)
Sep 18 12:45:10 mypcname kernel: firmware_class: See https://wiki.debian.org/Firmware for information about missing firmware
Sep 18 12:45:10 mypcname kernel: r8169 0000:03:00.0: Direct firmware load for rtl_nic/rtl8168f-1.fw failed with error -2
Sep 18 12:45:10 mypcname kernel: r8169 0000:03:00.0: Unable to load firmware rtl_nic/rtl8168f-1.fw (-2)
Sep 18 12:45:10 mypcname kernel: RTL8211E Gigabit Ethernet r8169-300:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=r8XYZ-300:00, irq=IGNORE)
Sep 18 12:45:10 mypcname kernel: r8169 0000:03:00.0 enp3s0: Link is Down
Sep 18 12:45:10 mypcname kernel: bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.

linustalman 09-20-2021 01:13 AM

I again ran this but it's tiresome to have to reboot just to get back the internet in virt-man.

Code:

sudo adduser $USER libvirt && sudo reboot

linustalman 09-25-2021 04:49 AM

It's strange. When I run just the part:

Code:

sudo adduser $USER libvirt
it always says

Code:

The user LS is already a member of libvirt.
I don't get why rebooting is even needed. 🤔

What's missing?

Perhaps my upgrade from Debian 10 to 11 caused issues with some config files?

linustalman 09-28-2021 06:18 AM

I solved the virt-man issue by going to synaptic and completely removing all 'qemu' and 'virt-man' packages. Then did a reboot, then went through the virt-man setup from here: https://youtu.be/2SdSiJTGKLM

Update: The issue is back.

linustalman 10-04-2021 08:25 AM

1 Attachment(s)
I can't launch a VM when networking is disabled (right click option on Network Manager system tray icon). I get this message [see image attached]. Perhaps that gives a clue?

If I re-enable networking, then I can launch the VM but must do the reboot trick mentioned earlier to actually get the internet working in the VM.

On Debian 10, I never had to have networking enabled to launch a VM - there were many times when I just wanted to do some brief task in a VM that didn't require the internet.

eashleyfl 10-05-2021 08:44 AM

In virt-manager right click on the QEMU/KVM connection to the server, choose Details->Virtual Networks. There you can set up autostart and apply. Any running VM will see the change in the network without rebooting.

linustalman 10-05-2021 08:47 AM

Quote:

Originally Posted by eashleyfl (Post 6289277)
In virt-manager right click on the QEMU/KVM connection to the server, choose Details->Virtual Networks. There you can set up autostart and apply. Any running VM will see the change in the network without rebooting.

Hi eashleyfl. That was already checked.

mredc 10-08-2021 06:23 PM

I have never had the default network enabled since I started using qemu-kvm. I chose to set the network source on the nic setting in virt-manager (host device eno1 macvtap). Could this be how your was set up? If so, could it be possible that your network adapter changed at some point? Also, I see from one of your post that your logs say that you were having some network setup problem during boot and that you may be missing some firmware. It might help to install or re-install linux-firmware.

linustalman 10-09-2021 01:30 AM

Quote:

Originally Posted by mredc (Post 6290333)
I have never had the default network enabled since I started using qemu-kvm. I chose to set the network source on the nic setting in virt-manager (host device eno1 macvtap). Could this be how your was set up? If so, could it be possible that your network adapter changed at some point? Also, I see from one of your post that your logs say that you were having some network setup problem during boot and that you may be missing some firmware. It might help to install or re-install linux-firmware.

Hi mredc. I reinstalled all packages with a 'firmware-' search in Synaptic:

firmware-linux-free
firmware-realtek
intel-microcode
ipxe-qemu
ovmf

I'll let ye know how it fares. :)

linustalman 10-09-2021 06:32 AM

Alas, reinstalling the firmware did nothing.

linustalman 10-09-2021 09:33 AM

Quote:

Originally Posted by mredc (Post 6290333)
I have never had the default network enabled since I started using qemu-kvm. I chose to set the network source on the nic setting in virt-manager (host device eno1 macvtap). Could this be how your was set up? If so, could it be possible that your network adapter changed at some point? Also, I see from one of your post that your logs say that you were having some network setup problem during boot and that you may be missing some firmware. It might help to install or re-install linux-firmware.

AFAIR, my settings when there was no internet issue in Debian 10 Virt-Man were Network Src: NAT, Device model: e1000. I think those are the default settings.

mredc 10-09-2021 10:20 AM

Open a terminal on your host machine and type: sudo virsh net-list --all

If it tells you that your default network is inactive type: sudo virsh net-start default

To make your default network start at boot type: sudo virsh net-autostart default

For more information about using virsh check out the manual page: man virsh

Hopefully this will help.

linustalman 10-09-2021 12:49 PM

Quote:

Originally Posted by mredc (Post 6290486)
Open a terminal on your host machine and type: sudo virsh net-list --all

If it tells you that your default network is inactive type: sudo virsh net-start default

To make your default network start at boot type: sudo virsh net-autostart default

For more information about using virsh check out the manual page: man virsh

Hopefully this will help.

Code:

$ sudo virsh net-list --all
 Name      State    Autostart  Persistent
--------------------------------------------
 default  active  yes        yes

Code:

$ sudo virsh net-start default
error: Failed to start network default
error: Requested operation is not valid: network is already active

Code:

$ sudo virsh net-autostart default
Network default marked as autostarted


mredc 10-09-2021 04:09 PM

I guess you still don't have it working. Well that was all I had to contribute. I see you attached an image of an error message that you got about the spice server not starting. Maybe if you can figure that out that will get you back on track. There are settings in the graphics section of the vm configuration file. Mine is pretty simple. It is default because I have not made any major changes in the way libvirt works. I don't know if there any global or custom settings elsewhere that would affect the operation of the spice server.

This is all there is in mine.

<graphics type='spice' autoport='yes'>
<listen type='address'/>
<image compression='off'/>
<gl enable='no' rendernode='/dev/dri/by-path/pci-0000:00:02.0-render'/>
</graphics>

You can pull this file up by typing: sudo virsh edit vmname

linustalman 10-10-2021 01:34 AM

Quote:

Originally Posted by mredc (Post 6290570)
I guess you still don't have it working. Well that was all I had to contribute. I see you attached an image of an error message that you got about the spice server not starting. Maybe if you can figure that out that will get you back on track. There are settings in the graphics section of the vm configuration file. Mine is pretty simple. It is default because I have not made any major changes in the way libvirt works. I don't know if there any global or custom settings elsewhere that would affect the operation of the spice server.

This is all there is in mine.

<graphics type='spice' autoport='yes'>
<listen type='address'/>
<image compression='off'/>
<gl enable='no' rendernode='/dev/dri/by-path/pci-0000:00:02.0-render'/>
</graphics>

You can pull this file up by typing: sudo virsh edit vmname

Thanks, I'll look into Spice.

This (sudo adduser $USER libvirt && sudo reboot) still works to temporarily get internet back in Virt-Man. It's all very odd.

linustalman 10-10-2021 02:41 AM

3 Attachment(s)
Quote:

Originally Posted by mredc (Post 6290570)
..

This is all there is in mine.

<graphics type='spice' autoport='yes'>
<listen type='address'/>
<image compression='off'/>
<gl enable='no' rendernode='/dev/dri/by-path/pci-0000:00:02.0-render'/>
</graphics>

You can pull this file up by typing: sudo virsh edit vmname

I got a long list output that looks very different. I tried to save it to a text file but it looks gibberish that way. Please see the 3 attached images.

mredc 10-10-2021 07:56 AM

I have more in mine too. That was just the graphics section of the file. You are right it is odd that adding the user to the libvirt group and rebooting would temporarily restore the internet to the vm. I am just beginning to learn virtualization with qemu-kvm so I haven't encountered enough issues that would lead to any clues to why you are having these problems. I hope that when you do find the solution that you will post it back here just in case I run into something similar later.

linustalman 10-10-2021 08:36 AM

Quote:

Originally Posted by mredc (Post 6290752)
I have more in mine too. That was just the graphics section of the file. You are right it is odd that adding the user to the libvirt group and rebooting would temporarily restore the internet to the vm. I am just beginning to learn virtualization with qemu-kvm so I haven't encountered enough issues that would lead to any clues to why you are having these problems. I hope that when you do find the solution that you will post it back here just in case I run into something similar later.

Thank you, mredc. I appreciate it. :)

linustalman 10-10-2021 11:18 AM

@mredc

After running [sudo adduser $USER libvirt && sudo reboot], I again tried your commands in https://www.linuxquestions.org/quest...ml#post6290486 -- I got the same output even though Virt-Man had internet again [for this session anyway]. :confused:

linustalman 10-16-2021 08:09 AM

It seems like this has finally solved the issue:

Code:

sudo apt install build-essential dkms linux-headers-$(uname -r)
Then rebooted.

mredc 10-16-2021 11:01 AM

That's great. I am guessing that means it was a issue with drivers not loading correctly.

linustalman 10-17-2021 01:23 AM

Quote:

Originally Posted by mredc (Post 6292651)
That's great. I am guessing that means it was a issue with drivers not loading correctly.

Here we go again. It was just a temporary thing. On next reboot, the issue is back. :banghead:

mredc 10-17-2021 09:01 AM

Sad to hear that.

So is your host running Bullseye which was a distribution upgrade from Buster?

Do you have multiple virtual machines exhibiting the same problem?

Virtual machine adapter(s) up (turned on) when networking is failed?

linustalman 10-17-2021 09:09 AM

Quote:

Originally Posted by mredc (Post 6292932)
Sad to hear that.

So is your host running Bullseye which was a distribution upgrade from Buster?

Do you have multiple virtual machines exhibiting the same problem?

Virtual machine adapter(s) up (turned on) when networking is failed?

Thanks, mredc. Yes, I upgraded from Buster to Bullseye. All VMs in virt-man have the issue. I a VM in AQEMU that is has no issue. Whenever I disable my networking, for when I'm doing a lot of offline stuff - I cannot launch virt-man VMs -- I could do that in Buster.

mredc 10-17-2021 09:33 AM

So are you saying that if you don't turn your networking off on your host that your virtual machines in virt-manager do start as expected?

linustalman 10-17-2021 09:38 AM

Quote:

Originally Posted by mredc (Post 6292938)
So are you saying that if you don't turn your networking off on your host that your virtual machines in virt-manager do start as expected?

They will start with my host internet on but they won't have internet access unless I run
Code:

sudo adduser $USER libvirt && sudo reboot
I have 'nmcli networking off' mapped to an alias that I run whenever I want to do a lot of things that don't require me being connected to the Internet.

mredc 10-17-2021 10:05 AM

To be honest and this is just me thinking out loud. You should only have to run that adduser command once unless it pertains to a different user each time.

But are you saying that you turn on your host internet, run those two commands to add a user to the libvirt group and reboot your host? This then allows you to start your virtual machines which obtain and maintain a persistent network connection?

linustalman 10-17-2021 11:08 AM

Quote:

Originally Posted by mredc (Post 6292951)
To be honest and this is just me thinking out loud. You should only have to run that adduser command once unless it pertains to a different user each time.

But are you saying that you turn on your host internet, run those two commands to add a user to the libvirt group and reboot your host? This then allows you to start your virtual machines which obtain and maintain a persistent network connection?

It doesn't matter if my networking is enabled or not when I run those commands. After running them, rebooting, enabling my host networking/internet connection, then I can access Internet on the virt-man VM's for that session. If I shutdown or reboot as normal, the Internet is again gone for the virt-man VMs. It's a mystery.

linustalman 11-07-2021 08:06 AM

I just tried 'sudo adduser $USER libvirt && sudo reboot' and now that doesn't even get the internet working inside virt-man.

linustalman 11-08-2021 01:34 AM

I tried that command again. This time I had the virt-man program opened (no vm open). Maybe virt-man needs to be launched and then running that temporary fix command for it to work. 💡

Update: I can confirm this. I did the temp fix command again and forgot to open Virt Man first, the same thing happened.

linustalman 12-09-2021 10:07 AM

I've since installed Debian 11 on a new PC and new drive. At first all seemed fine -- now the issue back. Argh!

linustalman 12-09-2021 11:18 AM

The usual temporary fix applies like before.

This must narrow down the cause. My old PC had an Intel CPU, this current PC has an AMD CPU.

linustalman 12-09-2021 01:19 PM

I never have this issue with AQEMU or GNOME Boxes - only virt-man. I wonder if there's an old config folder in my hold directory that's causing the issue? Or perhaps something to do with my wireless USB dongle?

linustalman 12-11-2021 02:21 AM

This isn't too bad now since I recently moved from a HDD to SSD - the bootups are very quick.

I'd still love to know what could be causing this.

linustalman 01-09-2022 07:24 AM

I ran this:

Code:

sudo systemctl status libvirtd.service
I noticed this in one of the output lines:
Code:

no servers found in /etc/resolv.conf, will retry

Fearless Fred 01-22-2022 07:41 PM

You need to install iptables for it to work without having to manually keep setting it each time, its a dependency, and from reading your posts, you haven't actually added this;

sudo apt-get install iptables

I had this issue myself with KVM and scratched my head for while ;)


More information on virtual networking here;

https://wiki.libvirt.org/page/VirtualNetworking

linustalman 01-23-2022 01:26 AM

Quote:

Originally Posted by Fearless Fred (Post 6321064)
You need to install iptables for it to work without having to manually keep setting it each time, its a dependency, and from reading your posts, you haven't actually added this;

sudo apt-get install iptables

I had this issue myself with KVM and scratched my head for while ;)


More information on virtual networking here;

https://wiki.libvirt.org/page/VirtualNetworking

I was hoping that would fix it. I went to install iptables and saw that it was already installed. :(

Fearless Fred 01-26-2022 06:08 AM

no servers found in /etc/resolv.conf, will retry


I use libvirt and in that file is just the nameservers IP, i.e. my router IPv4 and IPv6 and the 'domain'..(only router IP listed below of course)


# Generated by NetworkManager
nameserver 192.168.1.1


Do you use virt-manager or the CLI to admin your VM's?
virt-manager does give helpful error messages..

linustalman 01-26-2022 06:34 AM

Quote:

Originally Posted by Fearless Fred (Post 6322192)
no servers found in /etc/resolv.conf, will retry


I use libvirt and in that file is just the nameservers IP, i.e. my router IPv4 and IPv6 and the 'domain'..(only router IP listed below of course)


# Generated by NetworkManager
nameserver 192.168.1.1


Do you use virt-manager or the CLI to admin your VM's?
virt-manager does give helpful error messages..

Hi Fred.

In /etc/resolv.conf, I have:

Code:

# Generated by NetworkManager
search fritz.box
nameserver 192.168.178.1

I always launch just:

Code:

virt-manager

Fearless Fred 01-26-2022 05:37 PM

Taken from the KVM docs here...

https://wiki.debian.org/KVM#Libvirt_default_network



If you use libvirt to manage your VMs, libvirt provides a NATed bridged network named "default" that allows the host to communicate with the guests. This network is available only for the system domains (that is VMs created by root or using the qemu:///system connection URI). VMs using this network end up in 192.168.122.1/24 and DHCP is provided to them via dnsmasq. This network is not automatically started. To start it use:

virsh --connect=qemu:///system net-start default

To make the default network start automatically use:

virsh --connect=qemu:///system net-autostart default

linustalman 01-27-2022 11:30 AM

Hi Fred.

Code:

virsh --connect=qemu:///system net-start default
Code:

error: Failed to start network default
error: Requested operation is not valid: network is already active

Code:

virsh --connect=qemu:///system net-autostart default
Code:

Network default marked as autostarted

Fearless Fred 01-27-2022 08:54 PM

I would probably remove virt-manager, reboot, and then try installing it again, it sounds like something is amiss with it.. and at least then you know it should be 'default'

linustalman 01-28-2022 08:49 AM

Quote:

Originally Posted by Fearless Fred (Post 6322697)
I would probably remove virt-manager, reboot, and then try installing it again, it sounds like something is amiss with it.. and at least then you know it should be 'default'

I did that. So far so good, this seems to be the solution.

linustalman 01-29-2022 01:22 AM

After starting the PC this morn, I tried virt-man again. The issue is back. :banghead:


All times are GMT -5. The time now is 01:48 PM.