dphys-swapfile command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
dphys-swapfile: command not found
or when using sudo you get the following error message
sudo: dphys-swapfile: command not found
Solutions to dphys-swapfile: command not found
How To Fix dphys-swapfile: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu dphys-swapfile is provided by dphys-swapfile package.
dphys-swapfile is:
This init.d script exists so one does not need to have a fixed size swap partition. Instead install without swap partition and then run this, with file size (re-)computed automatically to fit the current RAM size.
By default (and hence on installation) it creates swapfile twice as big as the present RAM amount with an upper limit of 2 GB.
It’s also very helpful when included in SD card, USB stick or disk images which are distributed and run on many machines with different amount of RAM, e.g. different models of the Raspberry Pi or cloud images.
To fix this problem, we can install more using the command below.
sudo apt-get -y install dphys-swapfile
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install dphys-swapfile.
sudo apt -y install dphys-swapfile
Or if you have aptitude installed you can use the following command.
sudo aptitude install dphys-swapfile
Summary
In this tutorial we learn how to fix dphys-swapfile command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.