Bug 250143 - net/tigervnc-server: errors on startup
Summary: net/tigervnc-server: errors on startup
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koichiro Iwao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-05 16:11 UTC by László Károlyi
Modified: 2020-11-11 22:34 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description László Károlyi 2020-10-05 16:11:52 UTC
Hello,

the new tigervnc-server is completely broken for me. Since the upgrade to 1.11.0, I can't start it.

I originally ran version 1.10 within a jail as an user, which I can't do now. When I try to start it as root with `vncsession <myusername> :1`, I get the following log message:

Oct  5 18:02:08 ksol vncsession[68599]: in openpam_parse_chain(): /usr/local/etc/pam.d/tigervnc(3): missing or invalid facility
Oct  5 18:02:08 ksol kernel: Oct  5 18:02:08 ksol vncsession[68599]: in openpam_parse_chain(): /usr/local/etc/pam.d/tigervnc(3): missing or invalid facility
Oct  5 18:02:08 ksol vncsession[68599]: pam_start failed: 4
Oct  5 18:02:08 ksol kernel: Oct  5 18:02:08 ksol vncsession[68599]: pam_start failed: 4

pam_selinux doesn't exist on unix boxes, and when I comment everything out, except for the pam_unix line that is actually existing, I get the following error message in my log:

Oct  5 17:58:35 ksol kernel: Oct  5 17:58:35 ksol vncsession[39275]: in openpam_dispatch(): /usr/lib/pam_unix.so.6: no pam_sm_open_session()
Comment 1 Konstantin Belousov freebsd_committer 2020-10-09 02:10:43 UTC
I am rather sure that 1.11 is non-functional on FreeBSD.
When trying to start vncsession, first I copied /etc/pam.d/login to
/usr/local/etc/pam.d/tigervnc.  Then, vncsession does the following:
  2162 vncsession CALL  open(0x402975,0x120004<O_RDONLY|O_NONBLOCK|O_DIRECTORY|O
_CLOEXEC>)
  2162 vncsession NAMI  "/proc/self/fd"
  2162 vncsession RET   open -1 errno 2 No such file or directory
after which it terminates with error 74 since /proc/self/fd cannot be opened.
It seems to be linuxism.
Comment 2 Koichiro Iwao freebsd_committer 2020-10-09 02:46:26 UTC
b(In reply to László Károlyi from comment #0)

I don't think at least it is COMPLETELY broken because Xvnc works. It's partially broken. vncsession is a PART of tigervnc-server. vncsession is not everything of TigerVNC and not the only way to use TigerVNC server.


However, that's true tigervnc-server is broken PARTIALLY. It needs to be addressed.

(In reply to Konstantin Belousov from comment #1)
Thanks for the investigation.
Comment 3 Konstantin Belousov freebsd_committer 2020-10-09 03:54:57 UTC
Ok, for me the working even if temporal solution appears to get
the vncserver perl script from tigervnc-1.10.1 and fix exedir.
Then I can just run `vncserver' and get session in the same way as with 1.10.
No need for root/pam/trying to understand linuxisms in vncsession.
Comment 4 Koichiro Iwao freebsd_committer 2020-10-09 05:11:59 UTC
(In reply to Konstantin Belousov from comment #3)

Thanks for the information. I'll consider add the vncserver script of former version to 1.11 port as quick workaround. Sorry for the breakage and inconvenience.

BTW, I thought changing `/proc/self/fd` to `/dev/fd` (fdescfs needs to be mounted) and tried. I got status=2 error. It looks some more hacks are needed to get bran-new vncsession work.

> Oct  9 12:42:40 icepick vncsession[38933]: vncsession: vncserver exited with status=2
Comment 5 László Károlyi 2020-10-26 12:42:33 UTC
Update:

https://github.com/TigerVNC/tigervnc/issues/1116

The tigervnc project seems to be unsupportive of FreeBSD.

I'll grab the old vnc startup script written in perl and see if it works with that.
Comment 6 László Károlyi 2020-10-26 15:27:26 UTC
(In reply to Koichiro Iwao from comment #4)
Hey Iwao,

I have a working vncserver perl script, could you please add the following to the package:

1. Download the original vncserver from https://raw.githubusercontent.com/TigerVNC/tigervnc/v1.10.1/unix/vncserver
2: Patch it with this:

=======
30c30
< $exedir = "/usr/local/bin/";
---
> $exedir = "";
529c529
<     if (!bind(S, sockaddr_in(6000 + $n, &INADDR_ANY))) {
---
>     if (!bind(S, pack('S n x12', $AF_INET, 6000 + $n))) {
537c537
<     if (!bind(S, sockaddr_in(5900 + $n, &INADDR_ANY))) {
---
>     if (!bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
=======

With these changes, the vncserver will start in usermode, within a jail.

The patch comes from a previously fixed problem from the perl script trying to bind differently on a BSD interface when probing for available ports, and failing:

https://forums.freebsd.org/threads/vnc-server-and-freebsd-7-2-jail.6142/

Best regards,
László
Comment 7 Koichiro Iwao freebsd_committer 2020-10-27 05:29:13 UTC
(In reply to László Károlyi from comment #6)
Yours is what I intended at comment #4.
Comment 8 László Károlyi 2020-10-27 16:53:43 UTC
(In reply to Koichiro Iwao from comment #7)
Awesome.

Can we get a release, then?
Comment 9 commit-hook freebsd_committer 2020-10-28 02:27:51 UTC
A commit references this bug:

Author: meta
Date: Wed Oct 28 02:27:12 UTC 2020
New revision: 553522
URL: https://svnweb.freebsd.org/changeset/ports/553522

Log:
  net/tigervnc-server: add vncserver script of the former version

  as workaround because bran-new vncsession script is not working on FreeBSD
  right now.  Thanks to kib@ and L?szl? K?rolyi!

  PR:		250143

Changes:
  head/net/tigervnc-server/Makefile
  head/net/tigervnc-server/files/vncserver.ports
  head/net/tigervnc-server/pkg-plist
Comment 10 László Károlyi 2020-10-28 10:35:59 UTC
(In reply to commit-hook from comment #9)
I tested the released vncserver script because the "$exedir = "/usr/local/bin/";" was missing there and I was worried the script wouldn't work.

It does work properly, thank you. I got my user run vncserver back.
Comment 11 Koichiro Iwao freebsd_committer 2020-10-29 04:11:45 UTC
If there's no problem, I'll ship it to quarterly.
Comment 12 Duane 2020-11-11 22:34:23 UTC
I just installed the tigervnc-server-1.11.0_1 and the vncserver script is identical to the one installed by tigervnc-server-1.11.0.