A few months ago, Ubuntu started pushing ads for their Ubuntu Pro service to the command line interface apt command. When you run the apt
command from the terminal, you see this message:
Try Ubuntu Pro beta with a free personal subscription on up to 5 machines. Learn more at https://ubuntu.com/pro
Then about a week ago, more messages were pushed about the ESM service saying that more packages that can be upgraded if you subscribe to that service.
The above is simply annoying, and irrelevant, for many of us who run only Long Term Support (LTS) releases.
In my case, I tend to stay with them for at least two (if not three) years while the next LTS release matures a bit. ESM and Pro do not provide any value for my needs.
Here is how to get rid of the above messages.
From the command line, execute the following command:
sudo cp /dev/null etc/apt/apt.conf.d/20apt-esm-hook.conf
This basically empties out the script that is responsible for the messages.
If Ubuntu pushes out an update of the ubuntu-advantage-tools
package, it will try to reinstate the script. All you have to do is hit enter to accept the default of not overwriting your changes, like so:
1 package can be upgraded. Run 'apt list --upgradable' to see it.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
ubuntu-advantage-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/170 kB of archives.
After this operation, 3072 B of additional disk space will be used.
Do you want to continue? [Y/n]
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 103883 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.13.2~20.04.1_armhf.deb ...
Unpacking ubuntu-advantage-tools (27.13.2~20.04.1) over (27.13.1~20.04.1) ...
Setting up ubuntu-advantage-tools (27.13.2~20.04.1) ...
Configuration file '/etc/apt/apt.conf.d/20apt-esm-hook.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** 20apt-esm-hook.conf (Y/I/N/O/D/Z) [default=N] ?
Processing triggers for man-db (2.9.1-1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
That is it ...
Comments
Mostafa (not verified)
Thank you
Mon, 2023/01/30 - 00:30Thank you, I will have to try this as on my laptop the thought of having ads on the CLI would drive me mad.
Ferdinand Hari (not verified)
Broken command?
Thu, 2023/02/16 - 10:03Is this snippet broken? A `cp foo` can't do anything, as it's missing anywhere to copy the file to, nor would copying the hook somewhere appear to disable or break it.
Khalid
Typo
Thu, 2023/02/16 - 11:44You are right.
There was a typo, and the /dev/null part was omitted.
Fixed it.
Thanks