Skip to content

Query GUIVM session or GUID from client in GUIVM#217

Merged
marmarek merged 2 commits into
QubesOS:mainfrom
ben-grande:preload-delay-gui-daemon
Mar 17, 2026
Merged

Query GUIVM session or GUID from client in GUIVM#217
marmarek merged 2 commits into
QubesOS:mainfrom
ben-grande:preload-delay-gui-daemon

Conversation

@ben-grande
Copy link
Copy Markdown
Contributor

@ben-grande ben-grande commented Dec 1, 2025

Read link to canonical path of GUID file

By default, it resolves the link path literally, which causes problem if other commands do not run on the same directory the link is at.

For: QubesOS/qubes-core-admin#757
For: QubesOS/qubes-notification-proxy#13
For: QubesOS/qubes-issues#9940
For: QubesOS/qubes-issues#1512


Allow GUIVM clients to know if GUIVM has session

Or if GUID of the client can be found on the server. This script will be
replicated to qubes-core-agent-linux.

For: QubesOS/qubes-notification-proxy#13
For: QubesOS/qubes-gui-agent-linux#251
For: QubesOS/qubes-core-admin#757
For: QubesOS/qubes-issues#1512
For: QubesOS/qubes-issues#9940
Fixes: QubesOS/qubes-issues#10443


Test case:

QREXEC_REMOTE_DOMAIN=mydomain /etc/qubes-rpc/qubes.WaitForSession

Please note that to avoid package conflicting (having the same file), it has to be handled with "less than version" compared to core-agent-linux

https://github.com/QubesOS/qubes-core-qrexec/compare/223f3b596259adf299988f1171df8572d0204a0c..0dc90060ad27e90487572f0609453b5c564f4be7

See required PR:

@qubesos-bot
Copy link
Copy Markdown

qubesos-bot commented Dec 2, 2025

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026031512-4.3&flavor=pull-requests

Test run included the following:

Installing updates failed, skipping the report!

@ben-grande ben-grande changed the title Read link to canonical path of GUID file Query GUIVM session or GUID from client in GUIVM Dec 2, 2025
@ben-grande ben-grande force-pushed the preload-delay-gui-daemon branch 2 times, most recently from b953a27 to 081836a Compare December 2, 2025 17:44
@ben-grande ben-grande force-pushed the preload-delay-gui-daemon branch 6 times, most recently from df94a26 to 88935ab Compare December 4, 2025 11:13
@ben-grande
Copy link
Copy Markdown
Contributor Author

PipelineRetryFailed

Comment thread qubes-rpc-base/qubes.WaitForSession Outdated
Comment on lines +9 to +48
wait_client_guid(){
qube="${1-}"
if test -z "$qube"; then
echo "QREXEC_REMOTE_DOMAIN variable needs to be set" >&2
exit 1
fi

prefix="/var/run/qubes"
if test "$in_dom0" = "true"; then
qrexec_name_sock="$prefix/qrexec.$qube"
if ! test -L "$qrexec_name_sock"; then
echo "$0: $qrexec_name_sock not found, domain might be dead" >&2
exit 1
fi
qrexec_id_sock="$(readlink -e "$qrexec_name_sock")"
if test -z "$qrexec_id_sock"; then
echo "$0: readlink failed for $qrexec_name_sock" >&2
exit 1
fi
xid="${qrexec_id_sock##*/qrexec.}"
guid_running="${qrexec_id_sock%/*}/guid-running.$xid"
else
xid="$(qvm-prefs -- "$qube" xid)"
guid_running="$(readlink -e "$prefix/guid-running.$xid")"
fi

while true; do
if test -f "$guid_running"; then
break
fi

if test "$in_dom0" = "true" && ! test -e "$qrexec_id_sock"; then
echo "$0: $qrexec_id_sock not found, domain might be dead" >&2
exit 1
fi

sleep 0.5
done
exit 0
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, VM knows this already, I don't think there is a need to as GUI domain (which may be dom0) about it.
I specifically introduced status file for it: QubesOS/qubes-gui-agent-linux@a981e36

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code above allows querying GUID of any qube a GUI domain is responsible for. I guess there is no current use case for this (except if notification proxy is not running in GUIVM). For the case of notification-proxy where the service requires the client to have a session. It should be some loop on ExecStartPre= to wait for started, to not break preloaded disposables session startup.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be some loop on ExecStartPre= to wait for started, to not break preloaded disposables session startup.

If necessary at all, then yes, and ideally using inotify, not sleep (if going with shell, then inotifywait -e close_write might be the way to go).

But, there is QubesOS/qubes-notification-proxy#14, which makes the server side wait for the user login, so maybe that's enough already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be some loop on ExecStartPre= to wait for started, to not break preloaded disposables session startup.

If necessary at all, then yes, and ideally using inotify, not sleep (if going with shell, then inotifywait -e close_write might be the way to go).

Hum, I thought that for some reason it was necessary, but openqa is succeeding so I guess this is fine.

But, there is QubesOS/qubes-notification-proxy#14, which makes the server side wait for the user login, so maybe that's enough already?

Yes, seems enough. Latest openqa failed installing packages. but edits shows that preload tests were succeeding.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.86%. Comparing base (1fa231c) to head (0dc9006).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #217      +/-   ##
==========================================
- Coverage   78.98%   78.86%   -0.12%     
==========================================
  Files          55       55              
  Lines       10532    10530       -2     
==========================================
- Hits         8319     8305      -14     
- Misses       2213     2225      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ben-grande ben-grande force-pushed the preload-delay-gui-daemon branch from 5dc1b28 to 223f3b5 Compare March 16, 2026 21:53
@ben-grande
Copy link
Copy Markdown
Contributor Author

PipelineRetryFailed

@ben-grande
Copy link
Copy Markdown
Contributor Author

Do you want me to make the version changes in a separate commit to be easily excluded from when you cherry pick?

@marmarek
Copy link
Copy Markdown
Member

Do you want me to make the version changes in a separate commit to be easily excluded from when you cherry pick?

Yes, or even drop it completely and just add a note in PR description.

@ben-grande ben-grande force-pushed the preload-delay-gui-daemon branch from 223f3b5 to 0dc9006 Compare March 17, 2026 01:13
marmarek added a commit that referenced this pull request Mar 17, 2026
/etc/qubes-rpc/qubes.WaitForSession is migrating from core-agent-linux
to this repository.

See #217 for more
details.
@marmarek marmarek merged commit 0e1766a into QubesOS:main Mar 17, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qubes.WaitForSession processes keep accumulating with preloaded DispVMs

3 participants