This is now much easier to do with the most recent version of update-notifier by creating a marker file called hide-esm-in-motd in /var/lib/update-notifier/.
Check version of update-notifier
Depending on which version of Ubuntu you have installed, make sure you've upgraded to a version of update-notifier that implements this change.
You can check to see which version you have installed by running the following command:
apt-cache policy update-notifier
Make sure you have at least the following version or greater installed:
Xenial 16.04
Bionic 18.04
- update-notifier 3.192.1.21
Focal 20.04
- update-notifier 3.192.30.19
Jammy 22.04
- update-notifier 3.192.54.8
Noble 24.04
If you have an earlier version, upgrade using sudo apt upgrade.
Bug Report
This was reported as Bug #2015420 on Launchpad, where you can read more information about it.
The origin of this bug was first discussed on GitHub:
ua/pro/ubuntu-advantage does not disable the MOTD advertising ESM updates
Implement the fix
Create the marker file:
sudo touch /var/lib/update-notifier/hide-esm-in-motd
This will cause the /usr/lib/update-notifier/update-motd-updates-available script to include a --no-esm-messages flag when generating the outputs in the file: /var/lib/update-notifier/updates-available. This script is called whenever you run apt update.
Before implementing this change, you'll see the following at the bottom of your MOTD at login:
--------------------------------------------------------
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
After creating the marker file, run the following commands to test:
sudo rm /var/lib/update-notifier/updates-available
sudo apt update
Then logout/login or connect via with ssh localhost and you'll notice that the ESM message is no longer present at the bottom of the MOTD:
--------------------------------------------------------
0 updates can be applied immediately.
Note
The bug description on Launchpad indicates that the marker file should be in /var/lib/ubuntu-advantage/, but on my systems, I place the file in /var/lib/update-notifier/ instead.
If you look at the source code for the script, /usr/lib/update-notifier/update-motd-updates-available, you'll see the following section. This clearly indicates that the marker file is in var/lib/update-notifier/ and not var/lib/ubuntu-advantage/.
# should we hide esm-related information in the output
no_esm_file="/var/lib/update-notifier/hide-esm-in-motd"
if [ -e "$no_esm_file" ]; then
NO_ESM_MESSAGES="--no-esm-messages"
fi