A Beginner's Guide to Package Management in Vanilla OS

 2025-01-24

 Vanilla OS

This article is the English translation of the Japanese article titled ‘Vanilla OSでのパッケージ管理方法をやさしく解説’.


Package Management in Vanilla OS Can Be Quite Complicated

One of the challenges for new users of Vanilla OS is the complex package management. Since the host system is an immutable distro that cannot be modified, the process of installing packages differs significantly from traditional OSes where the host system is writable. A key aspect of using Vanilla OS is understanding the distinction between the host system and subsystems. Generally, regular tasks are performed within subsystems, which are virtual environments, and adding packages to the host system should be considered a last resort.

Installing Packages on the Host System

Vanilla OS is an immutable distribution, which means the core of the running host system cannot be overwritten. Therefore, it is not possible to install packages directly onto the host system. Instead, Vanilla OS creates a new state with the installed package and swaps it with the previous state during a system reboot. This process is managed by a tool called ABRoot, which allows you to handle the state of the host system.

When installing packages with ABRoot, it’s a good idea to limit them to essential items such as drivers or firmware that must reside on the host system. For user applications, it’s preferable to install them via subsystems created by tools like Apx, virtual environments like VSO (Vanilla System Operator), or using Flatpak.

Installing Packages with ABRoot

To install packages using ABRoot, you use the abroot pkg command. Let’s take gnome-tweak as an example. The following commands illustrate the process:

abroot pkg add gnome-tweak
abroot pkg apply

After rebooting the system and selecting “current state,” the gnome-tweak package will be installed. If you select “previous state,” the system will roll back to its previous state before the package was installed. This atomic, safe state transition is one of Vanilla OS’s key features.

To remove a package, you would run the following commands:

abroot pkg remove gnome-tweak
abroot pkg apply

Installing Packages in a Virtual Environment

As mentioned earlier, most user applications can be installed in a virtual environment on Vanilla OS. There are three main options for doing this:

  • Install in the VSO subsystem
  • Install in a subsystem created with Apx
  • Install via Flatpak

Let’s take a closer look at VSO and Apx, the two tools unique to Vanilla OS.

Installing Packages in the VSO Subsystem

VSO, or Vanilla System Operator, is a virtual environment that isolates the host system. When you open a terminal in Vanilla OS, you are automatically working within the VSO. To install packages within the VSO, use the vso command.

Here’s an example of installing a package with the vso command:

vso install neofetch

Since VSO is based on Debian, you can also use apt to install packages, as shown below:

sudo apt install neofetch

To remove a package, you can use either the vso command or the apt command. Here’s how to remove a package using vso:

vso remove neofetch

Installing Packages in a Subsystem Created by Apx

Vanilla OS has a unique feature that allows you to create and manage subsystems based on various Linux distributions like Fedora, Ubuntu, or OpenSUSE using Apx. This allows you to access applications that are not available in the official Vanilla OS repositories. For instance, let’s use Apx to create an OpenSUSE subsystem and install the leafpad package using OpenSUSE’s package manager, zypper.

First, specify the openSUSE stack with apx, create and start a container named suse. When operating a subsystem from apx, you need to specify the name of the subsystem. In this example, the name suse is used. The command examples are as follows:

apx subsystems new -n suse -s opensuse
apx suse start

If you’re not comfortable using the command line, you can also manage your subsystems using the Apx GUI tool.

Apx GUI

To enter the newly created subsystem, run:

apx suse enter

Now, within the OpenSUSE subsystem, you can install leafpad using zypper:

sudo zypper in leafpad

If you want to install a package from outside the subsystem, use the following command:

apx <subsystem name> install leafpad

This works because Apx abstracts the package managers of different distributions, allowing you to use a consistent command regardless of the underlying package manager. For more details, you can explore the package manager management feature of Apx.

Once leafpad is installed in the OpenSUSE subsystem, you can export it to use on the host system by specifying the application name or binary name. For GUI applications that have desktop files, you can specify the application name, while command-line applications should use the binary name. To export leafpad, run:

apx suse export -a leafpad

After exporting, you will be able to launch leafpad directly from the application launcher.

App Launcher

To remove a package, you can either enter the subsystem and use the distribution’s package manager to remove it, or you can run the following command from outside the subsystem:

apx suse remove leafpad

VSO

Below are the commands related to package management in vso.

CommandAction
vso installInstall a package
vso removeRemove a package
vso searchSearch for a package
vso updateUpdate the repository
vso upgradeUpdate a package
vso exportExport a package to the host system
vso unexportCancel the export of a package

Apx

Apx is a management tool for subsystems in Vanilla OS, which abstracts package managers like apt, DNF, and zypper within subsystems and allows you to operate them from outside the subsystem. In other words, you can manage subsystem packages without being concerned about which package manager the subsystem is using. Below are some commands. Essentially, you can think of the vso command as being replaced by apx <subsystem name>, which should make it easier to understand.

CommandAction
apx <subsystem name> installInstall a package within the subsystem
apx <subsystem name> removeRemove a package within the subsystem
apx <subsystem name> searchSearch for a package within the subsystem
apx <subsystem name> updateUpdate the repository within the subsystem
apx <subsystem name> upgradeUpdate a package within the subsystem
apx <subsystem name> exportExport a package to the host system
apx <subsystem name> unexportCancel the export of a package
apx <subsystem name> enterEnter the subsystem

Conclusion

In this guide, we’ve explored how to manage packages in Vanilla OS. Because Vanilla OS seamlessly integrates an immutable host system with mutable subsystems, there can be a steep learning curve for those new to immutable distributions. I hope this article helps clarify some of the key concepts and tools used in Vanilla OS. If you have any questions or need further assistance, feel free to reach out!