How to solve Plesk installation/upgrade error in Ubuntu 16.04: There is no /etc/localtime file in system

Last week, during the initialization of a new EC2 instance on amazon web services with Ubuntu and the installation of Plesk, the web hosting control panel on this instance lead me to a pretty weird issue caused by the timezone of the system that wasn't even available on the system.

After downloading the plesk installer via SSH an running the setup, the exception during the installation was thrown:

***** problem report *****
There is no /etc/localtime file in system.
Run tzsetup as root to set up your timezone

This made impossible to install plesk before solving this issue. After some research, i discovered that the tzdata package wasn't installed on Ubuntu for some unknown reason. The public-domain time zone database (tzdata) contains code and data that represent the history of local time for many representative locations around the globe.

If you face this error during the installation of some package, like plesk, i'll show you how to prevent this exception from appearing.

A. Verify if tzdata package is installed

The solution that worked for me immediately, was simply installing tzdata on the system as it wasn't installed and leaded to the exception. Before installing, you may want to verify if the package is already installed using the following command:

dpkg -l tzdata

This will output if the package exists or not. If it doesn't exists, you will get an output that says: "dpkg-query: no packages found matching tzdata". If it is not installed, you can proceed with the installation of the package with the following command:

sudo apt-get install tzdata


During the installation, the setup will ask for your timezone, in my case the region timezone is America/Bogota (during the setup you will select first the continent and then the region).

After installing, if you try to check again if the package has been installed or not, you will get an output like the following:

Tzdata Install Ubuntu apt-get

Finally, if you proceed with the installation of the package that you were having trouble with, the exception of the localtime shouldn't appear anymore.

B. Fix absent or broken /etc/localtime file

In case that tzdata was installed and the exception still appearing, you will need to verify if the localtime file exists or if it's corrupt. As first step, you need to verify if there's indeed the localtime file with the following command:

ls -la /etc/localtime

This command will output if there's such a file in the directory. If it doesn't exist, proceed to create a symbolic link from the zoneinfo folder of tzdata to the file:

ln -s /usr/share/zoneinfo/GMT /etc/localtime

After creating the symbolic link, you can check again if the file exists (as symlink) with the following command:

ll /etc/localtime

Now you would be able to proceed with the installation of the package that was throwing the exception on your system.

Happy server management !

This could interest you
Become a more social person