Category Archives: Ubuntu

woman draw a light bulb in white board

Finally Solved – Nextcloud SMB Not Working on Ubuntu 20.04

After banging my head against this problem from a different server, as WSL is not there yet for running as personal production services, I finally managed to hit the right keywords to google fu the answer. php-smbclient has been dropped from the officially repositories and so can only be installed via a PPA.

Installing using the following commands finally sorted it for me, credit to Markus (linked below for this solution)

echo "deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/php.list
apt-key adv --recv-keys --keyserver hkps:// 4F4EA0AAE5267A6C        
apt-get update && apt-get install php-smbclient
phpenmod smbclient
service apache2 restart

FIXED: Varnish Caching Proxy Expected an action, ‘if’, ‘{‘ or ‘}’

So it seems Varnish 4.0 and 4.1 (more may be affected this is the limit of my testing presently) has a bug where some whitespace can through it from recognising valid configuration such as below
# ACLs to control who can access this caching proxy server
acl local {
""/8; /* loopback range */
""/29; /* local network range */
""/8; /* For testing on own hown network - REMOVE FOR PRODUCTION */

# Urls to cache
# /api/3.0/artists/
# /api/3.0/venues/

sub vcl_recv {
# Happens before we check if we have this in cache already.
# Typically you clean up the request here, removing cookies you don’t need,
# rewriting the request, etc.

if (client.ip !~ local ) {
{error 403 “Access denied”;}
return (lookup);

# We only want to cache GET request
if (req.request == “GET”) {


This was due to a bad code merge cited here

You can resolve this by manually removing the whitespace by using the command below

cat default-withWhiteSpace.vcl | tr -d " \t\n\r" > default.vcl

Solution: libpam-radius-auth: Sends out as NAS-IP-Address


When authentication linux to radius using libpam-radius-auth: Sends out as NAS-IP-Address


/etc/hosts file contains the local machine’s hostname with


Either remove the offending line, or before this line place the correct ip address with the hostname (note that order is important). computerName computerName

[FIXED] Errors were encountered while processing: /var/cache/apt/archives/vim-runtime_2%3a7.4.052-1ubuntu3_all.deb

Problem: vim install fails during dist-upgrade and running sudo apt-get -f install gives the error below
syslog:/var/syslog-ng/wcs$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
The following packages will be upgraded:
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
44 not fully installed or removed.
Need to get 0 B/4,888 kB of archives.
After this operation, 412 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 64153 files and directories currently installed.)
Preparing to unpack .../vim-runtime_2%3a7.4.052-1ubuntu3_all.deb ...
Leaving 'diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime'
dpkg-divert: error: rename involves overwriting `/usr/share/vim/vim74/doc/tags.vim-tiny' with
different file `/usr/share/vim/vim74/doc/tags', not allowed
dpkg: error processing archive /var/cache/apt/archives/vim-runtime_2%3a7.4.052-1ubuntu3_all.deb (--unpack):
subprocess new pre-installation script returned error exit status 2
Processing /usr/share/vim/addons/doc
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)


All of the issues seemed to be down to the doc folder, nuking it meant that the install completed successfully
sudo rm -fR /usr/share/vim/vim74/doc/

Cleaning Up Linux Headers

Make sure you’ve rebooted BEFORE running any of these commands so that you are actively using the latest kernel.

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

If you’ve had a previous apt-get install fail due to disk space issues and you’re trying to clean up the linux headers to free disk space run the below command which will force the purge
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y -f purge

Fixed: LXDE-core startlxde gives Gtk-WARNING **: cannot open display: error message

I’d be tasked with installing a GUI on a server for someone else to use. I opted for LXDE as it’s so lightweight and I just wanted the core, no extra gumph. I ran into an issue launching lxde once I’d installed it. Here’s how I fixed it:

Installed LXDE Core
sudo apt-get install lxde-core

I then went to try startx, how I’d normally start a shell if I’d installed gnome or such, startx didn’t exist, so I tired startlxde. It came back with the error “Gtk-WARNING **: cannot open display:
After a bit of searching online I found some people were saying about .xinitrc, but I didn’t have an xinit…. neither did it seem that I had xinit. So I tried the following with instant success

The Fix

Install xinit
sudo apt-get install xinit

Start X

How to clean up after removing a package via apt-get

Say you install a package via apt-get like lubuntu-desktop. There’s a ton of dependencies and apps that get installed because of one simple meta-package install.
If you remove lubuntu-desktop only a small amount of that gets removed. I wanted to dejunk a server and so used the following commands to check what else was installed and to remove them all.

Look at the dependencies to make sure those are what you want to remove
sudo apt-cache depends lubuntu-desktop
Remove these dependencies
sudo apt-cache depends lubuntu-desktop | awk 'NF && /Depends:/ {print "sudo apt-get -y remove "$2}' | sh
Clean up the related dependencies
sudo apt-get autoremove