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 Daniel T)
$ sudo dpkg-divert --rename --divert /etc/apt/apt.conf.d/20apt-esm-hook.conf.disabled --add /etc/apt/apt.conf.d/20apt-esm-hook.conf
(Please note that the --rename
option can be omitted on Ubuntu 22.04 and later, since this is now the default.)
By moving this file, the entire apt
ESM hook is disabled and will never run. The dpkg-divert
will ensure that this file will always be redirected, even when ubuntu-advantage-tools
are upgraded and tries to install the file again.
dpkg-divert
might be safer than moving the file in/etc/apt
in ensuring the file is not recreated – Daniel T Jan 30 '24 at 07:53dpkg-divert
. – Artur Meinild Jan 30 '24 at 09:20