Replicate a foreign Subversion repository

If you want to replicate/mirror an existing repository which you do not own (i. e. svnadmin dump cannot be used), you can use the svnsync command.

At first: Create a new and empty destination repository on your server:

svnadmin create mirror

Next, create a so called “pre-revprop-change hook script”. This is needed for the subsequent steps.

nano /srv/subversion/mirror/hooks/pre-revprop-change
!/bin/sh
USER="$3"
if [ "$USER" = "yolo" ]; then exit 0; fi
echo "Only the syncuser user may change revision properties" >&2
exit 1

This limits the synchronizing mechanism to the specified user and is executed by Subversion automatically.

Now, initialize and perform the synchronization of the repositories:

svnsync init svn://YOUR_HOST/mirror/ SOURCE_REPOSITORY
svnsync sync svn://YOUR_HOST/mirror/

If the process comes to a halt, you can abort it using Ctrl+C and restart it without breaking anything. The process will continue were it was aborted (as everything is versioned this is not a problem).

For details: Chapter “Replication with svnsync” in the Subversion book.

Installing a Subversion server on CentOS 8

We are going to use the server “svnserve” which is contained in the subversion package of CentOS. This package contains also the svnadmin tool for creating a subversion repositories.

Installation

dnf install subversion

Service configuration

The default location for Subversion (SVN) repositories is /var/svn. We are going to change it to /srv/subversion like this (as root):

mkdir /srv/subversion
nano /etc/sysconfig/svnserve
OPTIONS="-r /srv/subversion"

By default, svnserve is executed as root – holy cow! For security reasons, we’re going to change it to a different user. We edit the systemd unit file and add the following lines under the section “[Service]”:

nano /usr/lib/systemd/system/svnserve.service
[Service]
User=yolo
Group=yolo

You can create the user e. g. with useradd -m yolo.

Make sure that our “yolo” user can access /srv/subversion properly:

chown -R yolo:yolo /srv/subversion

Furthermore, another change is necessary due to the new user which executes the service: The directory /run/svnserve/ contains a file where the service stores its process ID. But the directory is only accessible by the root owner. Changing the file permissions with chown is NOT a good solution because this folder will be recreated after reboot and thus the old permissions will be restored. We have to change the entry in the appropriate configuration file which is responsible for the recreation of this folder (see man tmpfiles.d for details):

nano /usr/lib/tmpfiles.d/svnserve.conf
D /run/svnserve 0700 yolo yolo -

Now, we can start the service (and enable it if you want to start it automatically):

systemctl start svnserve
systemctl status svnserve
systemctl enable svnserve

Create a test repository

Use our “yolo” user which also runs the svnserve process for the following commands:

cd /srv/subversion
svnadmin create repo1

Configure user authentication:

cd repo1
nano conf/svnserve.conf
anon-access = none # disallow anonymous access completely
password-db = passwd # file with credetials

Add some credetials:

nano conf/passwd
user = pw

Check it out

The repository set-up is complete. Now, we should be able to check it out with a Subversion client on a remote computer:

svn co svn://HOST/repo1 --username USER

Surveillance cam HWI-B140H-M (HIKVISION HiWatch Series)

I recently bought the HWI-B140H-M from HIKVISION in order to test it on Linux. But the results were quite disappointing:

  • You can access the cam via browser but for some features (e. g. configuring areas for motion detection) you need either their windows client software (iVMS) or you need an old browser (Chrome 44.x, Firefox 51.x or lower) with browser plugins. Fun fact: They don’t tell you which plugins are meant. So without windows, you have a hard time.
  • Interestingly enough, the manual says that when the WebSocket function is activated, you could use all features in your current browser without plugins (which contradicts the information at the beginning). But there is no such function (in the windows client not either) although the most recent firmware is installed.
  • I updated the firmware to the most recent version (V5.5.80 build 180911) using the windows client in a VirtualBox Windows VM. After the update, I could not access the web interface anymore. It turned out, that they are blocking my browser’s user-agent ID. How dare you! With the Firefox addon user-agent switcher and manager and an IE 11 user-agent the web interface is accessible again.
  • My FritzBox router has a NAS function. So i set up a Samba (SMB) share and finally configured it in the web interface of the cam. It worked but the cam showed the Samba device as “uninitialized”. The cam’s manual instructs you to click on “Format” to solve this but it did not work. I tried several configurations, tested the Samba share on nautilus but I always got an error (permission blabla). Some folks had the same trouble in 2014 (cctvforum.com). No working solution, so I gave it up.
  • The user manual of the cam is the worst manual I’ve ever seen. It contains contradicting informations (see above) and many sections only apply to a certain device but the don’t mention the device. Furthermore, it’s more a listing of features than explaining hands-on how to configure the device properly. “Here are the information, deal with it”.

My advice: Don’t buy it.

Setting up dnf on Mageia 7

As you can see with dnf repolist, only the core repository and the update repository are activated on Mageia 7 by default.

The repositories nonfree and tainted are pre-configured in configuration files within /etc/yum.repos.d/ but disabled by default. You can easily activate them by executing the following command:

# dnf config-manager --set-enabled mageia-x86_64-nonfree updates-x86_64-nonfree mageia-x86_64-tainted updates-x86_64-tainted

That’s it. Now, when you try to install a package or upgrade the system, the nonfree and the tainted repository are considered as well.

Watching maxdome video streams on Linux

Edit: Currently (about two month later), it does not seem to work anymore =(

It worked on my machine with a Firefox 60.9.0esr. But at first, there were two things that hindered the playback:

  • The Ad-Blocker – I had to disable it.
  • The user agent setting of Firefox has to be something like “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3835.0 Safari/537.36”. This can easily be achieved with the Firefox addon User-Agent Switcher and Manager.

You also have to make sure, that the Firefox Addon “Widevine Content Decryption Module provided by Google Inc.” is installed and activated (see Watch DRM content on Firefox).

In my opinion, it is pretty silly that you have to fake your user agent in order to watch the movies. But according to the customer support this is done on purpose:

Da wir Linux nicht unterstützen ist ein funktionierender Abruf über die entsprechenden Systeme nicht vorgesehen.

Reply from the “maxdome Kundenservice” on my inquiry (December 8th, 2019)

*facepalm*

DVD playback issues in Totem and VLC solved with mplayer

The default video player on my Gnome desktop (Mageia 6) is totem. It did not play the DVD yesterday that I wanted to watch. Fortunately, VLC did start the playback when I checked the option “No disc menus” under “Media | Open Disc”. Though I had to manually select the correct video under “Playback | title” (it was the last element on the list). It worked for the first 30-40 minutes but then the playback stopped and the error message indicated that the next blocks/sectors of the DVD could not be read. Surprisingly, the issue was reproducible yesterday but not today.

The workaround was to use mplayer which has only a commandline interface:

mplayer dvd://12

12 is the number of the corresponding title which I chose in VLC. It worked flawlessly. Important hotkeys to control the playback (consider the man page for mplayer for all hotkeys):


f: Fullscreen toggle
space: Start/Stop playback
o: Onscreen information toggle
arrows: Jump forward/backward (small steps)
page up/down: Jump 10 minutes forward/backward
v: Enable/Disable subtitles
Esc: Quit mplayer

Removing Wolfram stuff from RaspberryPi’s NOOBS system

Identify the packages:

$ dpkg -l | grep "wolfram"
ii  wolfram-engine                        11.3.0+2018052403                    armhf        Mathematica® and the Wolfram Language
ii  wolframscript                         1.2.0-18                             armhf        WolframScript (for the Command Line)

Remove the packages:

# apt remove wolfram-engine wolframscript
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  coinor-libipopt1v5 libexiv2-14 libgmime-2.6-0 libmumps-seq-4.10.0 libraw15 lxkeymap python-cairo
  python-gobject python-gobject-2 python-gtk2 python-xklavier realpath
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  wolfram-engine wolframscript
0 upgraded, 0 newly installed, 2 to remove and 16 not upgraded.
After this operation, 833 MB disk space will be freed.
Do you want to continue? [Y/n] Y

Remove anything unneeded:

# apt auto-remove

Download partial content

You want to download a video stream but in your browser you only see several GET requests which point to resources of type “mp2t” (and maybe have a “.ts” ending) and the status code is “206 Partial Content”?

Try this:

  1. Copy one of the URLs which are pointing to the partial content.
  2. Copy the URL to the address bar of your browser and hit return and download the file.

P. S. I’m experiencing slightly crackling audio tracks when the clips are short (length of approx. one minute). I don’t know what to do about it.

npm Error: EACCES: permission denied, access ‘/usr/lib/node_modules’

You try to install a package with npm globally and you get this? npm install –global …

npm ERR! Linux 4.14.78-desktop-1.mga6
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--global" "web-ext"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

Cause: Your user does not have write permission to the folder ‘/usr/lib/node_modules’.

Clean Solution: Relocate the the folder where npm stores globally installed packages to some folder in your home directory:

mkdir ~/.nodejs_global
npm config set prefix ~/.nodejs_global

And now you can run npm install -g … =)

Installing a new Ubuntu version from scratch without any effort

Scenario: You have an existing Ubuntu installation and you want to install a newer version (e. g. Ubuntu 18.04) from scratch, i. e. drop the old installation completely and install the new version in place.

The trick/precondition which makes the installation effortless: On the current system, you already have your “/home” directory and your “/” (root) directory on different partitions. Then you can drop the old Ubuntu installation on the root partition and install the new Ubuntu version on this partition and the home partition can simply be adopted. If you don’t have your root directory and your home directory on different partitions, make a backup of your home folder and restore it later.

Prerequisites

  1. Important: Backup important data first!
  2. Download the latest Ubuntu release here: https://www.ubuntu.com/download/desktop

Let’s go: Create a bootable pen drive

Write the downloaded Ubuntu ISO file to a pen drive using dd (existing data on the pen drive will be lost after this process). First: Make sure that the pen drive is NOT mounted. Then: Open a terminal and login as root and call dd:

$ sudo su

# dd bs=50M if=/home/YOUR_NAME/Downloads/ubuntu-18.04.1-desktop-amd64.iso of=/dev/sdX && sync

Please change the path after “if=” to the path where the downloaded ISO file actually lies and change the path after “of=” to the device which represents your pen drive. You can use “lsblk” or “df -h” on the terminal to view your devices and spot your pen drive. It is really important to identify the correct device name as dd will overwrite existing partitions which can result in data loss if you aren’t cautious!

The installation

Now you have to boot from the newly created Ubuntu pen drive. Reboot your machine and select the pen drive as boot drive and boot from the pen drive. This step is a bit tricky (but not too hard) and differs from hardware to hardware. On Acer notebooks, you can try hitting F12 or F2 as described in this article.

When the pen drive is booted, you can follow the installation wizard most of the time. When it comes to partitioning: If you already have a separate “/” (root) and “/home” partition: Configure the old root partition as new root partition and check the format checkbox. Configure the old home partition as new home partition (do NOT check the format checkbox this time).

If you are asked whether to install proprietary software: choose NO. The proprietary things can mess up the whole system (at least this is what I experienced in the past).

When the installation is done: Confirm to reboot the machine and remove the pen drive when instructed.

Post-installation actions

Update the system

$ sudo su
# apt-get update
# apt-get upgrade

Install the multimedia codecs

$ sudo su
# apt-get install ubuntu-restricted-extras

Install support for encrypted DVDs

So as to play encrypted DVDs you have to install the package libdvdcss2 which is not in the official repositories. That’s why you have to add a new repository to your “/etc/apt/sources.list”. Just add the following line:

deb https://download.videolan.org/pub/debian/stable/ /

Then run:

$ wget -O - https://download.videolan.org/pub/debian/videolan-apt.asc | sudo apt-key add -

…and finally install the package:

# apt-get update
# apt-get install libdvdcss2

If you still cannot watch DVDs, try to disable the DVD menu in VLC media player: “Media | Open Media (Ctrl+D)” and check “No disc menu” and click on “Playback”.

Hints: http://www.videolan.org/developers/libdvdcss.html

Remove Amazon app

Open Ubuntu Software Center, go to tab “Installed” and click on remove next to the Amazon app.

Enabling the touchpad of your notebook

If your touchpad does not work out of the box then go to “System settings | Devices” and enable your touchpad.

Install your favourite software

apt-get install clementine keepass vlc zim...