Manage chroot environments with Atoms
Ask any seasoned programmer about chrooting and they’ll either nod in understanding what the tool offers, or turn away so you don’t see the fear in their eyes, because chrooting isn’t the easiest thing to do from the command line .
The New Stack explains what a chroot environment is and how to manage it with Atoms.
Essentially, chroot environments create isolated virtualized copies of a software system that can be used for testing or development without harming your operating system. These environments are a great option for testing things that pose a risk to your production machine.
Traditionally, chroot environments were created using the command line. Fortunately, a GUI tool is available that makes managing chroot environments much easier.
This application is called Atoms and allows you to create, manage and use chroot environments.
Atoms currently supports the following Linux versions:
- Alpine Linux.
- Ubuntu.
- Fedora.
- Alma Linux.
- Centos.
- Debian.
- Gentoo.
- OpenSUSE.
- RockyLinux.
With Atoms, you can easily choose the version of the distribution (as well as the release) that you want to use in your environment. Once you’ve created your environment, you can access it, do whatever you need to do, and then exit it, knowing that whatever you did in the environment won’t harm your host system.
Contents
How to install Atoms
To work with Atoms, you’ll need a Linux distribution that supports Flatpak. You won’t find Atoms as a .deb or .rpm package, nor is it available through Snap.
So, if your current Linux OS doesn’t have Flatpak installed, you need to install it first. Distributions like Fedora come with Flatpak pre-installed.
For Ubuntu-based distributions, you can install Flatpak using the following command:
sudo apt-get install flatpak -y
If you’re just installing Flatpak now, you’ll need to configure it before it can install apps from Flathub. To do this, be sure to enter the following command (after installing Flatpak):
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Once done, reboot the system for the changes to take effect.
Installing Atoms
Installing Atoms is very easy. Open a terminal window and type the following command:
flatpak install flathub pm.mirko.Atoms
Be sure to answer in to all questions. After the installation is complete, you can log in and out (ie the Atoms launcher will be added to the desktop menu) or start Atoms immediately with the command:
flatpak run pm.mirko.Atoms
When you first launch Atoms, you’ll see a “Create a new Atom” button.
Atoms does not contain any chroot environments when first launched.
Create your first chroot environment
Click Create New Atom. In the popup that appears, you’ll need to specify Atom, select a distro to use as the base image, and then select the release version of the selected distro. On certain distributions, you may find that you are limited to only the latest release.
Once you’ve set up your new Atom, click Create and the app will do its thing. When the process is complete (it should take less than a minute), close the popup and you’ll see your Atom listed.
Using your new Atom
On the Dashboard tab, click on the entry for your new Atom and you’ll see entries for Browse Files, Details, Bindings, and Destructive Actions.
Clicking Browse Files will mount the environment and open a file manager so you can navigate the file system hierarchy. However, the real work happens in the Console tab.
Click the Console tab and you’ll be in the root window of your environment, where you can start testing, developing, and whatever else you need.
The only thing to keep in mind is that the chroot environment is not 100% analogous to either a virtual machine or a simple installation. You will have problems installing programs like Docker, Podman, Apache2, etc.
However, you can click “View Files” on the toolbar and then use the file manager to copy and paste the source/scripts into the desired directory and work from there. Using the same method, you can create new directories.
You may also find problems with permissions. Here’s how to go to the console and create a new user:
useradd -m USERNAME
Where USERNAME is the username to add.
Then give that user a password using the command:
passwd USERNAME
You can then change to that user with the command:
su USERNAME
At this point, you will have permission to write to the new user’s home directory (change to it with the cd command).
When you’re done using Atoms, you can click the left-pointing arrow in the upper-left corner of the Dashboard tab. If you no longer need Atoms, click Destroy Atom.
Atoms is a great way to quickly create chroot environments. Add chroot environments using Atoms to your development/testing process. This will make your life easier and cause less damage to your production systems.
Read also on ProIT: how to be more productive on Linux with KDE Actions.
Subscribe to ProIT on Telegram so you don’t miss a post!