Score:107

How to get rid of Ubuntu Pro advertisement when updating apt?

gf flag

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?

andrew.46 avatar
in flag
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: https://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."
guiverc avatar
cn flag
@JohnC I've not seen it either (inc. on *jammy* [22.04] & *kinetic* [what will be 22.10]) but I'm largely a desktop user, and it depends I gather what ISO/media was used to install the system, plus what packages have been added as to whether or not you'll see it. Only a portion of users see it (*sorry I've not explored the code, nor taken much notice of the discussions over prior weeks-months on those changes; it's of no interest to me; there have been recent announcements on it*)
guiverc avatar
cn flag
Likely of interest - [Ubuntu Pro APT integration is a bit much](https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1992026) 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
Criggie avatar
za flag
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.
Mark Fraser avatar
mx flag
There is a bug report on this. https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1992026
cn flag
it is not an "advertisment". it is a "plug". Distinct difference between the 2.
reducing activity avatar
cn flag
@Rinzwind It is an advertisement without any doubt. Plugging a commercial product with standard phrasing shown automatically to all people using it IS an ad.
Score:62
ae flag

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
Luis Flores III avatar
au flag
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.
Glen Whitney avatar
cn flag
This is the first thing I've tried that really lasted across an `apt update` and reboot.
fr flag
I tried the 3rd option (rename the file etc.) and unfortunately it didn't work for me. Ubunut 22.04 LTS server.
Johan avatar
cn flag
The third option worked great for me on Ubuntu 20.04.5 LTS desktop. Thanks.
Score:21
ng flag

Remove message of the day file and disable Ubuntu Advantage:

sudo rm /etc/update-motd.d/88-esm-announce
sudo systemctl disable ubuntu-advantage
wizzwizz4 avatar
de flag
This isn't an answer to the question: you got the wrong advert. The question is about a different advert.
MacroMan avatar
us flag
@wizzwizz4 this worked for me
Score:16
id flag

The apt advert is opt-out, and Canonical's official way to do so is somewhat of a secret. The interface for disabling this is:

sudo pro config set apt_news=false

Source

Skye avatar
mq flag
I want to point out a disadvantage to this method -- Ubuntu may add more sources of spam to Ubuntu Advantage in future, and the user would have to set more and more undocumented flags for each spam type as they're added. However, for users who need Advantage installed, your solution seems like their only option. As such, I've added this method to the [overall guide on removing spam from Ubuntu](https://github.com/Skyedra/UnspamifyUbuntu) as one method and I thank you for sharing this secret flag with us.
sds avatar
cn flag
sds
This does not remove the `Get more security updates through Ubuntu Pro with 'esm-apps' enabled` message.
Score:13
cn flag

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
Scotty_Trees avatar
gf flag
Upon a restart, the message comes back again, so this "fix" is only temporary. Is there anyway to make it more permanent perhaps?
wjandrea avatar
cn flag
@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](/q/1083504/301745)
Waxrat avatar
cn flag
Remove those files via /etc/rc.local?
Waxrat avatar
cn flag
FWIW, I rebooted my Ubuntu host and those files did not reappear.
Waxrat avatar
cn flag
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 avatar
cn flag
Do the same for `TRY_UBUNTU_PRO_BETA`
cn flag
So stick the command in crontab ;-)
cn flag
@WaxratI I wonder if the message appeared after upgrading a certain package though, such as `ubuntu-advantage-tools` itself.
Waxrat avatar
cn flag
Likely an upgrade of that uaclient/messages.py caused the ad to start appearing. After I edited messages.py as described above, the ad stopped appearing
Score:12
mq flag

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. When this fix broke due to Ubuntu devs requiring a later version, gamemanj found a second workaround. All this has been bundled into the latest version linked below.

Guide

  1. Download the fake package here.
  2. (Optional) Verify package with dpkg -I fake-ubuntu-advantage-tools.deb to check the metadata to see how it works:
 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!

Bonus: I have uploaded a page with additional ubuntu spam fighting steps on github here to get rid of MOTD spam, etc.

Erkin Alp Güney avatar
kz flag
This workaround does not work anymore.
Greg Chabala avatar
us flag
@ErkinAlpGüney care to elaborate? It works fine for me.
Skye avatar
mq flag
I am still using this method myself on 22.10
Skye avatar
mq flag
Note - there was a request that changed the links to the waybackmachine internet archive. I have rejected this edit request as the archived version of that page does not allow the user to download the package, thus making the download link not useful.
wvengen avatar
us flag
It works, but also uninstalls e.g. `gnome-software` and `vanilla-gnome-desktop`, among others. Trying to install them, somehow pulls back in `ubuntu-advantage-tools`.
Skye avatar
mq flag
@wvengen gamemanj found a new workaround for this, I updated guide with a link to updated package
Score:7
mx flag

I would just do:

apt-get  --assume-yes  --purge  remove  ubuntu-advantage-tools
xrobau avatar
nz flag
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.
Cyril Chaboisseau avatar
in flag
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.
Score:5
dj flag
BFG

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.

Will avatar
id flag
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.
cn flag
«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.» <-- I think it's probably not a crime for Ubuntu to inform its existing users that they can get extra support for free that you previously accepted having to pay for.
ye flag
It’s the same message for everyone; this has nothing to do with data privacy.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.