How To Install umockdev on Ubuntu 18.04

In this tutorial we learn how to install umockdev on Ubuntu 18.04. umockdev is record/mock hardware devices for bug reports and regression tests

Introduction

In this tutorial we learn how to install umockdev on Ubuntu 18.04.

What is umockdev

umockdev is:

umockdev mocks hardware devices for creating unit tests for libraries and programs that handle Linux hardware devices.

This package provides tools to record the properties and behaviour of particular devices, and to run a program or test suite under a test bed with the previously recorded devices loaded.

Right now this covers sysfs, uevents, basic support for /dev devices, and recording/mocking usbdevfs ioctls (for PtP/MTP devices).

With this you can simulate particular hardware in virtual environments up to some degree, without needing any particular privileges or disturbing the whole system.

There are three methods to install umockdev 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 umockdev Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install umockdev

Install umockdev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install umockdev using apt by running the following command:

sudo apt -y install umockdev

Install umockdev 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 umockdev using aptitude by running the following command:

sudo aptitude -y install umockdev

How To Uninstall umockdev on Ubuntu 18.04

To uninstall only the umockdev package we can use the following command:

sudo apt-get remove umockdev

Uninstall umockdev And Its Dependencies

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

sudo apt-get -y autoremove umockdev

Remove umockdev Configurations and Data

To remove umockdev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge umockdev

Remove umockdev configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge umockdev

References

Summary

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