tgt-setup-lun command not found

In this troubleshooting guide we learn how to fix tgt-setup-lun command not found error message

Introduction

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

tgt-setup-lun: command not found

or when using sudo you get the following error message

sudo: tgt-setup-lun: command not found

Solutions to tgt-setup-lun: command not found

How To Fix tgt-setup-lun: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu tgt-setup-lun is provided by tgt package.

tgt is:

The Linux target framework (tgt) allows a Linux system to provide SCSI devices (targets) over networked SCSI transports.

tgt consists of a user-space daemon and user-space tools currently supporting the following transports:

  • iSCSI (SCSI over IP)
  • iSER (iSCSI over RDMA, using Infiniband)

tgt also supports different storage types for use as backing stores for SCSI Logical Units:

  • Plain files and block devices
  • Ceph/RADOS RBD volumes
  • GlusterFS volumes

This package includes the daemon and user-space tools.

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

sudo apt-get -y install tgt

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

You can also use apt command to install tgt.

sudo apt -y install tgt

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

sudo aptitude install tgt

Summary

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