diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index b50961b7..d72692fc 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1578,6 +1578,9 @@ class QubesVm(object): if (retcode != 0) : raise QubesException("Cannot start qubes-guid!") + if not self.is_qrexec_running(): + return + try: import qubes.monitorlayoutnotify if verbose: @@ -1707,14 +1710,22 @@ class QubesVm(object): if qmemman_present: qmemman_client.close() - if self._start_guid_first and start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'): - self.start_guid(verbose=verbose, notify_function=notify_function, before_qrexec=True) + extra_guid_args = None + if preparing_dvm: + # Run GUI daemon in "invisible" mode, so applications started by + # prerun script will not disturb the user + extra_guid_args = ['-I'] + + if self._start_guid_first and start_guid and os.path.exists('/var/run/shm.id'): + self.start_guid(verbose=verbose, notify_function=notify_function, + before_qrexec=True, extra_guid_args=extra_guid_args) if not preparing_dvm: self.start_qrexec_daemon(verbose=verbose,notify_function=notify_function) - if start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'): - self.start_guid(verbose=verbose, notify_function=notify_function) + if start_guid and os.path.exists('/var/run/shm.id'): + self.start_guid(verbose=verbose, notify_function=notify_function, + extra_guid_args=extra_guid_args) return xid diff --git a/core-modules/01QubesDisposableVm.py b/core-modules/01QubesDisposableVm.py index dc8020f0..9f1d989d 100644 --- a/core-modules/01QubesDisposableVm.py +++ b/core-modules/01QubesDisposableVm.py @@ -117,6 +117,12 @@ class QubesDisposableVm(QubesVm): attrs['privatedev'] = '' return attrs + + def create_xenstore_entries(self, xid): + super(QubesDisposableVm, self).create_xenstore_entries(xid) + + self.qdb.write('/qubes-restore-complete', '1') + def start(self, verbose = False, **kwargs): self.log.debug('start()') if dry_run: diff --git a/dispvm/qubes-prepare-saved-domain.sh b/dispvm/qubes-prepare-saved-domain.sh index 24c6307b..eb7dacca 100755 --- a/dispvm/qubes-prepare-saved-domain.sh +++ b/dispvm/qubes-prepare-saved-domain.sh @@ -25,10 +25,11 @@ if ! [ -d $VMDIR ] ; then echo "$VMDIR does not exist ?" >&2 exit 1 fi -if ! qvm-start $1 --no-guid --dvm ; then +if ! qvm-start $1 --dvm ; then exit 1 fi +ID=`virsh -c xen:/// domid $1` echo "Waiting for DVM $1 ..." >&2 if [ -n "$ENCODED_SCRIPT" ] ; then qubesdb-write -d $1 /qubes-save-script "$ENCODED_SCRIPT" @@ -38,6 +39,7 @@ qubesdb-write -d $1 /qubes-save-request 1 qubesdb-watch -d $1 /qubes-used-mem qubesdb-read -d $1 /qubes-gateway | \ cut -d . -f 3 | tr -d "\n" > $VMDIR/netvm-id.txt +kill `cat /var/run/qubes/guid-running.$ID` # FIXME: get connection URI from core scripts virsh -c xen:/// detach-disk $1 xvdb MEM=$(qubesdb-read -d $1 /qubes-used-mem) diff --git a/tests/vm_qrexec_gui.py b/tests/vm_qrexec_gui.py index 0878ea98..6641408c 100644 --- a/tests/vm_qrexec_gui.py +++ b/tests/vm_qrexec_gui.py @@ -512,6 +512,7 @@ class TC_20_DispVM(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): time.sleep(0.5) subprocess.check_call(['xdotool', 'search', '--name', window_title, 'windowactivate', 'type', 'test test 2\n']) + time.sleep(0.5) subprocess.check_call(['xdotool', 'search', '--name', window_title, 'key', 'ctrl+s', 'ctrl+q']) p.wait()