62

Recently, whenever I run apt update/upgrade, I get the following message in the terminal:

Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro

Does anyone know any way to get rid of this?

7
  • 2
    Cannot be seen on my 22.04 system but it certainly looks like one of the scripts in /etc/update-motd.d could be causing this annoyance. General info here: ubuntu.com/legal/motd, looks easy enough to disable: "/etc/default/motd-news has an ENABLED=1 setting that if set to 0 will turn off this functionality."
    – andrew.46
    Oct 9 at 8:44
  • 2
    WTF? When did this start? And where/what version are you using? I'm using Ubuntu 20.04, never seen an ad, and don't want to.
    – John C
    Oct 10 at 0:40
  • 3
    Likely of interest - Ubuntu Pro APT integration is a bit much so the problem should reduce with time (at the very least) ; though I also noticed it as occurring on Kubuntu or a desktop flavor too
    – guiverc
    Oct 10 at 2:28
  • 2
    Consider evaluating other DEB based distros? Debian, Devuan, etc all exist and work. Voting with your feet might be a reasonable action. You're not stuck with one distro.
    – Criggie
    Oct 11 at 20:48
  • 1
    There is a bug report on this. bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/… Oct 13 at 13:26

7 Answers 7

15

strace says it comes from here:

33812 openat(AT_FDCWD, "/var/lib/ubuntu-advantage/messages/apt-pre-invoke-no-packages-apps.tmpl", O_RDONLY) = 3
33812 read(3, "Try Ubuntu Pro beta with a free "..., 8191) = 111

So:

sudo rm /var/lib/ubuntu-advantage/messages/*.tmpl
9
  • 3
    Upon a restart, the message comes back again, so this "fix" is only temporary. Is there anyway to make it more permanent perhaps? Oct 9 at 23:05
  • @Scotty /var/lib is for "Variable state information for programs", so there's probably a separate config file elsewhere, maybe in /etc. Cf. How to disable the advertisements when sshing into an Ubuntu machine
    – wjandrea
    Oct 10 at 0:01
  • Remove those files via /etc/rc.local?
    – Waxrat
    Oct 10 at 16:58
  • FWIW, I rebooted my Ubuntu host and those files did not reappear.
    – Waxrat
    Oct 10 at 17:14
  • 2
    The messages did eventually come back. Apparently created by /usr/lib/python3/dist-packages/uaclient/messages.py. Search for SS_LEARN_MORE and change it to SS_LEARN_MORE = ""
    – Waxrat
    Oct 11 at 11:05
13

One option is to create a symbolic link for 20apt-esm-hook.conf to /dev/null:

sudo ln -s -f /dev/null /etc/apt/apt.conf.d/20apt-esm-hook.conf

Another option is to just comment out the action lines in that file:

sudo sed -i'' -e 's/^\(\s\+\)\([^#]\)/\1# \2/' /etc/apt/apt.conf.d/20apt-esm-hook.conf

Or a third option is to just rename that file to a .bak file, and create a zero length file of the same name:

sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak
sudo touch /etc/apt/apt.conf.d/20apt-esm-hook.conf
2
  • 3
    This seems like the most complete and correct answer to me. Although when using a symbolic link to /dev/null I get an notice about it not being a 'regular file'. That third option for the win. Thank you. Oct 19 at 11:37
  • This is the first thing I've tried that really lasted across an apt update and reboot. Oct 19 at 18:00
12

Remove message of the day file and disable Ubuntu Advantage:

sudo rm /etc/update-motd.d/88-esm-announce
sudo systemctl disable ubuntu-advantage
1
  • 2
    This isn't an answer to the question: you got the wrong advert. The question is about a different advert.
    – wizzwizz4
    Oct 11 at 22:20
5

I would just do:

apt-get  --assume-yes  --purge  remove  ubuntu-advantage-tools
2
  • 2
    This appears to be the best answer. When you remove this package, it also removes OTHER branding packages that aren't needed - "ubuntu-advantage-tools* ubuntu-minimal* ubuntu-server* update-manager-core* update-notifier-common*". You can add them back (if needed) without bringing in the tools package.
    – xrobau
    Oct 21 at 2:09
  • 1
    Unfortunately, if you want to install the package ttf-mscorefonts-installer it will pull update-notifier-common and ultimately the ubuntu-advantage-tools. In conclusion there is no way to get rid of the ads with deleting ttf-mscorefonts-installer altogether. Oct 25 at 16:32
4

You can also raise a complaint at: https://ubuntu.com/legal/data-privacy/enquiry

The fact there is no easy way to switch off these messages is probably against data protection regulations in many countries.

For instance in the UK, it is illegal to market to any user of a service without asking for prior consent and giving you an opportunity to say no.

1
  • 3
    I don’t like it but I don’t think it’s illegal in the U.K. (though I’m no lawyer). It’s not direct marketing as it’s a feature of the system that produces the messages. It’s not targeted; direct marketing (prohibited without consent) would be things like keeping a database of users and emailing them. This is different, and you can opt out by stopping using the os - unlike receiving unsolicited mail. But I agree - complain as it’s not in the spirit of Ubuntu.
    – Will
    Oct 14 at 19:10
3

@waxrat has the answer for removing that message. However, the Ubuntu Pro is the new replacement for Ubuntu Advantage that allows up to 5 systems now and you can purchase up to 10 years of security updates. Ubuntu 22.04 LTS now comes with Ubuntu Pro instead of Ubuntu Advantage, and that is why you are probably seeing that message since Canonical seems to be moving away from UA.

terrance@terrance-ubuntu:~$ ua status
SERVICE          ENTITLED  STATUS    DESCRIPTION
esm-infra        yes       enabled   Expanded Security Maintenance for Infrastructure
livepatch        yes       enabled   Canonical Livepatch service

Enable services with: pro enable <service>

     Account: xxxxxxx@xxxxxx.com
Subscription: xxxxxxx@xxxxxx.com

and

terrance@terrance-ubuntu:~$ pro status
SERVICE          ENTITLED  STATUS    DESCRIPTION
esm-infra        yes       enabled   Expanded Security Maintenance for Infrastructure
livepatch        yes       enabled   Canonical Livepatch service

Enable services with: pro enable <service>

     Account: xxxxxxx@xxxxxxx.com
Subscription: xxxxxxx@xxxxxxx.com

and some pro --help:

terrance@terrance-ubuntu:~$ pro --help
usage: pro <command> [flags]

Client to manage Ubuntu Pro services on a machine.
 - cc-eal: Common Criteria EAL2 Provisioning Packages
   (https://ubuntu.com/cc-eal)
 - esm-infra: Expanded Security Maintenance for Infrastructure
   (https://ubuntu.com/security/esm)
 - fips-updates: NIST-certified core packages with priority security updates
   (https://ubuntu.com/security/certifications#fips)
 - fips: NIST-certified core packages
   (https://ubuntu.com/security/certifications#fips)
 - livepatch: Canonical Livepatch service
   (https://ubuntu.com/security/livepatch)
 - usg: Security compliance and audit tools
   (https://ubuntu.com/security/certifications/docs/usg)

Flags:
  -h, --help       show this help message and exit
  --debug          show all debug log messages to console
  --version        show version of pro

Available Commands:
  
    attach         attach this machine to an Ubuntu Pro subscription
    api            Calls the Client API endpoints.
    auto-attach    automatically attach on supported platforms
    collect-logs   collect Pro logs and debug information
    config         manage Ubuntu Pro configuration on this machine
    detach         remove this machine from an Ubuntu Pro subscription
    disable        disable a specific Ubuntu Pro service on this machine
    enable         enable a specific Ubuntu Pro service on this machine
    fix            check for and mitigate the impact of a CVE/USN on this
                   system
    security-status
                   list available security updates for the system
    help           show detailed information about Ubuntu Pro services
    refresh        refresh Ubuntu Pro services
    status         current status of all Ubuntu Pro services
    version        show version of pro

Use pro <command> --help for more information about a command.
0
1

To get rid of the spam, uninstall the program generating the spam.

The package that generates this spam is ubuntu-advantage-tools. Unfortunately removing it is tricky since Ubuntu devs have decided to make this a required system package so they can make more money (yes, that is their official justification).

A clever person named vi0oss came up with a workaround: replace the spammy package with an additional package which Provides, Breaks and Conflicts with ubuntu-advantage-tools

Guide

  1. Download the fake package. Here is a link to their package, which I have also attached to this Ubuntu bug report about the improper linking for posterity.
  2. (Optional) Verify package with dpkg -I fake-ubuntu-advantage-tools.deb to check the metadata:
 new Debian package, version 2.0.
 size 744 bytes: control archive=384 bytes.
     300 bytes,     8 lines      control              
 Package: fake-ubuntu-advantage-tools 
 Version: 0.1
 Architecture: all
 Conflicts: ubuntu-advantage-tools
 Breaks: ubuntu-advantage-tools
 Provides: ubuntu-advantage-tools
 Description: Ban ubuntu-advantage-tools while satisfying ubuntu-minimal dependency
 Maintainer: Vitaly _Vi Shukela
  1. (Optional) Verify package with dpkg -c fake-ubuntu-advantage-tools.deb to check it's actually empty:
drwxr-xr-x root/root         0 2022-10-31 11:58 ./
  1. Install the package: apt install ./fake-ubuntu-advantage-tools.deb
The following packages will be REMOVED:
  ubuntu-advantage-tools
The following NEW packages will be installed:
  fake-ubuntu-advantage-tools
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
  1. No more ads!
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 1 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.