Get Rid of Ubuntu Pro Advertisement when Updating Apt

Getting rid of terminal ads on Ubuntu.

The Problem

$ sudo apt upgrade
[...]
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
[...]

The Solution

By the looks of it, the advertisement message is coming from the following file /etc/apt/apt.conf.d/20apt-esm-hook.conf:

$ sudo strace apt upgrade
[...]
openat(AT_FDCWD, "/etc/apt/apt.conf.d/20apt-esm-hook.conf", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
[...]

Truncate the file:

$ sudo truncate -s0 /etc/apt/apt.conf.d/20apt-esm-hook.conf

Disable services:

$ sudo systemctl disable --now apt-news.service esm-cache.service

Set Ubuntu Pro configuration to disable apt news:

$ sudo pro config set apt_news=false

2 thoughts on “Get Rid of Ubuntu Pro Advertisement when Updating Apt

  1. This post is helpful, thankyou.

    You probably also what `systemctl disable –now apt-news.service` and possibly just remove the ubuntu-advantage-tools package altogether. Thoughts?

Leave a Reply

Your email address will not be published. Required fields are marked *