This blog is now moved to this new address: https://subhadig.github.io/.
If you want to find out more about why and how I moved my blog to GitHub Pages, check out this blog post: Moving My Blog to GitHub Pages from WordPress.com.
This blog is now moved to this new address: https://subhadig.github.io/.
If you want to find out more about why and how I moved my blog to GitHub Pages, check out this blog post: Moving My Blog to GitHub Pages from WordPress.com.
After the release of Debian 10 Buster, I installed it on my Dell Inspiron 3558 laptop which comes with onboard Intel HD Graphics. I am using Xfce desktop environment instead of the default Gnome desktop. After the installation, I would intermittently face the problem where the whole desktop would suddenly just freeze and stop responding to the mouse and the keyboard. Even after hours of waiting the system would never come back to the normal state and the only solution was to hard reboot the whole system. It seemed really weird as prior to installing Debian 10, I had Debian 9 running on it for more than a year and I never had any such issues.
This issue was very difficult to reproduce as it did not necessarily follow any pattern and was really unpredictable. After researching on the Internet for days, I finally found out a solution that fixed the issue. As per the official Debian documentation on video drivers, the use of X.org xf86-video-intel driver is discouraged in favour of the newer builtin modesetting driver especially if your hardware is newer than or from 2007. This was the default setting that came with the default Debian Xfce installation. And this was what was causing the freeze. To fix it and use the old xf86-video-intel driver instead, here is what I did.
Edit the file /etc/X11/xorg.conf and update it with the following content. If the file does not exist, create a new one.
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "SNA"
Option "TearFree" "true"
EndSection
That’s it. I have been having this setting for 3 months now and I never had any freezing issue after that.
If you have never heard of Alpine Linux before, it’s a distribution of Linux, a very lightweight one . In fact it’s so small, an empty container of Alpine Linux can be run with less than 8 MB of memory. And that’s one of the reasons why it’s extensively used in containers. Docker Hub has an official image of Alpine Linux. So it’s fairly easy to run Alpine Linux as a docker container or build one on top of it.
To download the alpine image from Docker Hub, run the below command, assuming you already have Docker installed in your system. I am using Alpine version 3.9 which is the latest at the time of writing the post. This link has a list of available tags and versions.
docker pull alpine:3.9
To run the alpine image in interactive mode, run the following command:
docker run -it --rm --name alpine alpine:3.9
This should launch an alpine container and land you at a shell prompt. The “-it” flags tells Docker that the image should be run in interactive mode and a tty should be allocated. “–rm” flag ensures that the container is removed as soon as you exit the shell and come out of the interactive mode.
To check the version of Alpine Linux while inside the shell, run
cat /etc/alpine-release
While it can be fun to run it in interactive mode, it’s not very useful. To make something useful with docker, you need to create your custom image. In this post, I will create a custom docker image with Alpine Linux that will run a simple HTTP server and I will access the server from the host. Here are the steps.
Create a file with name Dockerfile and paste the following content.
FROM alpine MAINTAINER Subhadip Ghosh RUN apk update RUN apk add python3 RUN echo "Hello from Alpine Linux" >index.html ENTRYPOINT ["/usr/bin/python3", "-m", "http.server"] EXPOSE 8000
Run the following command to create the Docker image. Make sure you are in the same directory as the Dockerfile.
docker build -t alpine-python-server:latest .
Execute the following command to verify that an image has been created with the name “alpine-python-server”.
docker images
To run the image that was created in the previous step, execute the following command:
docker run -d -p 8000:8000 --name test-server alpine-python-server
This command does the following things:
– Creates a container from the “test-server” image created in the previous step.
– “-d” tells docker to run the container in detached mode ie in the back ground.
– Maps port 8000 of the container with port 8000 of the host so that you can open a web browser in your host system and point to http://localhost:8000 to visit the web-server running inside the container.
– I named our container as “test-server” for ease of reference.
Since we have mapped the container port on which the web-server is running to the same port on host, if you visit the URL http://localhost:8000 from any web-browser from your host system, you should see something like this:
Event though Debian is considered as one of the most stable Linux distributions out there, part of it’s stability comes from the fact that a large portion of it’s package base consists of well-tested but outdated packages. This should be a blessing most of the times but if you are a developer like me, some times you may need a latest or specific version of a package. In this case, I needed the latest version of the mysql-server package. Although official apt repository is available from MySQL to install the latest version of it on Debian, to be able to run something in containers has it’s own advantages including having the ability to run multiple versions of the same package simultaneously and can be easily cleaned up after using.
While one could use my earlier post on creating LXC containers on Debian and run MySQL inside it, it’s a lot easier to use the official MySQL docker image from Docker Hub. If you are yet to install Docker, you can follow this official documentation from Docker to install the community edition of it on Debian. Post installation of Docker, follow the below steps to run MySQL as a Docker container. To be able to connect to the docker instance of MySQL from the MySQL client or MySQL workbench available in the Debian repository, I will be using a few additional tweaks.
docker pull mysql:8
docker run --name test-mysql -e MYSQL_ROOT_PASSWORD=test -d -p 3306:3306 mysql:8 --default_authentication_plugin=mysql_native_password
A few things to note:
– The name of the docker instance in this case is “test-mysql”. It can be any arbitrary name.
– “test” value has been passed as the MYSQL_ROOT_PASSWORD environmental variable while starting the container. This value will be used as the MySQL root password by the container. In absence of this value, it will generate a random root password every time you start the container and print in the log.
– “-d” option is to run the container in the background as a detached instance.
– The 3306 port, which is the default port of MySQL is mapped with the 3306 port of the host. This is helpful if you want to connect to the MySQL docker instance on localhost.
– The “default_authentication_plugin” has been set as “mysql_native_password”. This is required if you want to connect to the MySQL docker instance from the MySQL client or the Workbench available in the Debian repository, which are old and does not support the new default authentication methods introduced in MySQL 8.
mysql --protocol=tcp -u root -ptest
If you don’t have MySQL client installed in your Debian host, use the following command to install it.
sudo apt install -y mysql-client
docker exec -it test-mysql mysql -u root -ptest
That’s it. This should give you enough information to start and run MySQL as a Docker container on your Debian host. For additional information and configuration options, visit the following listed pages
Debian Stretch, the current stable release of Debian now comes with Firefox ESR 60. One strange issue I have noticed with the out of the box configuration of Firefox on Debian is that it does not correctly render the Indic fonts on the websites. Most notable issue is that it breaks the connected letters while showing. Here’s how I fixed it.
sudo apt install fonts-indic
Here’s how my settings looks like:

I am using Eclipse IDE (version 2018-12 at the time of writing) on Debian 9 Xfce and the issue with it is that the Eclipse editor windows would flicker around the edges. Sometimes so much so that it’s impossible to type inside it. Here’s how I fixed it:
First check the value of GTK_IM_MODULE in your environment by executing
echo $GTK_IM_MODULE
In my case the output was “xim”. But Eclipse expect it to be “ibus”. So enter the following command in a terminal session to set it to the value.
export GTK_IM_MODULE="ibus"
Now if you launch Eclipse from the same terminal session, you should not experience any flickering issue. If you launch eclipse from a desktop menu entry, then edit the .desktop file and put the following string in the beginning of the Exec command:
env GTK_IM_MODULE=ibus
If you have used an USB drive to write iso images to before installing Debian or recent versions of Ubuntu, here are the steps to reclaim it after installation is over.
lsblk
which should show you an output like the one below:
sudo dd if=/dev/zero of=/dev/sdb bs=1M && sync
This step might take some time to complete depending upon the size of the USB drive. So be patient. When it is over, you should see an output like the below:
sudo fdisk /dev/sdb
You should see a prompt like below

Enter n to create a new partition, press enter to go with the default options until the next Command prompt comes, then enter w to write the changes to disk.
lsblk
sudo mkfs.vfat /dev/sdb1 -n <label>
And now your USB drive should become usable again.
After a few earlier failed attempts, today I was successfully able to create an unprivileged LXC container on Debian Stretch for the first time. I had experience of using LXC’s more user friendly cousin LXD before I moved to Debian but unfortunately LXD is not available on Debian yet. While LXC is more low level compared to LXD, if you just need a basic container, it’s still pretty solid. The Debian wiki on LXC container is fairly straight forward and easy to follow, but still for someone who is a novice to both Debian and LXC, it is very easy to get lost. So I am writing this post so that it can be a good place to start if you need a very basic setup.
LXC containers can be of two types depending on the level of access they have to their host system:
Before I start with the steps, I want to talk a little bit about my system configuration. The installed version of Debian is Stretch and the architecture is amd64. It has two users – root and test which is a non-sudo user. This guide will assume that you will modify the commands as per your system specific configuration instead of blindly copying and running.
# apt install lxc libvirt0 libpam-cgroup libpam-cgfs bridge-utils cgroupfs-mount
USE_LXC_BRIDGE="true"
# service lxc-net restart
$ lxc-checkconfig
# sh -c 'echo "kernel.unprivileged_userns_clone=1" > /etc/sysctl.d/80-lxc-userns.conf' # sysctl --system
$ cat /etc/s*id|grep $USER
In my case, it produced a output like the following:
test:100000:65536 test:100000:65536
But it can be different in your case. Note the first number ie 100000.
# usermod --add-subuids 100000-165536 test # usermod --add-subgids 100000-165536 test
# cd /home/test # setfacl -m u:100000:x . .local .local/share
# echo "test veth lxcbr0 10"| tee -i /etc/lxc/lxc-usernet
$ mkdir -p .config/lxc
$ echo \ 'lxc.include = /etc/lxc/default.conf # Subuids and subgids mapping lxc.id_map = u 0 100000 65536 lxc.id_map = g 0 100000 65536 # "Secure" mounting lxc.mount.auto = proc:mixed sys:ro cgroup:mixed # Network configuration lxc.network.type = veth lxc.network.link = lxcbr0 lxc.network.flags = up lxc.network.hwaddr = 00:FF:xx:xx:xx:xx'>.config/lxc/default.conf
$ lxc-create --name ubuntu -t download
Give the following inputs when prompted:
Distribution: ubuntu Release: bionic Architecture: amd64
$ lxc-start --name ubuntu --logfile $HOME/lxc_ubuntu.log --logpriority DEBUG
The extra log options will be helpful in debugging if something goes wrong but can be ignored from next time onward.
$ lxc-attach --name ubuntu
If you have followed all the steps correctly, hopefully you are now running an unprivileged container on your Debian Stretch. Please consider reading the article mentioned in Further Reading section to understand each steps used in this guide in details.
Further Reading:
I have a wireless Bluetooth speaker that I use with my laptop running Debian 9 with Xfce. My laptop also has a primary speaker. So when I connect my Bluetooth speaker to my laptop, my laptop is actually connected to both the primary and secondary speaker at the same time. The laptop volume up/down keys will still be mapped to the primary speaker and if I wish to control the volume of the secondary speaker, I needed to open the Volume Control window from the Panel volume plugin, which was a pain if you had to do it every time.
Here’s what I did to simplify it. Debian Linux and most other major Linux distributions use pulse audio to manage all audios and there’s a command line utility that comes installed by default to manage pulse audio. It’s called pactl. When you connect a speaker to your computer, it creates an audio sink for it to manage it. To get a list of audio sinks that your computer has access to, run the following command in Terminal:
pactl list sinks
And from the output, look for the speaker you need to manage and the corresponding “Name” string. In my case, it looks like “bluez_sink.<hardware-address>.a2dp_sink” where <hardware-address> is the address by which the computer identifies the particular hardware device. The good thing about this address string is that, it remains unchanged even if you remove it and then connect it back.
Once you determine the sink name of your audio device, you can do a bunch of operation from the command line on it including setting the volume, increasing/decreasing the volume or mute it. Example: the following command will increase the sink volume by 5%
pactl set-sink-volume <sink-name> +5%
and to decrease it by 5%
pactl set-sink-volume <sink-name> -5%
Replace <sink-name> with the name you copied from the previous step.
And then you can assign keyboard shortcuts to do those operations, so that you can perform them without opening a Terminal. To do that in Xfce, go to Settings > Keyboard > Application Shortcuts and then Add a new shortcut. For other desktop environments, follow the desktop environment specific instructions.
deb http://ftp.debian.org/debian stretch-backports main contribAnd update repository information.
sudo apt update2. Uninstall the older libreoffice packages and dependencies.
sudo apt purge libreoffice* sudo apt autoremove3. Install the latest libreoffice and a couple of other additional packages from the backport repository
sudo apt install -t stretch-backports libreoffice libreoffice-gnome libreoffice-help-en-usAnd that should be all. Open Libreoffice and check the version from Libreoffice > Help > About Libreoffice which should reflect the latest version. A couple of things to note here:
I hope it helps.