Let's explore the service files to see what info is available:
$ cat /lib/systemd/system/apt-news.service
[Unit]
Description=Update APT News
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/apt_news.py
$ cat /lib/systemd/system/esm-cache.service
# The ESM apt cache will maintain information about what ESM updates are
# available to a system. This information will be presented to users in the apt
# output, or when running pro security-status. These caches are maintained
# entirely outside the system apt configuration to avoid interference with user
# definitions. This service updates those caches. This will only have effect
# on releases where ESM is applicable, starting from Xenial: esm-apps for
# every LTS, and esm-infra for systems in expanded support period after the LTS
# expires.
[Unit]
Description=Update the local ESM caches
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/esm_cache.py
The esm-cache.service
is a little more generous with information about its purpose, while the apt-news.service
don't really clarify much. However, 'APT News' was mentioned recently in another question, and one can conclude that it's connected to this apt
prompt.
Inspecting the apt
history further, it seems these services were installed with ubuntu-advantage-tools
version 27.13.X. (For me, this was rolled out with version 27.13.1 on 2023-01-27 for arm64
and with version 27.13.2 on 2023-01-29 for x64
.)
Since these services seem to only provide additional information in connection to running apt
(and pro security-status
), they should be safe to disable.
This is done by simply masking the service units from systemd
, like this:
$ sudo systemctl mask apt-news.service
$ sudo systemctl mask esm-cache.service
In addition, you can disable the entire apt
ESM hook by doing the following: (Thanks gatomon & Kelly)
$ sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.disabled
Now, the services never run anymore, and the entire apt
ESM hook has been disabled.
Important notice
Automatic update of ubuntu-advantage-tools
can break this configuration, and in addition a condition can be introduced where ubuntu-advantage-tools
are not properly configured after an automatic update if the 20apt-esm-hook.conf
file is moved.
In this case, it is advised to install ubuntu-advantage-tools
manually again to get it properly configured:
sudo apt install ubuntu-advantage-tools
After this, it may be necessary to configure the apt
ESM hook to be disabled again.