abbbi / virtnbdbackup

Backup utility for Libvirt / qemu / kvm supporting incremental and differential backups + instant recovery (agentless).
http://libvirtbackup.grinser.de/
GNU General Public License v3.0
330 stars 46 forks source link

domain not found, but shows in virsh list #155

Closed bayeslearner closed 9 months ago

bayeslearner commented 9 months ago

Version used Provide output of virtnbdbackup -V 1.9.54

Describe the bug A clear and concise description of what the bug is.

 virsh list
 Id   Name            State
-------------------------------
 22   win11_default   running

Expected behavior A clear and concise description of what you expected to happen.

virtnbdbackup -d win11_default -o ~/backup
[2024-01-05 23:53:00] INFO lib common - printVersion [main]:  Version: 1.9.54 Arguments: /usr/bin/virtnbdbackup -d win11_default -o /home/kundeng/backup
[2024-01-05 23:53:00] INFO root virtnbdbackup - main [main]:  Backup level: [copy]
[2024-01-05 23:53:00] ERROR root virtnbdbackup - main [main]:  Domain not found: no domain with matching name 'win11_default'

Hypervisor information:

Logfiles: Please attach generated logfiles relevant to the reported issue.

Workaround: Share possible workarounds, if any.

bayeslearner commented 9 months ago

I switched to root, different errors appeared:

kundeng@bayes-pop:~$ virtnbdbackup
usage: virtnbdbackup [-h] -d DOMAIN [-l {copy,full,inc,diff,auto}] [-t {stream,raw}] [-
                     [-f SOCKETFILE] [-n] [-z [COMPRESS]] [-w WORKER] [-F FREEZE_MOUNTP
                     [--password PASSWORD] [-P NBD_PORT] [-I NBD_IP] [--tls] [--tls-cer
virtnbdbackup: error: the following arguments are required: -d/--domain, -o/--output
kundeng@bayes-pop:~$ tmux a
[2024-01-05 23:55:07] INFO root virtnbdbackup - main [main]:  Libvirt library version: [8000000]
[2024-01-05 23:55:07] INFO root virtnbdbackup - main [main]:  Backup will save [1] attached disks.
[2024-01-05 23:55:07] INFO root virtnbdbackup - main [main]:  Concurrent backup processes: [1]
[2024-01-05 23:55:07] INFO root checkpoint - create [main]:  Loading checkpoints from: [/backup/win11_default.cpt]
[2024-01-05 23:55:07] INFO root checkpoint - redefine [main]:  Loading checkpoint list from: [/backup/checkpoints]
[2024-01-05 23:55:07] INFO root checkpoint - create [main]:  Checkpoint handling.
[2024-01-05 23:55:07] INFO root virtnbdbackup - main [main]:  Local NBD Endpoint socket: [/var/tmp/virtnbdbackup.1123357]
[2024-01-05 23:55:07] INFO root virtnbdbackup - main [main]:  Temporary scratch file target directory: [/var/tmp]
[2024-01-05 23:55:07] INFO root job - start [main]:  Starting backup job.
[2024-01-05 23:55:08] INFO fs fs - freeze [main]:  Freezed [2] filesystems.
[2024-01-05 23:55:08] INFO fs fs - thaw [main]:  Thawed [2] filesystems.
[2024-01-05 23:55:08] ERROR root job - start [main]:  Failed to start backup: [internal error: unable to execute QEMU command 'nbd-server-start': Failed to bind socket to /var/tmp/virtnbdbackup.1123357: Permission denied]
root@bayes-pop:~# virtnbdbackup -d win11_default -o /backup -p
[2024-01-05 23:55:32] INFO lib common - printVersion [main]:  Version: 1.9.54 Arguments: /usr/bin/virtnbdbackup -d win11_default -o /backup -p
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Backup level: [copy]
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Libvirt library version: [8000000]
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Backup will save [1] attached disks.
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Concurrent backup processes: [1]
[2024-01-05 23:55:32] INFO root checkpoint - create [main]:  Loading checkpoints from: [/backup/win11_default.cpt]
[2024-01-05 23:55:32] INFO root checkpoint - redefine [main]:  Loading checkpoint list from: [/backup/checkpoints]
[2024-01-05 23:55:32] INFO root checkpoint - create [main]:  Checkpoint handling.
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Local NBD Endpoint socket: [/var/tmp/virtnbdbackup.1123369]
[2024-01-05 23:55:32] INFO root virtnbdbackup - main [main]:  Temporary scratch file target directory: [/var/tmp]
[2024-01-05 23:55:32] INFO root job - start [main]:  Starting backup job.
[2024-01-05 23:55:33] INFO fs fs - freeze [main]:  Freezed [2] filesystems.
[2024-01-05 23:55:33] INFO fs fs - thaw [main]:  Thawed [2] filesystems.
[2024-01-05 23:55:33] ERROR root job - start [main]:  Failed to start backup: [internal error: unable to execute QEMU command 'nbd-server-start': Failed to bind socket to /var/tmp/virtnbdbackup.1123369: Permission denied]
bayeslearner commented 9 months ago

The VM is created with vagrant under a non-root user. After disabling Apparmor, I'm able to backup as root. I still can't backup as non-root. Should I backup as root or as the regular user? Will this be an issue when I try to restore.

abbbi commented 9 months ago

If vm is Defined in root user namespace only root System User can backup and see it

i think Vagant elevates to root via sudo if executed as regular User.