pdftk and php-pdftk on Ubuntu 18.04 without using snap

During a product launch I recently came across an “interesting” issue involving pdftk (and php-pdftk). Some of the developers had made assumptions (ever heard that one before?) about the operating environment and how things were/are configured.

These assumptions were based on a development environment that in no way reflected the final production environment (ever heard that one before?). In this particular case, they were expecting the great PDF toolkit (pdftk) to be available and working just like it did in their development environment.

To summarize the issue: pdftk has been removed from Ubuntu 18.04 due to dependency issues. The “recommended” solution is to install pdftk using snap. This, in itself, is not a bad recommendation. But in a web server environment, it may put you in a place you don’t want to be in.

So after a few hours of toying with ideas and testing various things, I figured there must be some Debian-like package that would actually work when installed on Ubuntu 18.04 and that is not a snap package.

There is.

Later versions (or packages) of pdftk now exist as pdftk-java, and they do work with php-pdftk as well.

In my case, I located pdftk-java_3.1.1-1_all.deb and installed it. Or tried to rather. It has a number of dependencies that you will see for yourself. You’ll need to decide if their “weight” makes it worthwhile for you to go down this path. But it was one, reasonably good, way for us to solve the problem.

The developers you ask? They have been sent to /dev/codersgulag/cobol and will spend a number of solar iterations there.

(The file I ended up using was http://ftp.debian.org/debian/pool/main/p/pdftk-java/pdftk-java_3.1.1-1_all.deb, and it does work on Ubuntu 18.04.LTS)



Disable Gravatar lookup in Jitsi Meet

Jitsi Meet is a wonderful open source video conferencing platform. Most things can be tweaked and configure to your needs.

If it’s important to you, that Jitsi Meet does not make external requests to third-party services like Gravatar, etc, you can change your xxx-config.js file in /etc/jitsi/meet like so:

disableThirdPartyRequests: true,

Credits: www.kuketz-blog.de/jitsi-meet-externe-verbindung-zu-gravatar-com/

NCweb, serve static website content from Nextcloud

NCweb is a reasonably small (ish) PHP “application” that will allow you to expose a given folder of a Nextcloud instance and serve documents from it as if it would have been a regular website. The folder does not have to be shared in Nextcloud. You can serve .html (HTML) or .md (Markdown) files. NCweb can be configured to render Markdown files to HTML.

Get it from Github here: github.com/joho1968/NCweb

SJ: Res inte med oss, vi ställer ändå in ditt tåg

Boka biljetter med SJ, för att det är vettigt att resa med tåg istället för onödiga resor med bil, när det går.

SJ hör av sig och säger att delar av resan är inställd.

Boka nya biljetter med SJ, för att det är vettigt att resa med tåg istället för onödiga resor med bil, när det går. För delar av resan finns nu ingen luftkonditionering.

SJ hör av sig efter ytterligare en dag och säger att delar av resan är inställd.

Ändra planer, “stuva om i kalendern” och boka nya biljetter med SJ, för att det är vettigt att resa med tåg istället för onödiga resor med bil, när det går.

SJ hör av sig efter ytterligare en dag och säger att delar av resan är inställd, antalet resenärer är för få.

Man kan “få tillbaka pengar” i form av tillgodohavande hos SJ, för när man vill resa i framtiden. SJ påpekar också att man kan boka om resan. Igen.

Man kan också ringa till SJ:s kundtjänst och sitta två timmar (!) i telefonkö. De har så mycket att göra och tydligen går det inte att anställa fler kundtjänstmedarbetare.

Så jag bokar tre biljetter med Nettbuss istället, till en lägre kostnad, med breda säten, WiFi (som fungerar), luftkonditionering och möjlighet att ladda mobilen vid sätet. Resan har dessutom inga byten.

Påminn mig igen, snälla, varför jag skall överväga SJ när jag eller anhöriga skall resa i Sverige? Om man, som samhälle, vill att människor skall åka buss, tåg eller annan form av kollektivtrafik så skulle det kunna vara en bra idé att se till att den är pålitlig.

Installing the correct Intel NIC driver for Windows PE and a bare-metal restore situation

When disaster strikes, a real bare-metal restore bootable USB drive may be your only rescue. And most decent manufacturers of NAS and SAN (Synology in this case) units will have some sort of “bootable media creation tool” available for you. These typically create a minimal bootable environment, from which you bootstrap the computer and then load the bare-metal restore data from a NAS or a SAN.

One issue you may encounter is actually finding the correct network card (NIC) driver so that your about-to-be-restored computer can actually talk to the rest of the world, or at least to the rest of your world. This is painfully obvious in Windows and Windows PE environments.

I recently ran into such a case and thought “How hard could it be to just check the motherboard manufacturer information, find the exact name of the NIC, and then download the driver from the web?” Well, it turns out this can get quite messy for a number of reasons.

In many cases, the operating system will know where to find NIC drivers, and which one to load for a given hardware setup. When you need to manually choose from a list of tens or hundreds of adapters, it not so much fun anymore.

Having checked the web for “Intel I219-V” wasn’t all that exciting, and downloading a “driver package for Windows 10 x64” from Intel wasn’t much better. But Intel does include, in my case, some useful software in their downloads. Most executables in the Intel driver package cannot be executed from within Windows PE. But one, really useful tool, turned out to be SetupBD.exe. It’s located in \APPS\SETUP\SETUPBD in the (executable) archive, and it can run in the Windows PE environment.

Suprisingly enough, all I had to do to get the proper driver loaded was to run SETUPBD.EXE from the CLI, and it proceeded to load the correct driver. My bare-metal Windows PE environment could now talk to the NAS and the bare-metal restore could begin.

(I had previously extracted the contents of the PROWinxt64.exe file to \INTEL on the bootable USB drive. So the actual location of SetupBD.exe in my case was \INTEL\APPS\SETUP\SETUPBD.)

Image credit: www.pngflow.com

Tranquility Base #COVID19

Walking around the natural reserve “Judarnskogen” (located in Bromma, Stockholm, Sweden) is a great way to decompose and unwind, specially during these weird times. Lucky, and thankful, to have this close to where I live.

Nextcloud and WebDAV “SEARCH” requests

Using WebDAV to access Nextcloud resources is a pretty nice way to write integrations for Nextcloud. While adding support for Nextcloud file browsing in a service we’re constantly improving, I ran into a minor snag: How to format the WebDAV “SEARCH” request when interfacing with Nextcloud.

1. The example in the official documentation is correct. You just have to read it carefully. In particular, pay attention to this:

Search requests can be made by sending a SEARCH http request to https://cloud.example.com/remote.php/dav/ with a content type of text/xml and the query as xml in the request body.

2. Make sure you structure your XML data properly, in particular, you need to make sure you include a d:prop of which “field” you want your search data to be applied to.

<d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">

This would search for files beginning with Nextcloud and return fileid, displayname, and the content type; the search will be made in the folders that testuser has access to.

And that’s that.


Webmin, Virtualmin and APT for Ubuntu and Debian

I often use Webmin and Virtualmin to manage basic stuff on Linux servers, mostly so because others sometime need to change minor settings on these servers, and they may or may not be very familiar with doing things from the CLI.

You can, of course, update Webmin and Virtualmin manually, from within Webmin. But if you’re using APT, there is an automated, better, way of keeping these lovely software packages up to date.


Create a file in /etc/apt/sources.list.d/ like webmin.list

Add the following line to that file:

deb https://download.webmin.com/download/repository sarge contrib

Add Jamie Cameron’s GPG key for the repository like so:

cd /root
wget https://download.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc

Finalize everything with

apt-get install apt-transport-https
apt-get update

You may now install/update Webmin with via APT (apt-get, aptitude, etc).


Create a file in /etc/apt/sources.list.d/ like virtualmin.list

For Ubuntu 18.04.LTS (“Xenial”), add the following to that file:

deb http://software.virtualmin.com/vm/6/gpl/apt virtualmin-xenial main
deb http://software.virtualmin.com/vm/6/gpl/apt virtualmin-universal main

There are, of course, sources available for other distributions too. Simply replace xenial above, with the name of the distribution you’re running. You can find a list of the Debian based distributions here: software.virtualmin.com/vm/6/gpl/apt/dists/

Add the virtualmin GPG key for the repository like so:

cd /root
wget http://software.virtualmin.com/lib/RPM-GPG-KEY-virtualmin-6
apt-key add RPM-GPG-KEY-virtualmin-6

Finalize everything with

apt-get update

You may now install/update Virtualmin via APT (apt-get, aptitude, etc). You can find some more information about this in relation to Virtualmin on the Virtualmin forum.