How To Install fake-hwclock on Ubuntu 18.04

In this tutorial we learn how to install fake-hwclock on Ubuntu 18.04. fake-hwclock is Save/restore system clock on machines without working RTC hardware

Introduction

In this tutorial we learn how to install fake-hwclock on Ubuntu 18.04.

What is fake-hwclock

fake-hwclock is:

Some machines don’t have a working realtime clock (RTC) unit, or no driver for the hardware that does exist. fake-hwclock is a simple set of scripts to save the kernel’s current clock periodically (including at shutdown) and restore it at boot so that the system clock keeps at least close to realtime. This will stop some of the problems that may be caused by a system believing it has travelled in time back to 1970, such as needing to perform filesystem checks at every boot.

On top of this, use of NTP is still recommended to deal with the fake clock “drifting” while the hardware is halted or rebooting.

There are three methods to install fake-hwclock on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install fake-hwclock Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install fake-hwclock using apt-get by running the following command:

sudo apt-get -y install fake-hwclock

Install fake-hwclock Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install fake-hwclock using apt by running the following command:

sudo apt -y install fake-hwclock

Install fake-hwclock Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install fake-hwclock using aptitude by running the following command:

sudo aptitude -y install fake-hwclock

How To Uninstall fake-hwclock on Ubuntu 18.04

To uninstall only the fake-hwclock package we can use the following command:

sudo apt-get remove fake-hwclock

Uninstall fake-hwclock And Its Dependencies

To uninstall fake-hwclock and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove fake-hwclock

Remove fake-hwclock Configurations and Data

To remove fake-hwclock configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge fake-hwclock

Remove fake-hwclock configuration, data, and all of its dependencies

We can use the following command to remove fake-hwclock configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge fake-hwclock

References

Summary

In this tutorial we learn how to install fake-hwclock package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.