Fixing a broken sudoers file without rebooting

Problem

If by accident you make a mistake in your sudoers file then you won’t be able to run sudo command after saving the file.

Solution

Following the answer here, you can simply run the command pkexec visudo, supply your password and provided you already had sudo permissions, fix the sudoers file, make sure that you save it using the Q when prompted, and you should be able to use sudo commands again.

Docker error – error response from daemon: Cannot start container….is not within /var/lib/docker/aufs/mnt

Problem

You are trying to use an image from Docker in your Ubuntu 14.04 system, but you are getting a error like the following:

Solution

Your docker version is outdated (ie 1.0.1) so you would need to upgrade your docker installation.
There is a script for this (information from here):

After running the following you should be able to use your images as normal with: sudo docker run -t -i image/name bin/bash:

rvm – Branch origin/ruby_2_1_0 not found.

Problem

You are trying to install the new ruby in your ubuntu rvm installation with rvm install 2.1 but you are getting the error:

Solution

If you are careful and you notice a warning message as:

then you would need to update your rvm installation to the latest one with:

And then you should be able to install the latest ruby version with:

WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1

Problem

You get the following warning after an update to your system (ie Ubuntu 13.10):

Solution

Uninstall your nokogiri versions:

and then run install it again (inside your application if you use bundler) with:

rvm “You need to change your terminal emulator preferences to allow login shell.”

Problem

After a new rvm installation in an (k)ubuntu system you get the following error from rvm when trying to switch between rubies:

Solution

As the message suggests you can change the setting in your terminal which is fine if you are using the gnome-terminal by going to the link provided:

but if you are using Konsole in KDE you need to go to a different link that explains the change in the settings:

Remap CapsLock to Ctrl in Ubuntu

Problem

You would like to remap your Caps Lock key to Ctrl so it is easier to use as the ‘Prefix’ in tmux.

Solution

Go to System Settings -> Input Devices -> Keyboard -> Advanced
and tick first the ‘Configure keyboard options’ and then
in the ‘Ctrl key position’ select ‘Caps Lock as Ctrl’

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:

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:

Can’t install RMagick 2.13.1. Can’t find Magick-config

Problem

You are trying to install rmagick in an Ubuntu 12.04 virtual box, but you get the following error:

Solution

Make sure you install both the imagemagick and the libmagickwand-dev packages with either apt-get :

or in a puppet script as:

Adding timezone information in MySQL

Problem
You would like to convert times in MySQL with the CONVERT_TZ function and to be able to use timezone names (ie CE).

Problem

  1. Find out if your MySQL includes timezone information as it is not included by default. Log in and run : select count(*) from mysql.time_zone_name;
  2. If the result is 0 then the timezone information is not included
  3. Log out from your MySQL server on the command prompt and upgrade your server with: mysql_upgrade -p
  4. On the command prompt again load up the table with the data (linux server): mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root -p mysql/li>
  5. Login to your MySQL server again and run the first query: select count(*) from mysql.time_zone_name;