APT is used on KerOS to manage packages on the system.
It makes it possible for users to install or update available packages. APT can also manage packages installation from local sources.
Examples listed below aim at getting started with APT in command line. Please refer to the online documentation for further details.
Official Kerlink repository is pre-configured by default.
First, make sure that apt database is up-to-date:
sudo apt update
Any package available on the repository can now be installed using:
sudo apt install <package_name>
Example with the tcpdump
package:
sudo apt update && sudo apt install tcpdump
To install a new package from a third-party repository, please refer to the online APT documentation.
If you have a compatible Debian package "mypackage.deb" that you want to install :
sudo apt install ./mypackage.deb
Packages can be synchronized manually with latest available version using the following command:
sudo apt update && sudo apt dist-upgrade
sudo apt update && sudo apt upgrade <package_name>
Every time that dpkg must install a new conffile that you have modified or removed (a removed file is only a particular case of a modified file in dpkg’s eyes), it will stop the upgrade and wait for your answer. This can be particularly annoying for mass deployment. You may want to chose predefined answers to dpkg with the help of multiple --force-conf* options:
--force-confold
: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration files that you have not modified are left untouched. You need to combine it with --force-confdef
to let dpkg overwrite configuration files that you have not modified.--force-confnew
: always install the new version of the configuration file, the current version is kept in a file with the .dpkg-old suffix.--force-confdef
: ask dpkg to decide alone when it can and prompt otherwise. This is the default behavior of dpkg and this option is mainly useful in combination with --force-confold.--force-confmiss
: ask dpkg to install the configuration file if it’s currently missing (for example because you have removed the file by mistake).You can see all the force options using dpkg --force-help
.
If you use Apt, you can pass options to dpkg with a command-line like this:
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --assume-yes dist-upgrade
You can use unattended-upgrades
package to configure automatic upgrade on your gateway to keep it up-to-date with latest delivery of KerOS.
To install it, run the following command as root:
apt-get install unattended-upgrades
Note: unattended-upgrades is installed by default on KerOS >= 6.3
The default configuration file for the unattended-upgrades package is at /etc/apt/apt.conf.d/50unattended-upgrades
.
Any local customizations should be in /etc/apt/apt.conf.d/52unattended-upgrades-local
(see package README for details).
vi /etc/apt/apt.conf.d/52unattended-upgrades-local
As an example, the following configuration can be used to activate upgrade on all origin, and remove unused package :
Unattended-Upgrade::Origins-Pattern {
"origin=*";
}
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::SyslogEnable "true";
To activate unattended-upgrades, you need to ensure that the apt configuration stub /etc/apt/apt.conf.d/20auto-upgrades
contains at least the following lines:
APT::Periodic::Update-Package-Lists "always";
APT::Periodic::Unattended-Upgrade "always";
Apt update are triggered by systemd timers apt-daily.timer
and apt-daily-upgrade.timer
, designated to update & download package and deploying new package respectively.
root@klk-wifc-0304af:~# systemctl list-timers --all
NEXT LEFT LAST PASSED UNIT ACTIVATES
Tue 2024-12-10 03:32:08 UTC 13h Mon 2024-12-09 12:46:57 UTC - apt-daily.timer apt-daily.service
Tue 2024-12-10 06:49:51 UTC 16h Mon 2024-12-09 12:46:57 UTC - apt-daily-upgrade.timer apt-daily-upgrade.service
Tue 2024-12-10 13:12:52 UTC 22h Mon 2024-12-09 13:12:52 UTC 1h 11min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
- - Mon 2024-12-09 13:07:54 UTC 1h 16min ago keros-bootcount.timer keros-bootcount.service
- - Mon 2024-12-09 13:57:47 UTC 26min ago keros-security.timer keros-security.service
- - Mon 2024-12-09 13:57:47 UTC 26min ago stop-hostapd.timer stop-hostapd.service
6 timers listed.
You can tune the download timer using the following commands:
systemctl edit apt-daily.timer
You can tune the upgrade and clean timer using the following commands:
systemctl edit apt-daily-upgrade.timer
Two different kind of repositories are available from Kerlink to be deployed on your gateway:
stable
testing
This repository contains the most stable version of KerOS distribution package available for your gateways.
This repository contains new packages that have been tested by Kerlink, and eligible to be published as stable
for the next version. This repository allows you to test new packages. When the current testing
repository becomes mature and is released, testing
becomes the latest stable
release.
It is recommended only for lab testing purpose and NOT recommended for production.
The repository used by your gateway can be found in the file: /etc/apt/sources.list.d/keros-deb.list
:
deb https://deb.keros.wanesy.com/<machine> stable main
To change it, edit the file and change the word stable
to:
stable
testing