systemd-nspawn command not found

In this troubleshooting guide we learn how to fix systemd-nspawn command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

systemd-nspawn: command not found

or when using sudo you get the following error message

sudo: systemd-nspawn: command not found

Solutions to systemd-nspawn: command not found

How To Fix systemd-nspawn: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu systemd-nspawn is provided by systemd-container package.

systemd-container is:

This package provides systemd’s tools for nspawn and container/VM management:

  • systemd-nspawn
  • systemd-machined and machinectl
  • systemd-importd
  • systemd-portabled and portablectl

To fix this problem, we can install more using the command below.

sudo apt-get -y install systemd-container

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install systemd-container.

sudo apt -y install systemd-container

Or if you have aptitude installed you can use the following command.

sudo aptitude install systemd-container

Summary

In this tutorial we learn how to fix systemd-nspawn command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.