How to check (in BASH and dom0) whether a appVM exists?

51 views
Skip to first unread message

Johannes Graumann

unread,
May 19, 2020, 4:32:18 AM5/19/20
to qubes...@googlegroups.com

Hello,

See subject line ;)

Sincerely, Joh

Christophe

unread,
May 19, 2020, 4:35:27 AM5/19/20
to Johannes Graumann, qubes...@googlegroups.com
qvm-ls|grep yourvmname
> --
> You received this message because you are subscribed to the Google Groups "qubes-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/74dcf0a303aa9afb95809626034f7e1e%40graumannschaft.org.

Frédéric Pierret

unread,
May 19, 2020, 4:47:15 AM5/19/20
to Christophe, Johannes Graumann, qubes...@googlegroups.com
There is a tool for checking state of VMs:

[userdom0 ~]$ qvm-check toto
usage: qvm-check [--verbose] [--quiet] [--help] [--all] [--exclude EXCLUDE]
[--running] [--paused] [--template] [--networked]
[VMNAME [VMNAME ...]]
qvm-check: error: no such domain: 'toto'
[user@dom0 ~]$ echo $?
2
[user@dom0 ~]$ qvm-check sys-net
qvm-check: sys-net: exists
[user@dom0 ~]$ echo $?
0

Best,
Frédéric
signature.asc

Johannes Graumann

unread,
May 19, 2020, 6:39:42 AM5/19/20
to Christophe, qubes...@googlegroups.com

On 2020-05-19 10:35, Christophe wrote:

Thank you. I guess this should then do ...

if ! qvm-ls --running|grep -q $VM; then
  echo "$VM not running or present. Aborting."
  exit 1
fi

Johannes Graumann

unread,
May 19, 2020, 6:40:40 AM5/19/20
to Frédéric Pierret, Christophe, qubes...@googlegroups.com

Ha - even better ... sorry, saw this late.

Thanks!


Joh

unman

unread,
May 19, 2020, 8:06:57 AM5/19/20
to qubes...@googlegroups.com
You know of `qvm-check`

`qvm-ls --running` will miss qubes that are starting up or closing down,
ie of state Transient.
To catch those, you need something like `qvm-ls |egrep 'Running|Transient'

pillule

unread,
May 25, 2020, 3:29:23 PM5/25/20
to qubes...@googlegroups.com
Hi,

You maybe interested to know which VM is the last started (sometime
for DVM), here my way to do it :

virsh -c xen:/// list | tail -n 2 | head -n 1 | sed -r 's/^ [0-9]+ *//s .//'

--


hut7no

unread,
May 27, 2020, 2:03:35 PM5/27/20
to qubes...@googlegroups.com
qvm-check checks if for existence by default.
Reply all
Reply to author
Forward
0 new messages