Saturday, March 26, 2022

Kubuntu and USB audio devices

I've been setting up remote stations using USB devices but fucking Pulse Audio won't detect them correctly.

First, wipe out your pulse configuration files in .config/pulsle and volume/.config/pulse

Then edit /etc/pulse/default.pa and add the following lines, hw:1,0 is my USB card. You can see this using aplay -l


load-module module-alsa-source device=hw:1,0
.ifexists module-udev-detect.so

Reboot and have fun.

Kubuntu and VNC as a service

I've been setting up an old laptop so that I can use it with my new radio as a remote station.

Latest Kubuntu uses fucking useless Wayland so VNC doesn't work well. TightVNC fails to start up anything useful so forcing X11 is a necessity.

This is a good solution. Found it on Reddit.# install x11vnc

sudo apt install x11vnc


# set a VNC password. VNC security is lacking, so this is optional.

sudo x11vnc -storepasswd /etc/x11vnc.passwd


# follow the prompts to create a password and then lock down the password file.

sudo chmod 0400 /etc/x11vnc.passwd


# would be nice if there was an service created for x11vnc, but there isn't so create one.

sudo nano /etc/systemd/system/x11vnc.service


# paste the following text block into into /etc/systemd/system/x11vnc.service

# If you are NOT using a password, then remove this section: -rfbauth /etc/x11vnc.passwd

[Unit]
Description=Start x11vnc
After=multi-user.target display-manager.service

[Service]
Type=simple

ExecStart=/bin/sh -c '/usr/bin/x11vnc -display :0 -forever  -rfbport 5900 -xkb -noxrecord -noxfixes -noxdamage -nomodtweak -repeat -shared -norc -auth /var/run/sddm/* -rfbauth /etc/x11vnc.passwd'

# For KDE ONLY, include the "Restart" and "RestartSec" commands, otherwise you could just use "-loop" but that is busted since at least kubuntu 18.04
# This was added because logging out killed the x11vnc session even though "-loop -forever" was enabled.
# NOTE: In order to use this, make sure "-loop" switch is not used above!!
# NOTE: While vnc client will disconnect, at least the vncserver will restart itself to client can connect again.
Restart=always
RestartSec=1

ExecStop=/usr/bin/killall x11vnc

[Install]
WantedBy=multi-user.target


# reload systemd with the brand new x11vnc service file

sudo systemctl daemon-reload


# start x11vnc service so you can use it now

sudo systemctl start x11vnc


# enable x11vnc to start at boot so you can use it later

sudo systemctl enable x11vnc