Mounting CIFS (formerly Samba) volumes via fstab on Alpine Linux

For my local development environment, I store all my code on my Windows 10 PC. The web servers and everything else then runs inside Linux Virtual Boxes. The Virtual Box shared folders feature has a lot of problems, so I mount the directories using CIFS, which as formerly called Samba.

Naturally, I wanted the same setup I had for my old Ubuntu boxes in Alpine. The setup was, as usual, not as straightforward as I had hoped. First, I installed the cifs-utils. This may or may not be necessary.

apk add cifs-utils

Then, I simply copied over the entry for /etc/fstab from the Ubuntu Box.

//    /mnt/www    cifs    uid=0,gid=0,user=janhapke,password=*****

In Ubuntu, this has been working fine for years and over several versions. On Alpine, I got an error message.

mount: can't find /mnt/www/ in /etc/fstab

Strangely enough, mounting directly from the command line worked, so CIFS was properly installed and the machines could talk to each other.

It turns out, Alpine parses the fstab a little more strictly than Ubuntu and absolutely needs 6 options per line whereas Ubuntu is OK with just 4. So to fix this, I just had to add the last 2 entries (for dump & pass, respectively).

//    /mnt/www    cifs    uid=0,gid=0,user=janhapke,password=***** 0 0

Great, now I could easily mount the directory on Alpine with a simple mount /mnt/www

Until I rebooted the machine. I always poweroff the VMs when I don’t use them because like shared folders, suspending them doesn’t really work so well in Virtual Box. The problem is, it now tried to mount the folders on boot, before the network was even available. This resulted in a lot of error messages during the boot process.

mount error(101): Network unreachable
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount: mounting // on /mnt/www failed: Network unreachable
 * Some local filesystem failed to mount
 * ERROR: localmount failed to start

This was then followed by even more error messages about system services that cannot start because not everything could be mounted. It was possible to log in, but the system was not really properly configured (e.g. keymap ws incorrect).

The fix was again adding the right thing to /etc/fstab, namely appending the option _netdev to the mount options (which again was not necessary on Ubuntu).

//    /mnt/www    cifs    uid=0,gid=0,user=janhapke,password=*****,_netdev 0 0

This option tells Alpine Linux to only mount this directory after the network is available. With this entry, the VM can now finally mount files from the Windows Host machine.

Installing Docker (Daemon) on Alpine Linux

I’m thinking about overhauling the infrastructure behind this site (and others) a bit and want to place as many services as possible into Docker containers that can then run inside a small Virtual Machine on Amazon EC2. So I started playing around with some Virtual Machines locally and since Ubuntu would be too boring, I decided to give Alpine Linux a try. It promises to be really lightweight so that seams ideal as a container host running inside a VM.

After finally figuring out how to install Alpine (which is another story), installing Docker was relatively straightforward based on their Wiki:

  1. Add the Community Repository to the APK Repositories file:
    ~# vim /etc/apk/repositories

    Add the following line:

    Or, if you are using a mirror, use the URL of the mirror, in my case:
  2. Update the list of available software:
    ~# apk update
  3. Install Docker:
    ~# apk add docker
  4. Configure docker daemon to start automatically on boot:
    ~# rc-update add docker boot
  5. Start the docker daemon:
    ~# service docker start
  6. Verify it’s running:
    ~# docker ps

    Output should look like this:


Great, now I have a running Docker Daemon. Time to build a simple container. I quickly created a very short Dockerfile and ran docker build. After downloading some layers, it failed with a very cryptic error message:

failed to register layer: ApplyLayer exit status 1 stdout:  stderr: chmod /bin/mount: permission denied

Searching for this message on Google lead me down many rabbit holes, but ultimately it takes only a single command to make it go away:

sysctl -w kernel.grsecurity.chroot_deny_chmod=0

This disables a security feature inside the Kernel, so it might not be safe for a production environment that runs containers but I think it’s acceptable for the machine that merely builds them.

The 5 Day Black and White Challenge

My old friend Thomas Hendele recently nominated me for the 5 Day Black and White Challenge, a thing on Facebook where, after being nominated, you have to post 5 different black and white photos over the course of 5 days. I thought I’d share my entries on the blog as well, for everybody who doesn’t use Facebook.

1. Dom Sculpture

Dom Sculpture

I still had some photos on Disk that I hadn’t gotten around to posting on my Cologne Photoblog before I shut it down, so I processed one of those.

2. The Sun behind Hallgrimskirkja

The Sun behind Hallgrimskirkja

A moody shot from one of my first days in Iceland in 2013.

3. Gdansk Airport

Airport Gdansk

Abstract Architectural photo of the roof construction at Lech Walesa Airport in Gdansk, Poland

4. Breitling Jet Team

Breitling Jet Team

They had some pretty amazing aerobatics displays between runs at the 2014 Red Bull Air Race in Gdynia

5. Speicherstadt Schwarzweiss

Speicherstadt Schwarzweiss

For the grand finale, I actually went out into the cold to capture a new photo of my new home, the wonderful city of Hamburg.

I hope you enjoyed and if you like, you can find me on Facebook under my real name: Jan Hapke.

Close your Eyes and Jump

A few of the major tourist attractions in Dubai are the shopping malls, among them the Dubai Mall. It happens to be the largest shopping mall in the world and it is located right next to the tallest building in the world, the Burj Khalifa. After walking around in the Dubai Mall for about half a day, I came to a corner with a huge fountain that resembled a waterfall. Installed on the waterfall were actual size metal sculptures of men flying down the waterfall. The entire installation spanned from the mall’s basement to the roof, I think about 4 or 5 floors total.
I walked around a lot on all the different levels, looking for a good angle to take a photo and trying many different compositions. Since it was 9 in the morning, not many people were around and the sun was shining through the glass roof at a perfect angle. In total, I spent half an hour here and took 42 photos.

Close your Eyes and Jump

And it wasn’t easy to choose the best one among them, but I ultimately picked the 15th photo I took. The fact that the scene was almost black and white in reality and that the top left corner could be made entirely black greatly simplified the post processing. I am so happy with the result that I got it printed on canvas and put it up on my wall. Now I look at it every morning when I wake up.

P.S.: The title came from a song that was playing as part of a mix I was listening to while processing the photo: Chuckie feat. Maiday – Skydive