Errors were encountered while processing: linux-image-3.13.0-128-generic

Problem

You are trying to install/remove a package but you always get an error message about linux message as above:

Errors were encountered while processing:
 linux-image-3.13.0-128-generic

Solution

Try the following:

rm -rf /var/lib/dpkg/info/linux-image-3.13.0-128-generic.*
apt-get purge linux-image-3.13.0-128-generic

FATAL -> Failed to fork – Digital Ocean – Debian – Docker

Problem

When you are trying to install a package inside a debian Docker container you get the following error message:

FATAL -> Failed to fork.

Solution

This is an indication of ‘out of memory’ so add a swap partition if it does not exist, on the host with the following:

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap sw 0 0" >> /etc/fstab

(Thanks Valent)

Docker – Debian – Kernel panick – Automatic restart

Problem

You have a remote server (Debian) running some Docker containers and you want to make sure that they all restart in the event of a kernel panick.

solution

  • Add an automatic restart after a kernel panick by running:
    sysctl kernel.panic=20
  • Emulate a kernel panick by running the following (SysRq more info here :
    echo c > /proc/sysrq-trigger
  • Check that the containers have restarted again with docker ps (NOTE: the containers should have been enabled to autorestart)

Docker Debian locales installation

Problem

You want to install some default locales in a Docker image, and the suggestion is to use locale-gen to do so, but it does not work as expected.

Solution

In order to be able to use the locale-gen and install the locales you need you will have to uncomment the ones needed from /etc/locale.gen first and then use the locale-gen. Example below:

## Set up locales
## Uncomment the ones we need as locale-gen does not work without that
RUN sed -i '/en_US.UTF-8/s/^#//' /etc/locale.gen
RUN sed -i '/de_DE.UTF-8/s/^#//' /etc/locale.gen
## Now install them and set the default one
RUN locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)

Problem

When trying to connect with ssh to a linux (debian- ubuntu) server you get the following error:

bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)

Solution

The reason is that the server is missing the en_US locale that your client is trying to use to connect to the server.
Login to the server and by using sudo (or su) run the following to install the missing en_US locale and make sure that you leave default to ‘None’ as described here:

dpkg-reconfigure locales

Passenger (mod_rails) gem installation – Apache2 – Debian – rvm

Problem
You would like to (re)-install passenger after a system wide rvm installation, but you only have the mod_passenger.c file and not the .so after the gem installation.

Solution
Make sure that after using gem install passenger you also use the command to install the apache2 passenger module:

passenger-install-apache2-module

you should then be able to see the .so file and add it to your /etc/apache2/mods-available/passenger.load

ImageMagick, RMagick, Debian installation

Problem
You want to use the rmagick gem in your ruby on rails project, but you need to install the imagemagick first.

Solution
If Imagemagick is not already installed, use the following to install it:
$ sudo apt-get install imagemagick$ sudo apt get install libmagick-dev libmagickwand-dev

You should then be able to install and use the rmagick gem

Gitweb access to gitolite repository

Problem
You are trying to set up gitolite access through gitweb but the gitweb page, shows ‘no projects avaiable’ even though you have repositories available.

Solution
Try to follow the guide here.
Some of tthe most important steps for having the right access permissions are:

  • Add the www-data user in the gitolite group by:
    $ sudo usermod -a -G gitolite www-data
  • Add the paths to the repositories and the projects list:
    $ sudo vi /etc/gitweb.conf
    $projectroot ="/var/lib/gitolite/repositories";
    $projects_list="/var/lib/gitolite/projects.list";
  • Change the permissions in the repositories:
    $ sudo chmod g+r /var/lib/gitolite/projects.list
    $ sudo chmod -R g+rx /var/lib/gitolite/repositories
  • Change permissions in the /var/lib/gitolite/.gitolite.rc file to allow access to the repositories:
    $REPO_UMASK = 0027;
  • Finally change the git-daemon to run with the gitolite group permissions in the file /etc/sv/git-daemon/run:
    exec chpst -ugitdaemon:gitolite