Skip to content

show clear errors for missing vnc - #1018

Merged
johrstrom merged 2 commits into
masterfrom
tiger-vnc-compat
Oct 23, 2026
Merged

johrstrom merged 2 commits into
masterfrom
tiger-vnc-compat

Conversation

@Oglopf

@Oglopf Oglopf commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

VNC apps need TurboVNC, but when a node has TigerVNC (or no vncserver at all) the job retries 10 times, dumps Xvnc's usage text each time, and exits with nothing saying what's wrong. Now:

  • If vncserver isn't in PATH (or, for vnc_container, in the container), the job says so and that TurboVNC is required, before trying anything.
  • If the output shows TigerVNC, the job stops after the first attempt (retrying can't help) and says TigerVNC was found and TurboVNC is needed.
  • Any other startup failure retries as before and ends with a generic error that doesn't mention TigerVNC.

TurboVNC startup is unchanged. TigerVNC is detected only from its own output ("TigerVNC" / "Xtigervnc", or the "replaced by a systemd unit" warning some RHEL-family packages print), which TurboVNC never prints.

Related issue

Closes #768

Testing

  • Tests included: test/batch_connect/vnc_requires_turbovnc_test.rb uses fake vncserver scripts for TigerVNC, the RHEL warning, a failing TurboVNC, and a missing vncserver, for both templates.
  • Also run end to end with real TigerVNC 1.13.1 and TurboVNC 3.1.4 (Ubuntu 24.04): TurboVNC starts as before; TigerVNC goes from ~2,200 lines of output to one attempt and the message.

Anything else?

Not yet tried against RHEL's tigervnc-server package specifically.

host=localhost
#{template.send(:before_script)}
BASH
out, status = Open3.capture2e('/bin/bash', '-c', script)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's preferable to use standard in here to bash or write the file out. This here creates a giant single line command and there are limits to how many characters a single command can be.

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.

Good call, the old version passed the whole script to bash as one giant argument. It now writes the script to a file in the test's tmpdir and runs bash <file> instead.

I went with a file rather than piping into stdin: when bash reads the script from stdin, any command in the script that also reads stdin can eat the remaining lines of the script. Writing a file sidesteps that.

Comment on lines +105 to +108
%w[cat grep pgrep seq shuf sleep sh].each do |cmd|
path = ENV['PATH'].split(':').map { |p| File.join(p, cmd) }.find { |p| File.executable?(p) }
File.symlink(path, File.join(bin, cmd))
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we just prepend the PATH with this bin directory so they show up first in the PATH instead of having to do all this?

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.

Yep, that's simpler. The fake bin is now prepended to the real PATH, and the symlink loop is gone. I also faked sleep there, so the retry test doesn't spend ~5s sleeping between attempts.

One catch: with the real PATH appended, the two "missing vncserver" tests can't hide a vncserver that's actually installed (my laptop has TigerVNC), so they now skip when one's in PATH. CI doesn't have one, so they still run there. I also added a test where VNCSERVER_CMD points at a path that doesn't exist, which covers the missing case on any machine.

- the up-front check and the TigerVNC message use vncserver_cmd, so a
  vncserver pinned outside PATH (#1006) isn't reported as missing
- messages say 'VNC server' so no bare vncserver lands in the script
- tests write the script to a file instead of a giant bash -c argument
- tests prepend the fake commands to PATH instead of symlinking the
  real ones; the two missing-vncserver tests skip if a real one is
  installed
- add tests for a pinned vncserver outside PATH, found and missing
@Oglopf

Oglopf commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master. This picked up #1006, which this PR was quietly breaking: the up-front check used command -v vncserver, so a vncserver pinned with vncserver_cmd/VNCSERVER_CMD outside PATH got reported as missing. It also tripped #1006's no-bare-vncserver test. The check and messages now go through vncserver_cmd, and there are tests for the pinned case, found and missing.

Comment thread lib/ood_core/batch_connect/templates/vnc_container.rb

@johrstrom johrstrom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested both templates and they both work well for me. Thanks!

@johrstrom
johrstrom merged commit c7eb832 into master Oct 23, 2026
6 checks passed
@johrstrom
johrstrom deleted the tiger-vnc-compat branch October 23, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tigervnc compatability or throw distinct error message if we can't

2 participants