As we continue our Command Line series, we’re always on the lookout for ways to try new software and alternative methods for installing Linux applications. One common instance that comes up frequently is installing software from a repository other than the default Debian Buster that comes with Crostini Linux on Chrome OS. If you’ve tinkered with Crostini, it’s possible that you have run into this same situation and the error that occurs when trying to add a secondary repository.
For our example, we will use the Debian Stretch repository since it is a trusted repo and we already know that it works well on Chrome OS. When Chrome OS was updated to Debian 10 (Buster) containers, the Debian 9 (Stretch) repos were removed. To add the main Debian Stretch repository, we will use the following command in the terminal.
sudo apt-add-repository 'deb http://ftp.us.debian.org/debian stretch main contrib non-free'
Immediately, you will see that this method doesn’t work due to the missing software-properties-common package and the following error will print in the terminal.
add-apt-repository command not found Don’t panic. It’s a simple fix. First, we will need to install the software-properties-common package and then, run the command to add the Debian Stretch repository.
sudo apt-get install -y software-properties-common sudo apt-add-repository 'deb http://ftp.us.debian.org/debian stretch main contrib non-free'
Once the installation is complete and you have added the repository, run
sudo apt update && sudo apt upgrade -y to make sure everything is up-to-date. (This is just an example. There are zero reasons to use the Stretch repository. You will find the same and sometimes newer versions of applications in the Buster repo.) Now that that’s finished, you can verify that your repo was added by using the
cat command and viewing the
sources.list file that housed the repos. Run the following command to verify that Stretch Main is now in that file.
If you are adding a repository to install a single application and don’t want to keep the repo in your sources list, you can remove it by adding the
-r command to the apt-add command we used. That command looks like this:
sudo apt-add-repository -r 'deb http://ftp.us.debian.org/debian stretch main contrib non-free'
For some repositories, you may find yourself getting an error when trying to run
apt update. There is a variety of reasons this can happen. Missing keys and “insecure sources” are common errors when adding a repo to Crostini. If you hit that wall, drop a comment below and we can address the specific repository together as the method for fixing that error can vary.