[Debian] Changing Docker's default /var/lib/docker directory

Posted on Tuesday, Sep 10, 2019 in programming • Tagged with debian, docker, directory, systemd

By default, Docker storage its files in the /var/lib/docker directory in the file system. If, like me, you're running out of disk space in the default file system, you can quickly change the default directory. This are the steps I followed in Debian 10, it should work with any distro that uses systemd

As superuser, modify the systemd docker startup script. Edit the file /lib/systemd/system/docker.service replacing the ExecStart command:

1
$ sudo vim /var/systemd/system/docker.service

Change the line:

1
ExecStart=/usr/bin/docker daemon -H fd://

to

1
ExecStart=/usr/bin/docker daemon -g /new/path -H fd://

then stop the service, and be sure that the daemon is completely stopped:

1
2
$ sudo systemctl stop docker
$ ps -aux | grep -i docker

The only output should be the one from grep. Then you can reload the system and -optionally- synchronize your current docker data to the new directory

1
2
3
$ sudo systemctl daemon-reload
$ sudo mkdir /new/path
$ sudo rsync -aqxP /var/lib/docker /new/path

Your docker installation should be running in the new data directory:

1
$ ps -aux | grep -i docker

That's it.


A Quick Guide to Install Spotify in Debian 9.0

Posted on Wednesday, Jul 05, 2017 in personal • Tagged with personal, spotify, debian, music, install, apt

A quick guide of the steps I took to install Spotify version 1.0 in Debian 9.0. First of all, the Spotify team doesn't (officially) support the Linux version, so even if they claim to be compatible with de lastest version of Ubuntu's LTS, it tends to fall behind with the dependencies.

With a fresh install of Debian, you'll need dirmngr installed before adding the Spotify repository to your apt list:

1
$ sudo apt install dirmngr

After dirmngr installation, you'll need to add the Spotify keys and repositories (just check the instructions in the Spotify for Linux website):

1
2
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
$ echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

If you follow the instructions at Spotify's website, the installation should be ready with the update and install commands from apt:

1
$ sudo apt update && sudo apt install spotify-client

But is a common case that not all the dependencies are up to date between Spotify and Debian, so you'll need to add them "by hand".

1
2
3
4
5
6
The following packages have unmet dependencies:
 spotify-client : Depends: libssl1.0.0 but it is not installable
                                  Recommends: libavcodec54 but it is not installable or
                                                          libavcodec-extra-54 but it is not installable
                                  Recommends: libavformat54 but it is not installable
E: Unable to correct problems, you have held broken packages.

First you'll have to download the exact same version of the package that Spotify needs, in my case it was libssl1.0.0, I downloaded it from: https://packages.debian.org/jessie/libssl1.0.0.

Then just install it with apt and try re-installing Spotify:

1
2
3
$ wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0 …

Continue reading

Debian (development tips)

Posted on Saturday, Dec 13, 2014 in programming • Tagged with debian, help, documentation, libraries, pil, libjpeg, locale, matplotlib, libxml, ubuntu, freetype, postgresql, database, scipy

These are some extra steps that I've found necessary when starting development in a recently-installed Debian machine.

Jpeg support in PIL and pillow.

1
2
3
4
$ sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/

Installing lxml in Python (Debian based).

If you're getting the "fatal error: libxml/xmlversion.h: No such file or directory" error, just install the following development files:

1
$ sudo apt-get install python-dev libxml2-dev libxslt1-dev

Problems with 'matplotlib' and freetype.

If you're having problems installing matplotlib in a Python virtualenv, and are getting the 'freetype missing' error, you sould install the development files for freetype, and (in most cases) rebuild the python dependencies for matplotlib.

1
2
$ sudo apt-get  -u install libfreetype6-dev
$ sudo apt-get build-dep python-matplotlib

After that, you can just use pip normally to install matplotlib

1
$ pip install matplotlib

PS. I know of cases where you have to update python-virtualenv and python-pip after you use build-dep. Just apt-get upgrade your installation. Today I learned about the 'pydoc' command from Python.

Problems with locale

In some machines I've found problems when setting locales from Python. First check the results of running

1
$ locale

In my case is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
LANG=es_VE.UTF-8
LANGUAGE=es_VE:es
LC_CTYPE="es_VE.UTF-8"
LC_NUMERIC="es_VE.UTF-8"
LC_TIME="es_VE.UTF-8"
LC_COLLATE="es_VE.UTF-8"
LC_MONETARY="es_VE.UTF-8"
LC_MESSAGES="es_VE.UTF-8"
LC_PAPER="es_VE.UTF-8"
LC_NAME="es_VE.UTF-8"
LC_ADDRESS="es_VE.UTF-8"
LC_TELEPHONE="es_VE.UTF-8"
LC_MEASUREMENT="es_VE.UTF-8"
LC_IDENTIFICATION="es_VE.UTF-8"
LC_ALL=

Then use:

1
2
3
4
5
6
import locale

try:
    locale.setlocale(locale …

Continue reading