0

Using the package manager (pacman) inside the virtual machine gives me corrupted packages randomly, as in:

error: <package>: signature from "<whomever>" is invalid
:: File /mnt/var/cache/pacman/pkg/<package>.pkg.tar.xz is corrupted (invalid or corrupted packgage (PGP signature))

I have the following setup:

  • Arch Linux host (kernel 5.3.11.1)
  • Which is then using UFW firewall (0.36)
  • Which is then configured to only allow connections through the tun0 which is a network interface created by OpenVPN (2.4.8).

The network connection works properly in every respect on the host for at least half a decade now. I try to setup a guest, which is also an Arch Linux using QEMU (4.1.0) with the following options:

qemu-system-x86_64 \
    -name 'Arch Linux' \
    -display vnc=:0 \
    -m size=8G \
    -enable-kvm \
    -cpu host \
    -smp cores=2,threads=2 \
    -k en-us \
    -boot order=d \
    -cdrom "<iso>" \
    -drive "if=pflash,format=raw,readonly,file=<file>" \
    -drive "if=pflash,format=raw,file=<file>" \
    -drive "if=virtio,format=qcow2,file=<file>"

My understanding is that it uses the -nic user by default if I don't specify anything extra for it and the guest indeed does have internet connection.

I tried reinstalling the entire thing a million times, on different physical locations (on SSD, on HDD) hoping that the virtual hard disk causes the problem -- but of course it did not fix anything. For the sake of completeness the virtual drive is created as follows:

qemu-img create -f qcow2 "<file>" 16G

Sometimes when I try enough times and I get lucky and I end up having a working installation with a working docker installation inside the guest, docker gives me the same random errors about corrupted data while downloading the containers -- which makes me believe that it is a network configuration related error. I tried using libvirt (virsh and virt-manager) on top of QEMU hoping that it's only me who configured something wrong but I faced with the same problem again.

There was a point where my setup was using something like the following as the network configuration:

# ...
-net "user,hostfwd=tcp::2222-:22,hostfwd=tcp::8000-:8000,hostfwd=tcp::4200-:4200,hostfwd=tcp::9222-:9222,smb=<path>" \
-net nic,model=virtio \
# ...

But that's not working anymore either. At this point I'm pretty much puzzled on what I'm doing wrong...

  • 1
    in addition to unix.stackexchange.com/a/554351/6622 — if you're not looking for a reason, but a fix rather, I'd suggest trying "raw" disk image, not qcow2. But anyways, Btrfs is effective corruption detector. – poige Nov 28 '19 at 4:46
0

Meanwhile I can't tell you exactly what is causing the issue, I can give you a few troubleshooting ideas-suggestions:

If you suspect there's an issue with Network, you can look into /proc/net/snmp. It's kinda messy in original that's why I'd suggest </proc/net/snmp column -t | less -S. Look at columns with name containing CsumErrors.

If you suspect that corruption happens at disk level (which is what I suspect), put Btrfs into use there which would allow you to find it out for sure since it's the only light-weight common purpose FS for Linux which uses checksums heavily.

— I've seen some troubles with Qcow2 when guest-VMs used fstrim, noticed it with Btrfs in particular. ;-)

  • I tried raw on 3 separate hard drives (1 SSD, 2 HDD) it did not solve my problem. CsumErrors are 0 everywhere. I have not tried the Btrfs, because these drives all have data on them and I cannot just repartition the entire thing. – Peter Varo Dec 2 '19 at 20:51
  • (Other than this, I truly appreciate your time and both your answer and comment.) – Peter Varo Dec 2 '19 at 20:51
  • Not sure if I got it correctly: you can't add an additional disk to a VM (that would be a file on host system)? But why? It could be some small image, just to hold pacman's library inside a VM, and yeah, you could format it Btrfs inside the VM. – poige Dec 3 '19 at 3:19
  • BTW, did you run memtest? If some strange corruptions occur it might be due bad RAM too. – poige Dec 3 '19 at 3:22
-1

Are you using a KVM virtual machine manager to launch the VM .. if yes you can go to device profile in the GUI and check and change nic to say virtio.. delete other nic entries if any

  • If you would actually read the question you would know that 1. there's no manager involved, 2. when there was it didn't make any difference, 3. no GUI tools involved, 4. nic, net, netdev with or without virtio have already been tried without any success. – Peter Varo Nov 25 '19 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.