New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote Backup Fails if both backup and remote system have the same hostname #117
Comments
it asks for a password here, did you enter this password? It seems it is unable to connect to the remote via ssh and For remote backup to work, you must setup ssh-agent or passwordless ssh key to remote system and ssh user you are attempting to use. |
sure! It got my image path correctly: |
is DNS resolution working for the IP specified in the Qemu URI? it seems its not entering the code passage to execute remote backup at all, because it determines if remote backup is https://github.com/abbbi/virtnbdbackup/blob/master/libvirtnbdbackup/virt/client.py#L149 the informational logging its attempting to connect a remote host is missing entirely in your output. |
ubuntu@ubuntu:~$ virtnbdbackup -U qemu+ssh://root@192.168.207.167/system --ssh-user root -d kvm_test -l full -o /tmp/backup -v |
this is really really strange, i cant reproduce this on my systems.
is entirely missing in your logging so it does not attempt to use an remote NBD connection at all. it seems the check if the hostnames differ doesnt work in some way and as such the remotehost variable |
virtnbdbackup is using the hostname from libvirt.getHostname() call after beeing connected to the remote system. What i guess what happens is that gethostname() on the system you are executing virtnbdbackup on and the libvirt daemon on the remote host might return "localhost" or some other default value because of DNS not beeing setup correctly. As a result, even if its connected to a remote system, attempts to use the local unix socket for data transport and fails. |
what does following python script return executed on the system you start virtnbdbackup on?
|
I figured it out because the two machines have the same hostname!I modified the hostname of a machine, and the another issue arises.
I added the ssh private key and was able to log in. But it is reported that I failed to log in? |
Theres two seperate ssh connections, the first one is the one used by the libvirt api (using qemu+ssh) and the second I dont see any obvious from the paramiko logs, so you may have to check sshd logfiles on the remote system to get more grasp why it denys the public key login. Is the key used in question the right one? From the log:
maybe check for differences between "ssh -vvv root@ubuntu" and the paramiko session (different algos used? unsupported ssh settings such as disabled algorithms paramiko is attempting?) |
Yes! I can connect ssh successful!But it seems occur another issue.
I use
|
yes, thats probably due to hostname "ubuntu" resolving to 127.0.0.1. So libvirt starts the backup endpoint on 127.0.0.1 instead of the public ip. the libvirt backup job shows:
Either specify --nbd-ip via command line to make virtnbdbackup start backup port on another IP (the public one) or fix DNS so hostname "ubuntu" resolves to the public IP of the system, not 127.0.0.1
|
enhanced README regards remote backup. Guess this issue can be closed, its not really a "bug" |
Yes! I added the |
thanks for the update, consider hitting the sponsor button,thanks |
Version used
1.9.26
Describe the bug
root@ubuntu:/tmp# virtnbdbackup -U qemu+ssh://root@192.168.207.167/system --ssh-user root -d kvm_test -l full -o /tmp/back/
[2023-06-28 03:58:57] INFO lib common - printVersion [MainThread]: Version: 1.9.26 Arguments: /usr/local/bin/virtnbdbackup -U qemu+ssh://root@192.168.207.167/system --ssh-user root -d kvm_test -l full -o /tmp/back/
[2023-06-28 03:58:57] INFO root virtnbdbackup - main [MainThread]: Backup level: [full]
root@192.168.207.167's password:
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Libvirt library version: [8000000]
[2023-06-28 03:58:58] INFO root disktype - Optical [MainThread]: Skipping attached [cdrom] device: [sda].
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Backup will save [1] attached disks.
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Concurrent backup processes: [1]
[2023-06-28 03:58:58] INFO root checkpoint - redefine [MainThread]: Loading checkpoint list from: [/tmp/back//checkpoints]
[2023-06-28 03:58:58] INFO root checkpoint - create [MainThread]: Checkpoint handling.
[2023-06-28 03:58:58] INFO root checkpoint - create [MainThread]: Using checkpoint name: [virtnbdbackup.0].
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Local NBD Endpoint socket: [/var/tmp/virtnbdbackup.3327]
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Temporary scratch file target directory: [/var/tmp]
[2023-06-28 03:58:58] INFO root virtnbdbackup - startBackupJob [MainThread]: Starting backup job.
[2023-06-28 03:58:58] WARNING fs fs - freeze [MainThread]: Guest agent is not responding: QEMU guest agent is not connected
[2023-06-28 03:58:58] INFO root virtnbdbackup - main [MainThread]: Started backup job with checkpoint, saving information.
[2023-06-28 03:58:58] INFO root checkpoint - backup [MainThread]: Saving checkpoint config to: [/tmp/back//checkpoints/virtnbdbackup.0.xml]
[2023-06-28 03:58:58] INFO nbd client - printVersion [vda]: libnbd version: 1.10.5
[2023-06-28 03:58:58] INFO nbd client - connect [vda]: Waiting until NBD server at [nbd+unix:///vda?socket=/var/tmp/virtnbdbackup.3327] is up.
[2023-06-28 03:58:59] INFO nbd client - connect [vda]: Waiting for NBD Server, Retry: 0
[2023-06-28 03:58:59] ERROR root virtnbdbackup - main [MainThread]: Disk backup failed: [NBD endpoint: [Unix(exportName='vda', metaContext='', backupSocket='/var/tmp/virtnbdbackup.3327', tls=False)]: connection failed: [Unable to connect nbd server: nbd_connect_uri: connect: No such file or directory (ENOENT)]]
[2023-06-28 03:58:59] INFO root virtnbdbackup - main [MainThread]: Backup jobs finished, stopping backup task.
[2023-06-28 03:58:59] INFO root metadata - backupConfig [MainThread]: Saving VM config to: [/tmp/back//vmconfig.virtnbdbackup.0.xml]
[2023-06-28 03:58:59] ERROR libvirtnbdbackup.qemu.command command - run [MainThread]: CMD: qemu-img info /root/kvm/image/ubuntu.qcow2 --output json --force-share
[2023-06-28 03:58:59] WARNING root metadata - backupDiskInfo [MainThread]: Failed to read qcow image info: [Unable to start [qemu-img] error: [qemu-img: Could not open '/root/kvm/image/ubuntu.qcow2': Could not open '/root/kvm/image/ubuntu.qcow2': No such file or directory]]
[2023-06-28 03:58:59] ERROR root virtnbdbackup - main [MainThread]: Error during backup
Expected behavior
A clear and concise description of what you expected to happen.
Hypervisor information:
Is there something wrong with the way I use it?
The text was updated successfully, but these errors were encountered: