Adding and Updating Packages¶
One of the benefits of using eLxr is that the ability to perform updates is included by default in each image.
About This Task¶
Once your eLxr 12 image is up and running, you can use the built-in package management features to customize it for your own use. The type of package management available is determined by the image type. For example, images without OSTree support include the APT package manager as described in this procedure. Images with OSTree support include apt-ostree package management, which supports system wide updates in addition to packages changes.
While it is possible to use apt-get install to install a package to an OSTree image, doing so will only add the package to the current boot repository. It will not set up the new package changes for a new OSTree deployment, and can even cause issues with package dependencies. To ensure successful package management with OSTree images, always use apt-ostree install with OSTree images.
This procedure uses the default package repositories included with eLxr. If you require a Debian package that is not included in the eLxr repository, you can add it manually by updating the /etc/apt/sources.list file. Each entry in this file represents a different package repository. By default, eLxr includes the following repository:
$ cat /etc/apt/sources.list
deb [trusted=yes] https://mirror.elxr.dev/elxr aria main
To add a new repository, update this file, for example.
$ cat /etc/apt/sources.list
deb [trusted=yes] https://mirror.elxr.dev/elxr aria main
deb https://deb.debian.org/debian bookworm contrib main
Once updated, run the apt-get update command to make the repository available in your system.
Note
It is a good practice to only include Debian bookworm repositories to ensure compatibility and successful operation.
Before You Begin¶
You must be logged in to a running eLxr 12 image. For details, see booting-the-elxr-image.
Procedure¶
Update the package database.
root@localhost:~# apt-get update Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB] Get:2 http://10.249.254.4 elxr InRelease [11.6 kB] Get:3 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB] Get:4 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB] Get:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [157 kB] Get:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [93.6 kB] Get:7 http://10.249.254.4 elxr/main amd64 Packages [425 kB] Get:8 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB] Get:9 http://deb.debian.org/debian bookworm/main Translation-en [6109 kB] Get:10 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.8 kB] Get:11 http://deb.debian.org/debian bookworm-updates/main Translation-en [16.0 kB] Fetched 15.9 MB in 4s (4106 kB/s) Reading package lists... Done
Add the openssh-server package.
For standard images, use the apt-get install command:
root@localhost:~# apt-get install openssh-server
For OSTree images, use the apt-ostree install command. This will ensure the package is added to the OSTree repository and be available when the system reboots.
root@localhost:~# apt-ostree install openssh-server
Test the package installation.
root@localhost:~# sshd -V OpenSSH_9.2, OpenSSL 3.0.11 19 Sep 2023
Obtain additional information about the package.
If you want to know where the package derives from, and who maintains it, you can find out with the apt show command.
$ apt show openssh-server Package: openssh-server Version: 1:9.2p1-2+deb12u2 Priority: optional Section: net Source: openssh Maintainer: Debian OpenSSH Maintainers <debian-ssh@lists.debian.org> Installed-Size: 1,972 kB Provides: ssh-server Pre-Depends: init-system-helpers (>= 1.54~) Depends: adduser, libpam-modules, libpam-runtime, lsb-base, openssh-client (= 1:9.2p1-2+deb12u2), openssh-sftp-server, procps, ucf, debconf (>= 0.5) | debconf-2.0, runit-helper (>= 2.14.0~), libaudit1 (>= 1:2.2.1), libc6 (>= 2.36), libcom-err2 (>= 1.43.9), libcrypt1 (>= 1:4.1.0), libgssapi-krb5-2 (>= 1.17), libkrb5-3 (>= 1.13~alpha1+dfsg), libpam0g (>= 0.99.7.1), libselinux1 (>= 3.1~), libssl3 (>= 3.0.11), libsystemd0, libwrap0 (>= 7.6-4~), zlib1g (>= 1:1.1.4) Recommends: default-logind | logind | libpam-systemd, ncurses-term, xauth Suggests: molly-guard, monkeysphere, ssh-askpass, ufw Conflicts: sftp, ssh-socks, ssh2 Breaks: runit (<< 2.1.2-51~) Replaces: openssh-client (<< 1:7.9p1-8), ssh, ssh-krb5 Homepage: https://www.openssh.com/ Download-Size: 456 kB APT-Manual-Installed: yes APT-Sources: http://10.249.254.4 wr/main amd64 Packages Description: secure shell (SSH) server, for secure access from remote machines This is the portable version of OpenSSH, a free implementation of the Secure Shell protocol as specified by the IETF secsh working group. . Ssh (Secure Shell) is a program for logging into a remote machine and for executing commands on a remote machine. It provides secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. It can be used to provide applications with a secure communication channel. . This package provides the sshd server. . In some countries it may be illegal to use any encryption at all without a special permit. . sshd replaces the insecure rshd program, which is obsolete for most purposes.
To view all the available packages, use the apt list command.
$ apt list --- Lots of output as all packages list ---
To view the specific version of a package, use apt list <packageName*>.
$ apt list openssh-server openssh-server/wr,stable,now 1:9.2p1-2+deb12u2 amd64 [installed]
Note that this command works on installed and available packages alike. This is a good command to use to determine whether the package version you require is available in the repository.
To view information about the origins of a package, use the apt policy <packageName*> command.
Similar to apt list, this command works on installed and available packages. Use this command if you want to know which repository a package originates from.
$ apt policy openssh-server openssh-server: Installed: 1:9.291-2+deb12u3 Candidate: 1:9.291-2+deb12u3 Version table: *** 1:9.291-2+deb12u3 500 500 https:/mirror.elxr.dev/elxr aria/main amd64 Packages 100 /var/lib/dpkg/status 1:9.291-2+deb12u3 500 500 https:/mirror.elxr.dev/elxr aria/main amd64 Packages 500 https://deb.debian.org/debian bookworm/main amd64 Packages
Optionally perform additional package management actions.
Note
Package updates with APT are supported in both system (hardware) and container images.
Choose an option from the table.
Update Type
Command to run
Install
Single package:
$ apt-get install <packageName> $ apt-ostree install <packageName>
Multiple packages:
$ apt-get install <packageName1> <packageName2> $ apt-ostree install <packageName1> <packageName2>
Remove
$ apt-get remove <packageName> $ apt-ostree remove <packageName>
Update the package indices
The APT package manager caches package feed indices locally. This command is required to load the new feed indicies. Although the package management tools periodically update these indices, you need to explicitly update the cache to see changes in the package feeds immediately.
$ apt-get update
Upgrade packages
- Single package:
$ apt-get install --only-upgrade <packageName> $ apt-ostree install --only-upgrade <packageName>
All packages:
$ apt-get upgrade
Results¶
Now that you have customized the packages on your eLxr 12 image, see the eLxr Application and Package Development Guide for additional information on developing your distribution.