Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upqubes-dom0-update template reinstallation option #2061
Comments
added a commit
to adrelanos/qubes-core-admin-linux-1
that referenced
this issue
Jun 12, 2016
adrelanos
referenced this issue
in marmarek/qubes-core-admin-linux
Jun 12, 2016
Closed
made variables configureable through environment #2
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adrelanos
Jun 12, 2016
Member
marmarek/qubes-core-admin-linux#2 would allow TEMPLATE_EXCLUDE_OPTS=--tolerant qubes-dom0-update qubes-template-whonix-gw. (--tolerant just as dummy option to fill the variable.) Not pretty, not great.
|
marmarek/qubes-core-admin-linux#2 would allow |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adrelanos
Jun 12, 2016
Member
Lets's forget about marmarek/qubes-core-admin-linux#2 and pretend it never happened. ;)
|
Lets's forget about marmarek/qubes-core-admin-linux#2 and pretend it never happened. ;) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 12, 2016
Member
Generally this is just another problem with packaging templates as RPMs. Package manager want to have newest available version, but updating template at template package level will rollback all the changes / updates installed already there. This is why templates are excluded.
But as you've pointed out, there are cases when it would be useful to update/reinstall template package.
We need some better way of shipping templates... Or a consistent workflow how to handle RPM templates.
|
Generally this is just another problem with packaging templates as RPMs. Package manager want to have newest available version, but updating template at template package level will rollback all the changes / updates installed already there. This is why templates are excluded. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
adrelanos
Jun 12, 2016
Member
To solve that, I propose qubes-template-manager (QTM) cli tool #2064.
And to solve this very ticket, I suggest adding a --no-exclude option to qubes-dom0-update.
|
To solve that, I propose And to solve this very ticket, I suggest adding a |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Maybe better |
andrewdavidwong
added
enhancement
help wanted
C: core
C: templates
P: major
labels
Jun 12, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 12, 2016
I've already tested the basic reinstall mechanics on a fedora minimal template I altered so it was unbootable. I simply removed the exclusion from qubes-dom0-update. It seems to do its job: no funky problems with files or menu entries.
For implementation, my preference would be to check for the appropriate parameter (--action=reinstall or whatever) in qubes-dom0-update before adding qubes-template-* to the exclusion string.
The other check I would perform is to make sure no running vms are based on that template.
As for the actual option name, I'd prefer to use --action=reinstall if this use case were common and repetitive. In that case it would be better to strive for more elegant expressions. However, for something like this that is a bit rare and impacts possibly many vms, going for explicitness and requiring --no-template-exclude in tandem with --action=reinstall may be best.
But adding the explicit option means you will have to handle the condition(s) that the user specifies it without --action=reinstall, or no template package name, etc.. It means creating conditions we may not catch.
tasket
commented
Jun 12, 2016
|
I've already tested the basic reinstall mechanics on a fedora minimal template I altered so it was unbootable. I simply removed the exclusion from qubes-dom0-update. It seems to do its job: no funky problems with files or menu entries. For implementation, my preference would be to check for the appropriate parameter (--action=reinstall or whatever) in qubes-dom0-update before adding qubes-template-* to the exclusion string. The other check I would perform is to make sure no running vms are based on that template. As for the actual option name, I'd prefer to use --action=reinstall if this use case were common and repetitive. In that case it would be better to strive for more elegant expressions. However, for something like this that is a bit rare and impacts possibly many vms, going for explicitness and requiring --no-template-exclude in tandem with --action=reinstall may be best. But adding the explicit option means you will have to handle the condition(s) that the user specifies it without --action=reinstall, or no template package name, etc.. It means creating conditions we may not catch. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 12, 2016
Another step I'd perform is to do a lock just before dom0 yum is run, to prevent vms from starting while an existing template is being reinstalled (don't want vms based on that template to start during the procedure).
tasket
commented
Jun 12, 2016
|
Another step I'd perform is to do a lock just before dom0 yum is run, to prevent vms from starting while an existing template is being reinstalled (don't want vms based on that template to start during the procedure). |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 12, 2016
Here's a patch for testing it: QubesOS/qubes-core-admin-linux@master...ttasket:patch-1
It works but doesn't have sanity checks yet.
If I do a reinstall while a dependent appvm is running, yum says that a "volatile.img already exists. not overriding." Then "warning %post ... scriptlet failed, exit status 1" and "non-fatal POSTIN scriptlet failure in rpm package". VM keeps working and when I restart it, its back to original root image.
tasket
commented
Jun 12, 2016
|
Here's a patch for testing it: QubesOS/qubes-core-admin-linux@master...ttasket:patch-1 It works but doesn't have sanity checks yet. If I do a reinstall while a dependent appvm is running, yum says that a "volatile.img already exists. not overriding." Then "warning %post ... scriptlet failed, exit status 1" and "non-fatal POSTIN scriptlet failure in rpm package". VM keeps working and when I restart it, its back to original root image. |
added a commit
that referenced
this issue
Jun 12, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 12, 2016
Member
It should be possible to reinstall (rpm) template while AppVMs based on it are running. The important part is to not modify root.img (or other *.img) but unlink old ones and create new ones in place. Not sure what rpm does, but I guess it behaves exactly this way.
|
It should be possible to reinstall (rpm) template while AppVMs based on it are running. The important part is to not modify |
added a commit
that referenced
this issue
Jun 12, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 12, 2016
Rpm and dpkg and others generally adhere to the unix tradition of 'unlink first' to avoid conflicts and corruption at runtime.
I re-installed the same template again:
- The inode number for root.img changed, so it was unlinked cleanly
- Same POSTIN 'failure' appeared, with vms not running this time
- The private.img inode was unchanged.. the rpm package is not trying to replace it
Number 3 is definitely a problem. Is this an rpm install script issue?
tasket
commented
Jun 12, 2016
|
Rpm and dpkg and others generally adhere to the unix tradition of 'unlink first' to avoid conflicts and corruption at runtime. I re-installed the same template again:
Number 3 is definitely a problem. Is this an rpm install script issue? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 12, 2016
Member
I guess private.img is not recreated at all:
https://github.com/QubesOS/qubes-linux-template-builder/blob/master/templates.spec#L81-L88
As for volatile.img, it should just work if the script would remove it before recreating:
https://github.com/QubesOS/qubes-linux-template-builder/blob/master/templates.spec#L74
But there is another potential problem. The script will try to start the template (which in itself isn't a problem):
https://github.com/QubesOS/qubes-linux-template-builder/blob/master/templates.spec#L120-L129
But it changes netvm to none for that (which is still fine) and then change back to default, not the one originally set there. This would be fine if that would be initial installation, but for reinstall, this means netvm will be changed (will be a problem for Whonix templates).
|
I guess As for But there is another potential problem. The script will try to start the template (which in itself isn't a problem): |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 13, 2016
Should we mv the private.img to backup file before processing it?
I'm unfamiliar with the parameter handling here, but some of the logic looks tentative with a reference to "upgrading template" in the %pre section.
tasket
commented
Jun 13, 2016
|
Should we mv the private.img to backup file before processing it? I'm unfamiliar with the parameter handling here, but some of the logic looks tentative with a reference to "upgrading template" in the %pre section. |
added a commit
that referenced
this issue
Jun 13, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 14, 2016
Member
As for private.img - mv to backup is a good idea.
As for parameter handling in RPM, see here: http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html
|
As for |
added a commit
that referenced
this issue
Jun 14, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 14, 2016
Where to put the backup? If just private.img-bak in the same folder, then we end up with a big lump that could sit there forgotten, taking up space. If it does get moved as a backup, it should be in a place that's very visible to the user, like their home folder.
Alternative is to make deletion of the old img standard and issue a warning.
tasket
commented
Jun 14, 2016
|
Where to put the backup? If just private.img-bak in the same folder, then we end up with a big lump that could sit there forgotten, taking up space. If it does get moved as a backup, it should be in a place that's very visible to the user, like their home folder. Alternative is to make deletion of the old img standard and issue a warning. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 14, 2016
Member
Maybe you're right about its deletion. Old root.img is lost by design, so indeed removing private.img too seems logical.
|
Maybe you're right about its deletion. Old |
added a commit
that referenced
this issue
Jun 15, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 16, 2016
Two PRs for testing:
QubesOS/qubes-core-admin-linux#7
QubesOS/qubes-linux-template-builder#1
tasket
commented
Jun 16, 2016
|
Two PRs for testing: |
marmarek
referenced this issue
in QubesOS/qubes-core-admin-linux
Jun 18, 2016
Merged
Support in-place template reinstalls - for testing #7
added a commit
that referenced
this issue
Jun 18, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 20, 2016
@marmarek This version currently works: https://github.com/ttasket/qubes-core-admin-linux/blob/ttasket-patch-1/dom0-updates/qubes-dom0-update
However, it still leaves private.img in place (old %post script?). Maybe we could have qubes-dom0-update handle that, too?
tasket
commented
Jun 20, 2016
|
@marmarek This version currently works: https://github.com/ttasket/qubes-core-admin-linux/blob/ttasket-patch-1/dom0-updates/qubes-dom0-update |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 20, 2016
Member
patch-1/dom0-updates/qubes-dom0-update
However, it still leaves private.img in place (old %post script?). Maybe we could have qubes-dom0-update handle that, too?
Yes, good idea.
Yes, good idea. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 20, 2016
That conditional in %post means the private.img won't get regenerated, though. Maybe there is a way to make yum use the new scriptlets instead?
tasket
commented
Jun 20, 2016
|
That conditional in %post means the private.img won't get regenerated, though. Maybe there is a way to make yum use the new scriptlets instead? |
marmarek
added this to the Release 3.1 updates milestone
Jun 20, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 21, 2016
OK, simplest way forward is to have qubes-dom0-update check for private.img an re-create it if missing...
PR tasket/qubes-core-admin-linux#2
tasket
commented
Jun 21, 2016
|
OK, simplest way forward is to have qubes-dom0-update check for private.img an re-create it if missing... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 21, 2016
I also noticed %post does 'exit 1' because volatile.img is already there; want to add rm -f for volatile.img before calling yum.
tasket
commented
Jun 21, 2016
|
I also noticed %post does 'exit 1' because volatile.img is already there; want to add |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 21, 2016
New PR with fixes tasket/qubes-core-admin-linux#3
Works well for me. You guys can start testing it.
tasket
commented
Jun 21, 2016
|
New PR with fixes tasket/qubes-core-admin-linux#3 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tasket
Jun 21, 2016
I just noticed, if yum exits then template is left without volatile.img, but it gets re-created when you run the template vm. If this is not OK, I'll handle volatile just like the other img files so it can be restored on error.
tasket
commented
Jun 21, 2016
|
I just noticed, if yum exits then template is left without volatile.img, but it gets re-created when you run the template vm. If this is not OK, I'll handle volatile just like the other img files so it can be restored on error. |
added a commit
that referenced
this issue
Jun 22, 2016
marmarek
closed this
in
marmarek/qubes-core-admin-linux@3eed63b
Jun 24, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 24, 2016
Member
Automated announcement from builder-github
The package qubes-core-dom0-linux-3.2.4-1.fc23 has been pushed to the r3.2 testing repository for dom0.
To test this update, please install it with the following command:
sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing
|
Automated announcement from builder-github The package
|
marmarek
added
the
r3.2-dom0-cur-test
label
Jun 24, 2016
added a commit
that referenced
this issue
Jun 25, 2016
added a commit
to QubesOS/qubes-core-admin-linux
that referenced
this issue
Jun 25, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jun 25, 2016
Member
Automated announcement from builder-github
The package qubes-core-dom0-linux-3.1.12-1.fc20 has been pushed to the r3.1 testing repository for dom0.
To test this update, please install it with the following command:
sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing
|
Automated announcement from builder-github The package
|
marmarek
added
the
r3.1-dom0-cur-test
label
Jun 25, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jul 25, 2016
Member
Automated announcement from builder-github
The package qubes-core-dom0-linux-3.1.12-1.fc20 has been pushed to the r3.1 stable repository for dom0.
To install this update, please use the standard update command:
sudo qubes-dom0-update
Or update dom0 via Qubes Manager.
|
Automated announcement from builder-github The package
Or update dom0 via Qubes Manager. |
marmarek
added
r3.1-dom0-stable
and removed
r3.1-dom0-cur-test
labels
Jul 25, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Jul 25, 2016
Member
Automated announcement from builder-github
The package qubes-core-dom0-linux-3.2.5-1.fc23 has been pushed to the r3.2 stable repository for dom0.
To install this update, please use the standard update command:
sudo qubes-dom0-update
Or update dom0 via Qubes Manager.
|
Automated announcement from builder-github The package
Or update dom0 via Qubes Manager. |
adrelanos commentedJun 12, 2016
qubes-dom0-updatecurrently excludesqubes-template-*packages.TEMPLATE_EXCLUDE_OPTSvariableThis makes template reinstallation instructions more difficult than possible.
Feature request:
Please add an option to
qubes-dom0-updateto allow template reinstallation.Related mailing list discussion:
Is there a standard procedure to reinstall whonix?