My setup and use case
Hello all, I’m currently in a sticky situation - but I’m sure there’s a way.
Raspberry Pi OS Lite (my OS, running on a Pi 5) is based on Debian, and I’m using the stable
apt
version of packages - this means the package I require to install a VNC server for my Plasma DE (krfb
) is the old version that has a terrible bug that doesn’t allow using the keyboard over VNC - making the package practically useless…
I really want to use Plasma Mobile combined with VNC for Linux on-the-go use, combining the power of Linux and the convenience/low price of an Android tablet (used as a VNC client).
The updated, functional version is actually available, but currently unstable
(Debian Trixie), and it has so many dependencies it’s no use trying to force the .deb
file on the system (Debian -- Package Search Results -- krfb); it would mean shifting my whole system in the unstable
-zone.
Luckily, whilst scouring the Internet for solutions, I came across the nix
package manager, which has just what I need (couldn’t even find a version equal to or more recent than 23.04
, which is the one without the bug, but not requiring qt6
, and therefore the host of other unstable packages in Trixie on https://packages.debian.org, or as a matter of fact anywhere else).
My failed trials
I tried this:
libird@freeroam:~/Downloads $ nix-shell -p libsForQt5.krfb
[nix-shell:~/Downloads]$ krfb
qt.qpa.wayland: EGL not available
Initializing D-Bus connectivity with XDG Desktop Portal
DBus session created: "/org/freedesktop/portal/desktop/request/1_237/krfb4256852073"
kf.windowsystem: Could not find any platform plugin
Segmentation fault (core dumped)
[nix-shell:~/Downloads]$
Sadly, it seems as though the krfb
package contained inside the nixos
environment works entirely independently of the Deskop environment currently running on the system, which is normally used by krfb
, which doesn’t ‘spawn’ another one but instead simply reuses the display currently running and ‘forwards’ it to VNC: moving the cursor over VNC moves it on my monitor, and vice versa.
Here is what output of the command usually looks like (obviously here with the system installation the keyboard doesn’t work):
libird@freeroam:~/Downloads $ krfb
Initializing D-Bus connectivity with XDG Desktop Portal
DBus session created: "/org/freedesktop/portal/desktop/request/1_241/krfb3832625004"
Initializing Pipewire connectivity
Stream state changed: connecting
Stream state changed: paused
Stream format changed
Stream format changed
Stream state changed: streaming
Where the problem might lie
So something’s up with kf.windowsystem
and access to its ‘platform plugins’, which don’t allow Pipewire connectivity
to initialise. Doesn’t make much sense to me, but points the finger at an issue with a systemwide installation as opposed to nixos environment.
Help, I’m a noob at nix
!
Any ideas to get the nixos
environment to ‘interact’ / integrate with the whole system better for this specific use case? I was thinking / trying to run the command with sudo
or as root, but AFAIU nixos
isn’t designed / supposed to run that way. Besides, VNC servers are definitely not supposed to run as root but as the current user, like the following output demonstrates:
libird@freeroam:~/Downloads $ su
Password:
root@freeroam:/home/libird/Downloads# nix
nix nix-collect-garbage nix-env nix-prefetch-url
nix-build nix-copy-closure nix-hash nix-shell
nix-channel nix-daemon nix-instantiate nix-store
root@freeroam:/home/libird/Downloads# nix-
nix-build nix-copy-closure nix-hash nix-shell
nix-channel nix-daemon nix-instantiate nix-store
nix-collect-garbage nix-env nix-prefetch-url
root@freeroam:/home/libird/Downloads# nix-shell -p libsForQt5.krfb
[nix-shell:/home/libird/Downloads]# krfb
QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
kf.dbusaddons: DBus session bus not found. To circumvent this problem try the following command (with bash):
export $(dbus-launch)
[nix-shell:/home/libird/Downloads]#
Summing up my ‘brick wall’
When I ran nix-shell -p libsForQt5.krfb
for the first time, I noticed the command was installing a lot of KDE
-related packages, in fact, quite possibly an enitre DE separate from the one on my own system: in that case, no wonder the VNC server was failing, as the GUI of that KDE
environment wasn’t running! But as far as that’s concerned, two questions remain:
- How can I run a DE inside a
nix
environment (and perhaps have a way to access it overhttps
protocol, likeDocker
containers)? (After this I assume I’ll be able to successfully test VNC, complete with working keyboard - How can I get the program installed inside the
environment
to use my system’s display?
NB. the other included package krfb-virtualmonitor
that has a lot of customisation options right off the bat on the CLI isn’t really an option as its VNC server is only intended as a display (hence the term ‘monitor’), rather than a ‘remote controller’.
PS 
Thank you so much for making it through all of this, there’s loads to consider and my mind is in a bit of a mess right now but I tried to give all the details possible; don’t hesitate to respond and I will do my best to clarify / do some further testing!
Have a lovely day