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

[R4.0 RC2] qvm-backup-restore or qvm-backup error #3211

Closed
na-- opened this Issue Oct 25, 2017 · 22 comments

Comments

@na--

na-- commented Oct 25, 2017

Qubes OS version:

R4.0 RC2

Affected TemplateVMs:

none (dom0 issue)


Steps to reproduce the behavior:

Create a backup with qvm-backup --compress /some/file some-vm and then try to restore from it via qvm-backup-restore /some/file

Expected behavior:

Successful restore of the backed up VM.

Actual behavior:

The following error is displayed:

$ qvm-backup-restore -v /backup/test1 
Please enter the passphrase to verify and (if encrypted) decrypt the backup: 
2017-10-25 23:20:08,831 [MainProcess qvm_backup_restore.main:215] app: Checking backup content...
2017-10-25 23:20:08,833 [MainProcess restore._start_retrieval_process:882] qubesadmin.backup: Run command['tar', '-ixv', '--occurrence=1', '-C', '/var/tmp/restorecvmwuhc8', 'backup-header', 'backup-header.hmac']
2017-10-25 23:20:08,855 [MainProcess restore._retrieve_backup_header:1132] qubesadmin.backup: Got backup header and hmac: backup-header, backup-header.hmac
2017-10-25 23:20:08,856 [MainProcess restore._verify_hmac:945] qubesadmin.backup: Verifying file backup-header
2017-10-25 23:20:13,437 [MainProcess restore._start_retrieval_process:882] qubesadmin.backup: Run command['tar', '-ixv', '--occurrence=1', '-C', '/var/tmp/restorecvmwuhc8', 'qubes.xml.000.enc']
2017-10-25 23:20:16,934 [MainProcess restore._start_inner_extraction_worker:1181] qubesadmin.backup: Starting extraction worker in /var/tmp/restorecvmwuhc8, file handlers map: {'qubes.xml': (functools.partial(<function BackupRestore._save_qubes_xml at 0x7d5095af2598>, '/var/tmp/restorecvmwuhc8/qubes-restored.xml'), None)}
2017-10-25 23:20:16,942 [ExtractWorker3-1 restore.__run__:532] qubesadmin.backup.extract: Started sending thread
2017-10-25 23:20:16,942 [ExtractWorker3-1 restore.__run__:533] qubesadmin.backup.extract: Moving to dir /var/tmp/restorecvmwuhc8
2017-10-25 23:20:16,943 [ExtractWorker3-1 restore.__run__:545] qubesadmin.backup.extract: Extracting file qubes.xml.000
2017-10-25 23:20:16,943 [ExtractWorker3-1 restore.__run__:589] qubesadmin.backup.extract: Running command ['tar', '-xvvO', '--use-compress-program=gzip', 'qubes.xml']
2017-10-25 23:20:16,960 [ExtractWorker3-1 restore.__run__:670] qubesadmin.backup.extract: Removing file qubes.xml.000
2017-10-25 23:20:16,964 [ExtractWorker3-1 restore.collect_tar_output:357] qubesadmin.backup.extract: tar2_stderr: 
2017-10-25 23:20:16,964 [ExtractWorker3-1 restore.__run__:682] qubesadmin.backup.extract: Finished extracting thread
Traceback (most recent call last):
  File "/usr/bin/qvm-backup-restore", line 9, in <module>
    load_entry_point('qubesadmin==4.0.9', 'console_scripts', 'qvm-backup-restore')()
  File "/usr/lib/python3.5/site-packages/qubesadmin/tools/qvm_backup_restore.py", line 219, in main
    appvm, passphrase)
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/restore.py", line 838, in __init__
    self.backup_app = self._process_qubes_xml()
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/restore.py", line 1237, in _process_qubes_xml
    backup_app = Core3Qubes(qubes_xml_path)
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/core3.py", line 60, in __init__
    super(Core3Qubes, self).__init__(store)
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/__init__.py", line 33, in __init__
    self.load()
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/core3.py", line 159, in load
    self.import_core3_vm(element)
  File "/usr/lib/python3.5/site-packages/qubesadmin/backup/core3.py", line 134, in import_core3_vm
    vm.label = self.labels[vm.properties.pop('label')]
KeyError: 'red'


General notes:

I'm not even sure why the KeyError is red, since the backup contained only a single VM - the default debian-8 template that has a black label...


Related issues:

None that I could find

@na-- na-- changed the title from qvm-backup-restore error to [R4.0 RC2] qvm-backup-restore or qvm-backup error Oct 25, 2017

@andrewdavidwong andrewdavidwong added this to the Release 4.0 milestone Oct 26, 2017

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Oct 27, 2017

Member

Please see @jwoytek's remarks on #3219.

Member

andrewdavidwong commented Oct 27, 2017

Please see @jwoytek's remarks on #3219.

@na--

This comment has been minimized.

Show comment
Hide comment
@na--

na-- Oct 27, 2017

Thanks! I'll test the proposed fix later to see if it works. In my case it was Qubes 4.0 RC2 backups failing to be restored in the same RC2 machine, but it looks like the same issue and error.

Earlier today I had only very minor problems restring 3.2 backups in 4.0 RC2 - application shortcuts needed to be refreshed and virt_mode defaults to pv, but the restored VMs work perfectly. My current issue is that it's very hard to know how much free space I have left in 4.0, but that's a separate issue 😺

na-- commented Oct 27, 2017

Thanks! I'll test the proposed fix later to see if it works. In my case it was Qubes 4.0 RC2 backups failing to be restored in the same RC2 machine, but it looks like the same issue and error.

Earlier today I had only very minor problems restring 3.2 backups in 4.0 RC2 - application shortcuts needed to be refreshed and virt_mode defaults to pv, but the restored VMs work perfectly. My current issue is that it's very hard to know how much free space I have left in 4.0, but that's a separate issue 😺

@jwoytek

This comment has been minimized.

Show comment
Hide comment
@jwoytek

jwoytek Oct 27, 2017

jwoytek commented Oct 27, 2017

@marmarek marmarek self-assigned this Oct 29, 2017

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Nov 1, 2017

I encountered this error when trying --verify-only on a new backup, and unsuccessfully tried @jwoytek workaround like this:
"At line 134 in file /usr/lib/python3.5/site-packages/qubesadmin/backup/core3.py:"

vm.label = vm.properties.pop('label')
try:
    vm.label = self.labels[vm.label]
except KeyError:
    pass

This yields the same error. I then tried commenting-out the first "vm.label =" line and got:
File "/usr/lib64/python3.5/posixpath.py", line 139, in basename
i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'


I successfully restored an R3.2 backup a few days ago, but currently I have to assume R4 qvm-backup is broken and that the new archive file is bad, so I am looking for a simple alternative.

tasket commented Nov 1, 2017

I encountered this error when trying --verify-only on a new backup, and unsuccessfully tried @jwoytek workaround like this:
"At line 134 in file /usr/lib/python3.5/site-packages/qubesadmin/backup/core3.py:"

vm.label = vm.properties.pop('label')
try:
    vm.label = self.labels[vm.label]
except KeyError:
    pass

This yields the same error. I then tried commenting-out the first "vm.label =" line and got:
File "/usr/lib64/python3.5/posixpath.py", line 139, in basename
i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'


I successfully restored an R3.2 backup a few days ago, but currently I have to assume R4 qvm-backup is broken and that the new archive file is bad, so I am looking for a simple alternative.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 1, 2017

Member

The backup archive produced by R4 qvm-backup is ok. The restore code is broken. I'm working on this right now.

Member

marmarek commented Nov 1, 2017

The backup archive produced by R4 qvm-backup is ok. The restore code is broken. I'm working on this right now.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 1, 2017

Member

See the commit I've just pushed (automatically linked above).

Member

marmarek commented Nov 1, 2017

See the commit I've just pushed (automatically linked above).

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Nov 1, 2017

@marmarek Maybe there is a different issue related to file paths, as I'm still getting the AttributeError shown above (KeyError is gone).

tasket commented Nov 1, 2017

@marmarek Maybe there is a different issue related to file paths, as I'm still getting the AttributeError shown above (KeyError is gone).

@opposablebrain

This comment has been minimized.

Show comment
Hide comment
@opposablebrain

opposablebrain Nov 10, 2017

@marmarek I also see the @tasket attribute error when posixpath gets called with a NoneType path argument, which is contained somewhere in my 4.0rc2 backup set. A try/except{return ""} works, at least as a band-aid.

opposablebrain commented Nov 10, 2017

@marmarek I also see the @tasket attribute error when posixpath gets called with a NoneType path argument, which is contained somewhere in my 4.0rc2 backup set. A try/except{return ""} works, at least as a band-aid.

@marmarek marmarek reopened this Nov 10, 2017

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.10-1+deb8u1 has been pushed to the r4.0 testing repository for the Debian jessie template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing jessie-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.10-1+deb8u1 has been pushed to the r4.0 testing repository for the Debian jessie template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing jessie-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot qubesos-bot referenced this issue in QubesOS/updates-status Nov 14, 2017

Closed

core-admin-client v4.0.10 (r4.0) #294

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.10-1+deb9u1 has been pushed to the r4.0 testing repository for the Debian stretch template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing stretch-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.10-1+deb9u1 has been pushed to the r4.0 testing repository for the Debian stretch template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing stretch-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc24 has been pushed to the r4.0 testing repository for the Fedora fc24 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc24 has been pushed to the r4.0 testing repository for the Fedora fc24 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc25 has been pushed to the r4.0 testing repository for the Fedora fc25 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc25 has been pushed to the r4.0 testing repository for the Fedora fc25 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc26 has been pushed to the r4.0 testing repository for the Fedora fc26 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc26 has been pushed to the r4.0 testing repository for the Fedora fc26 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Nov 14, 2017

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc25 has been pushed to the r4.0 testing repository for dom0.
To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.10-0.1.fc25 has been pushed to the r4.0 testing repository for dom0.
To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Dec 11, 2017

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.11-1+deb8u1 has been pushed to the r4.0 stable repository for the Debian jessie template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.11-1+deb8u1 has been pushed to the r4.0 stable repository for the Debian jessie template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Dec 11, 2017

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.11-1+deb9u1 has been pushed to the r4.0 stable repository for the Debian stretch template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-admin-client_4.0.11-1+deb9u1 has been pushed to the r4.0 stable repository for the Debian stretch template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Dec 11, 2017

Automated announcement from builder-github

The package python2-qubesadmin-4.0.11-0.1.fc25 has been pushed to the r4.0 stable repository for dom0.
To install this update, please use the standard update command:

sudo qubes-dom0-update

Or update dom0 via Qubes Manager.

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.11-0.1.fc25 has been pushed to the r4.0 stable repository for dom0.
To install this update, please use the standard update command:

sudo qubes-dom0-update

Or update dom0 via Qubes Manager.

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 5, 2018

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc24 has been pushed to the r4.0 stable repository for the Fedora fc24 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc24 has been pushed to the r4.0 stable repository for the Fedora fc24 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 5, 2018

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc25 has been pushed to the r4.0 stable repository for the Fedora fc25 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc25 has been pushed to the r4.0 stable repository for the Fedora fc25 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 5, 2018

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc26 has been pushed to the r4.0 stable repository for the Fedora fc26 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Automated announcement from builder-github

The package python2-qubesadmin-4.0.12-0.1.fc26 has been pushed to the r4.0 stable repository for the Fedora fc26 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Feb 27, 2018

Member

Does it still apply?

Member

marmarek commented Feb 27, 2018

Does it still apply?

@na--

This comment has been minimized.

Show comment
Hide comment
@na--

na-- Feb 27, 2018

Your original commit fixed the issue for me and, if memory serves, I've restored backups after that with no problems. So I'm closing this and if @opposablebrain or someone else still has problems, creating a new issue would probably be better.

na-- commented Feb 27, 2018

Your original commit fixed the issue for me and, if memory serves, I've restored backups after that with no problems. So I'm closing this and if @opposablebrain or someone else still has problems, creating a new issue would probably be better.

@na-- na-- closed this Feb 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment