Skip to content
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

Closed
tasket opened this issue Mar 20, 2017 · 23 comments · Fixed by QubesOS/qubes-desktop-linux-manager#34
Closed

Tool for performing multiple updates #2718

tasket opened this issue Mar 20, 2017 · 23 comments · Fixed by QubesOS/qubes-desktop-linux-manager#34
Assignees
Labels
C: mgmt C: templates T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@tasket
Copy link

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
Copy link
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?

@tasket
Copy link
Author

tasket commented Mar 20, 2017

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

@marmarek
Copy link
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/

@tasket
Copy link
Author

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
Copy link
Member

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

@andrewdavidwong andrewdavidwong added C: mgmt C: templates T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. labels Mar 20, 2017
@andrewdavidwong andrewdavidwong added this to the Release 4.1 milestone Mar 20, 2017
@tasket
Copy link
Author

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
Copy link
Member

marmarek commented Apr 11, 2017 via email

@tasket
Copy link
Author

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
Copy link

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
Copy link
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
Copy link
Author

tasket commented May 26, 2017

@jpouellet Done :)

@jpouellet
Copy link
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
Copy link
Author

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
Copy link
Contributor

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
Copy link
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
Copy link
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:
  qubes:type:template:
    - match: pillar
    - topd

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

@conorsch
Copy link

Confirming @tlaurion's "SKIP" results, even after implementing @marmarek's suggested workaround:

[user@dom0 ~]$ sudo cat /srv/salt/placeholder.top
base:
  qvm:type:template:
    - match: pillar
    - topd
[user@dom0 ~]$ sudo qubesctl top.enable placeholder
local:
    ----------
    placeholder.top:
        ----------
        status:
            unchanged
[user@dom0 ~]$ qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True
fedora-27: SKIP (nothing to do)
fedora-26: SKIP (nothing to do)
fedora-28: SKIP (nothing to do)
whonix-ws: SKIP (nothing to do)
whonix-gw: SKIP (nothing to do)
debian-9: SKIP (nothing to do)
[user@dom0 ~]$ qvm-start fedora-27 fedora-28
[user@dom0 ~]$ qubesctl --skip-dom0 --templates --show-output state.single pkg.uptodate refresh=True dist_upgrade=True
fedora-27: SKIP (nothing to do)
fedora-26: SKIP (nothing to do)
fedora-28: SKIP (nothing to do)
whonix-ws: SKIP (nothing to do)
whonix-gw: SKIP (nothing to do)
debian-9: SKIP (nothing to do)
[user@dom0 ~]$ qubesctl --skip-dom0 --templates --show-output pkg.upgrade
fedora-27: SKIP (nothing to do)
fedora-26: SKIP (nothing to do)
fedora-28: SKIP (nothing to do)
whonix-ws: SKIP (nothing to do)
whonix-gw: SKIP (nothing to do)
debian-9: SKIP (nothing to do)
[user@dom0 ~]$

To confirm it's not that there's really nothing to do, I manually started debian-9, and confirmed in a terminal window that there are indeed updates that can be installed there. I also tried running sudo qubesctl state.highstate in dom0, but the pkg.upgrade command still emits SKIP messages, regardless of whether the target TemplateVMs are started or halted.

@marmarek
Copy link
Member

Oh, it should be qubes:type:template, not qvm:type:template.

@tlaurion
Copy link
Contributor

tlaurion commented Jul 31, 2018

@marmarek Still "SKIP (nothing to do)" warnings with qubes:type:template in /srv/salt/placeholder.top

When will a solution to upgrade all templates from GUI happens?

@marmarek marmarek mentioned this issue Sep 7, 2018
10 tasks
@unman
Copy link
Member

unman commented Sep 7, 2018

@marmarek
The salt call works fine, and is how I update my systems
Is all that is needed here a separate GUI tool, a menu item from (gasp) Qube Manager, or an additional R-click menu item, "Update all qubes" ?

@conorsch
Copy link

conorsch commented Sep 8, 2018

Yes, with @marmarek 's tweak to the template I posted above, this is now a reliable method to "update all VMs." Still hoping to make this automatic, presumably via cron.

@marmarta
Copy link
Member

There's a pull request for a gui tool for that - QubesOS/qubes-desktop-linux-manager#34 . Does this mean this issue is solved, @marmarek ? We have a CLI way to update VMs (which can be added to cron) and a gui tool for users to click through updates when they become available.

@andrewdavidwong
Copy link
Member

andrewdavidwong commented Dec 17, 2018

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

It looks like the decision about the "automatic" part was won't do.

Oops, missed this part:

We have a CLI way to update VMs (which can be added to cron)

Looks like it's considered done.

@andrewdavidwong andrewdavidwong added R: declined Resolution: While a legitimate bug or proposal, it has been decided that no action will be taken. and removed R: declined Resolution: While a legitimate bug or proposal, it has been decided that no action will be taken. labels Dec 17, 2018
strugee added a commit to strugee/qubes-issues that referenced this issue May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: mgmt C: templates T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants