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

Tool for performing multiple updates #2718

Open
tasket opened this Issue Mar 20, 2017 · 16 comments

Comments

Projects
None yet
6 participants
@tasket

tasket commented Mar 20, 2017

Qubes needs a way to handle multiple OS updates automatically since managing these processes individually is disruptive to the user.

So far I have a python script qubes-multi-update that can handle Linux-based VMs which includes PVM templates, standalones and dom0:

https://github.com/tasket/Qubes-scripts/blob/master/qubes-multi-update

It is meant to be an improvement on various other update scripts seen online; it tries to intelligently handle VM states and status (such as 'updates available') and can optionally TRIM templates and standalones.


Related issues:

https://gist.github.com/andrewdavidwong/d0b109186de65835255d467ae103c289
https://gist.github.com/JimmyAx/818bcf11a14e85531516ef999c8c5765
#1378
#1760
#2150

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 20, 2017

Member

Can be handled by salt:
/srv/user_salt/update.sls:

update:
  pkg.uptodate:
    - refresh: True
    - dist_upgrade: True

Then add to /srv/user_salt/top.sls:

user:
  qubes:type:template:
    - match: pillar
    - update

And launch: qubesctl --all --show-output state.highstate

Maybe we should ship such configuration by default?

Member

marmarek commented Mar 20, 2017

Can be handled by salt:
/srv/user_salt/update.sls:

update:
  pkg.uptodate:
    - refresh: True
    - dist_upgrade: True

Then add to /srv/user_salt/top.sls:

user:
  qubes:type:template:
    - match: pillar
    - update

And launch: qubesctl --all --show-output state.highstate

Maybe we should ship such configuration by default?

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Mar 20, 2017

Does this handle only templates? And does it leave them running?

tasket commented Mar 20, 2017

Does this handle only templates? And does it leave them running?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 20, 2017

Member

Does this handle only templates?

In this case - yes, because I've specified it that way (qubes:type:template). You can also extend this to standalone VMs (qubes:type:standalone), or even AppVMs (qubes:type:app). The last one make very little sense, though.

And does it leave them running?

It will leave them in the same state - if template was running, it will be left as such, otherwise it will be stopped after applying state.

BTW, if you want to apply just this one action, you can do that in one line, without any additional file:

qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True

More info: https://www.qubes-os.org/doc/salt/

Member

marmarek commented Mar 20, 2017

Does this handle only templates?

In this case - yes, because I've specified it that way (qubes:type:template). You can also extend this to standalone VMs (qubes:type:standalone), or even AppVMs (qubes:type:app). The last one make very little sense, though.

And does it leave them running?

It will leave them in the same state - if template was running, it will be left as such, otherwise it will be stopped after applying state.

BTW, if you want to apply just this one action, you can do that in one line, without any additional file:

qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True

More info: https://www.qubes-os.org/doc/salt/

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Mar 20, 2017

Since this appears to be pulling from Qubes API, it seems like ( qubes:type:updateable ) should be possible?

I'm reading the salt docs now.

tasket commented Mar 20, 2017

Since this appears to be pulling from Qubes API, it seems like ( qubes:type:updateable ) should be possible?

I'm reading the salt docs now.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 20, 2017

Member

It should be easy to add such option (in practice: qubes:updateable:true), but it doesn't exist right now.

Member

marmarek commented Mar 20, 2017

It should be easy to add such option (in practice: qubes:updateable:true), but it doesn't exist right now.

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Apr 8, 2017

@marmarek This saltstack method tries to launch a VM for each template all at the same time. The result was spurious insufficient memory errors.

I also get this prompt for each template:

  • Do you allow domain "disp-mgmt-fedora-24-minimal" to execute qubes.VMAuth operation on the domain "dom0"?

This is from update command not running as root with the vm-sudo config.

tasket commented Apr 8, 2017

@marmarek This saltstack method tries to launch a VM for each template all at the same time. The result was spurious insufficient memory errors.

I also get this prompt for each template:

  • Do you allow domain "disp-mgmt-fedora-24-minimal" to execute qubes.VMAuth operation on the domain "dom0"?

This is from update command not running as root with the vm-sudo config.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Apr 11, 2017

Member
Member

marmarek commented Apr 11, 2017

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Apr 11, 2017

Currently having doubts about using a config management engine (salt) for routine maintenance tasks. The more I learn, the more it seems like a poor fit.

Adding some nice-to-have features to qubes-multi-update, but will definitely use saltstack for VPN setup, vm-sudo setup and more...

tasket commented Apr 11, 2017

Currently having doubts about using a config management engine (salt) for routine maintenance tasks. The more I learn, the more it seems like a poor fit.

Adding some nice-to-have features to qubes-multi-update, but will definitely use saltstack for VPN setup, vm-sudo setup and more...

@J316

This comment has been minimized.

Show comment
Hide comment
@J316

J316 May 19, 2017

@marmarek

Maybe we should ship such configuration by default?

Absolutely! It's a pain to upgrade all VMs one by one, a upgrade all VM button would be much, much appriciated.

J316 commented May 19, 2017

@marmarek

Maybe we should ship such configuration by default?

Absolutely! It's a pain to upgrade all VMs one by one, a upgrade all VM button would be much, much appriciated.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet May 26, 2017

Contributor

Feature request: The ability to manually select some VMs for exclusion from bulk updates.

I have a couple VMs running intentionally outdated versions of stuff which is required to get some proprietary stuff running properly. Sure, I could probably just pin the specific packages necessary in my package manager, but this is not a workable solution for people who are not familiar with package managers and just want to say "I know this is vulnerable and terrible, but please don't touch it. It's not networked and I keep my data away from it, it's okay. I just need it to work."

Contributor

jpouellet commented May 26, 2017

Feature request: The ability to manually select some VMs for exclusion from bulk updates.

I have a couple VMs running intentionally outdated versions of stuff which is required to get some proprietary stuff running properly. Sure, I could probably just pin the specific packages necessary in my package manager, but this is not a workable solution for people who are not familiar with package managers and just want to say "I know this is vulnerable and terrible, but please don't touch it. It's not networked and I keep my data away from it, it's okay. I just need it to work."

@tasket

This comment has been minimized.

Show comment
Hide comment

tasket commented May 26, 2017

@jpouellet Done :)

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet May 26, 2017

Contributor

I had in mind more of some persistent config on a VM which says to exclude it (like existing options for "include in backups by default", "automatically start on boot", etc.), which you could set and forget, rather than some cmd line option which you need to remember to pass each time.

Looking forward, this seems to be exactly the kind of thing core3's "features" (essentially a dict of auxiliary metadata on each VM) enables cleanly.

Contributor

jpouellet commented May 26, 2017

I had in mind more of some persistent config on a VM which says to exclude it (like existing options for "include in backups by default", "automatically start on boot", etc.), which you could set and forget, rather than some cmd line option which you need to remember to pass each time.

Looking forward, this seems to be exactly the kind of thing core3's "features" (essentially a dict of auxiliary metadata on each VM) enables cleanly.

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket May 26, 2017

No doubt, that would make it easy. But while we're running 3.x its good to have something that works.

And although there is no current way to tag or assign other metadata to VMs, keeping a separate list just for the purpose could also enable the 'set and forget' use case.

tasket commented May 26, 2017

No doubt, that would make it easy. But while we're running 3.x its good to have something that works.

And although there is no current way to tag or assign other metadata to VMs, keeping a separate list just for the purpose could also enable the 'set and forget' use case.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet May 26, 2017

Contributor

Indeed. Thanks for working on this :)

Contributor

jpouellet commented May 26, 2017

Indeed. Thanks for working on this :)

tasket added a commit to tasket/Qubes-scripts that referenced this issue May 26, 2017

andrewdavidwong added a commit that referenced this issue May 27, 2017

@tlaurion

This comment has been minimized.

Show comment
Hide comment
@tlaurion

tlaurion Apr 16, 2018

Contributor

@marmarek
qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True

Gives a bunch of "SKIP (nothing to do)" while most of the templates require updates.

Contributor

tlaurion commented Apr 16, 2018

@marmarek
qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True

Gives a bunch of "SKIP (nothing to do)" while most of the templates require updates.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Apr 16, 2018

Member

It's #2451 - there is optimization to not start VMs not mentioned in top file. Until linked issue is resolved, you can use placeholder state, for example:

base:
  qvm:type:template:
    - match: pillar
    - topd

Put the above in /srv/salt/placeholder.top and enable with qubesctl top.enable placeholder.

Member

marmarek commented Apr 16, 2018

It's #2451 - there is optimization to not start VMs not mentioned in top file. Until linked issue is resolved, you can use placeholder state, for example:

base:
  qvm:type:template:
    - match: pillar
    - topd

Put the above in /srv/salt/placeholder.top and enable with qubesctl top.enable placeholder.

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