Install Docker and docker-compose on Raspberry Pi

Installing Docker requires adding the a repository with the updated version:

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https \
                 ca-certificates \
                 software-properties-common \
curl -fsSL | sudo apt-key add -
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo nano /etc/apt/sources.list

Add the line:

deb debian-stretch main

changing ‘stretch‘ with your version of Raspbian. You can check your version using lsb_release -cs.

sudo apt update
curl -sSL | sh
sudo usermod -aG docker pi
sudo reboot

For docker-compose, first we will need to install Berry Conda:

chmod +x
sudo reboot

And then install docker-compose using pip:

pip install docker-compose
sudo reboot

Installing Powerline in Ubuntu 18.04

Powerline is a “statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, fish, tmux, IPython, Awesome, i3 and Qtile”. It looks this cool (this is the most simply form):

Poweline for Bash

In combination with ZSH, it becomes an extremely powerful -and beautiful- tool.

To quickly install just Powerline for the bash:

sudo apt install powerline powerline-fonts

Add the following at the end of ~/.bashrc:

# Powerline
if [ -f /usr/share/powerline/bindings/bash/ ]; then
  powerline-daemon -q
  source /usr/share/powerline/bindings/bash/

Sorting the fonts:

mkdir -p ~/.fonts
wget -O ~/.fonts/Liberation\ Mono\ Powerline.ttf
wget -O ~/.fonts/Liberation\ Mono\ Powerline\ Bold.ttf
wget -O ~/.fonts/Liberation\ Mono\ Powerline\ Italic.ttf
wget -O ~/.fonts/Liberation\ Mono\ Powerline\ Bold\ Italic.ttf
fc-cache -vf ~/.fonts

Now, reload the terminal:

source ~/.bashrc


Column-navigation file manager

If you want a file manager with column navigation (macOS-alike) in linux, Pantheon File Manager is probably the best option. Pantheon File Manager is part of the Pantheon desktop, developed for elementary OS using Vala and the GTK3 toolkit. In Ubuntu and derivatives (e.g. Linux Mint) it’s as easy to install as:

sudo add-apt-repository ppa:elementary-os/stable
sudo apt update
sudo apt install pantheon-files

Done! You just need to search the app called ‘Files’ to launch it. It also displays a message asking if you want to make it the default file browser.

Dealing with PPA and GPG problems in Ubuntu and derivatives

PPAs are extremely useful, making installing and maintaining apps in Ubuntu and derivatives (such as Linux Mint) extremely easy. However, upgrading the system or problems/changes in the maintainer of the PPA can turn things into a pain the neck. Y PPA Manager is a tool from Web UPD8 designed specifically to keep all this under control in a easy way.

Some of the functions are:

  • List the packages available in a PPA added on your system
  • Download packages from PPAs without adding them
  • PPAs backup / restore, along with all the PPA keys
  • Update single repositories using a command line tool (by the way, when you add a PPA using Y PPA Manager, it’s updated without updating all the software sources) called “update-ppa” – usage example: “sudo update-ppa ppa:webupd8team/java”
  • Some options that should help you re-enable the working PPAs when upgrading to a newer Ubuntu / Linux Mint version
  • Remove duplicate PPAs
  • Unity quicklists / optional AppIndicator

Installing Y PPA Manager is as easy as copy and pasting the next lines:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt update
sudo apt install y-ppa-manager

If you are having problems with expired GPG keys:

We know that feeling. The maintainer of a repository changes something and suddenly we start having problems with the GPG Keys. In my case, this happens -too frequently, under my point of view- with QGIS. Luckily we can fix invalid GPG keys with a single-line command:

sudo apt-key list | \
 grep "expired: " | \
 sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
 xargs -n1 sudo apt-key adv --keyserver hkp:// --recv-keys

Command explanation:

  • sudo apt-key list Lists all keys installed in the system.
  • grep “expired: “ Leaves only lines with expired keys.
  • sed -ne ‘s|pub .*/\([^ ]*\) .*|\1|gp’ Extracts keys.
  • xargs -n1 sudo apt-key adv –keyserver hkp:// –recv-keys Updates the expired keys with those found in the Ubuntu key server.


Fix and prevent Windows continuously changing UEFI order

Having a dual-boot machine with Windows 8 or Windows 10 and Linux is frustrating, because Windows changes continuously the UEFI booting order, thus preventing GRUB to load. This usually happens after an update.

This command executed from Windows’ Command Prompt (as an administrator) seems to fix the problem for Ubuntu and derivatives:

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

For other distros, you will need to identify first which .efi file is needed to boot. More information about the commands available for bcdedit is available in the Window’s IT center‘s website.

Command line, human-readable, disk usage analyser

It happens continuously. We have a server with no graphical interface, and our disk quota is gone in God knows what.

We could use different commands to identify the source of the problem, roll perception checks, roll will checks… Or we can use NCurses Disk Usage. Beautifully simple, it fulfils more than correctly this task.

Easy to install:

sudo apt install ncdu

And easy to use:


Piece of cake.

UEFI and Linux

The UEFI (Unified Extensible Firmware Interface) is an example of a good idea developed, enforced, and implemented in the wrong way. What was meant to help us protecting our computer, turned into some kind of kidnapper that prevented us to use the OS of our choice.

Installing a different OS to the provided by the manufacturer is a, sometimes impossible, sometimes painful, task. Some manufacturers simply don’t contemplate the use of anything different from Windows 8 or 10 in their machines (ajem, HP, ajem), forcing us to press the Boot-order-selection key during the booting of OUR devices in order to being able to start, let’s say, Linux. Every single time. I repeat. Every. Single. Time. And it’s curious how, no matter which procedure you use, and how many times you change the UEFI boot order, Windows always comes to the top.

Although I have not been able to fix this problem in my HP machine (well, I know the solution, not buying HP products anymore), I successfully managed to fix it in 2 Lenovo machines. The procedure is quite easy -but use it under your own responsibility. Presuming that Linux has been installed in UEFI mode correctly (there are different methods to check this, but the easiest is to check if you have a boot/efi folder using the command df -h –local | grep /boot), you just need to install boot-repair:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt update
sudo apt install boot-repair

Just the quick setup should do the magic. However, in my experience, it was not so easy, and the machine was still booting into Windows. I had to boot into Windows and execute the following command in the command line with administrative privileges:

bcdedit /set {bootmgr} path \EFI\ubuntu\shim64.efi

That seems to work in the Lenovo machines, but not for HP (such a surprise).

The easiest way to work with a remote server

For many reasons, you can find yourself working with a server where many and constant changes need to be done. This usually implies doing a modification to a file, uploading it, testing it, modifying something again, uploading, and repeating.

There’s many different approaches to manage this routine.

The 1st option is editing from the terminal. This is not bad, as Vim, Nano (I previously wrote how to activate markdown in Nano), and other command line editors are powerful options and allow us to fulfill most of the tasks. However, it can be a headache editing several files, not being able to use the mouse’s scroll wheel (that is there to be used!), or the beautify plugin.

Another option that works perfectly fine requires the creation of Grunt tasks. However, we could lack a little bit of flexibility if we do many different tasks. Also, we still need to spend some extra time creating connections and uploading the files.

We could also install a X server and access through remote desktop to our server, but that will imply an use of extra resources (memory, space, and bandwidth… And therefore, money) that could be used for more interesting things.

At the moment, the way I’m using to bypass all this trouble and make my life easier, consists in using SSHFS and Fuse. Basically, I will have my remote drive mounted like a local drive, and I can use all the editors I want, and I can use drag’n’drop to easily play with my files. Something similar can be done using the FTP protocol, but this is inherently insecure. That’s why I decided to use SFTP in this case, which is FTP implemented under SSH.

So… How I do it? Easy. First, SSH access is needed. If you can connect to the server through SSH to your server, you can use sftp to transfer files from/to your server, as they explain in DigitalOcean.

SFTP is pretty cool by itself, but we can make it awesome. Oh, laziness, the mother of the best inventions… SSHFS will be the responsible to mount the remote folder in our system. The installation is a piece of cake in Ubuntu and derivatives:

sudo aptitude update
sudo aptitude install sshfs
sudo adduser $USERNAME fuse
mkdir ~/Desktop/sftp

reboot is required to complete the process.

Then, for mounting the remote folder a simple command line is required:

sshfs ~/Desktop/sftp

And for unmounting:

fusermount -u ~/Desktop/sftp

My suggestion is to mount the folder the first time as

sshfs ~/Desktop/sftp

in order to find out which folder is mounted as default, as it depends on the server and user configuration.

If you have some error like

fusermount: failed to open /dev/fuse: No such file or directory

there’s a easy workaround:

sudo mknod -m 666 /dev/fuse c 10 229

You can create an alias, or a .bashrc entry to automatise this task every time you boot your computer, but I rather prefer to do it manually when I consider is the moment. That’s why I created 2 easy scripts:

# Mount sftp folder
sshfs TheUser@YourIP:/home/TheUser ~/Desktop/sftp
echo "Done"

# Unmount sftp folder
fusermount -u ~/Desktop/sftp
echo "Done"

Cool, isn’t it? Just remember to be careful, I’m not responsible if something goes wrong. If you want to know a little bit more, you can visit damontimm‘s website, where I took much of the information from.

Installing Microsoft Truetype core fonts

Microsoft’s arm is really long. There is many Microsoft users and it is really easy to find a document or a website using proprietary fonts included in Windows. Sometimes this can be a problem if we want to see that document or website as the designer intended, as usually are not included by default in Linux.

Usually, just installing the Microsoft True Type Core Fonts for the Web solves the problem. This package includes:

  • Andale Mono
  • Arial Black
  • Arial (Bold, Italic, Bold Italic)
  • Comic Sans MS (Bold)
  • Courier New (Bold, Italic, Bold Italic)
  • Georgia (Bold, Italic, Bold Italic)
  • Impact
  • Times New Roman (Bold, Italic, Bold Italic)
  • Trebuchet (Bold, Italic, Bold Italic)
  • Verdana (Bold, Italic, Bold Italic)
  • Webdings

[codebox 1]

You will need to accept the license in order to allow the installation to complete.

If you are using Ubuntu, you need to activate the Multiverse repository previous to installation.

However, we can also use the package ttf-liberation, which includes fonts developed by Fedora with the same metrics than the Microsoft ones. The fonts included in this package are:

  • Liberation Mono
  • Liberation Sans
  • Liberation Serif

[codebox 2]

HP’s Beats Audio and Linux

I’m not writing now about all the problems with the HP laptops and Linux. I’m not going to say that Microsoft is a bully and HP is his sycophant. Not today.

If you have one of those HP laptops with Beats Audio and you managed to install Linux, you will realise that the sound is… Well… Crap.

This is how you solve it:

1.- Install alsa-tools-gui:

[codebox 1]

If you have any problem, try adding this repository:

[codebox 2]

2.- Launch hda-jack-retask:

[codebox 3]

3.- Select the codec beginning by IDT and remap these pins (you need to check “Show unconnected pins”):

  • 0x0d (Internal Speaker, Front side) to “Internal speaker”
  • 0x0f (“Not connected” but is the under-display speakers) to “Internal speaker”
  • 0x10 (“Not connected” but is the subwoofer) to “Internal speaker (LFE)”

Click on “Apply now”. Un-mute the sound and increase and decrease the sound volume. Now run this in a different terminal to be sure that everything is workign fine:

[codebox 4]

If something goes wrong, just reboot. If everything is working fine, press on “Install boot override”.

In the case those overriding pins are not correct, you can try your own configuration until everything goes all right.