Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  14] [ 0]  / answers: 1 / hits: 3965  / 2 Years ago, sat, july 23, 2022, 11:21:08

I would like to inhibit the generation of the following messages when I ssh into my machine


Expanded Security Maintenance for Applications is not enabled.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

For some reason (I do not care to speculate why) these messages are not emitted through the normal motd process, but seem to emanate from update-notifier. There are scripts in the motd directory that appear to generate these messages, but removing them has no effect.


How can I prevent my system from generating these messages at login?


More From » 20.04

 Answers
6

These messages are defined in /usr/lib/update-notifier/apt_check.py with no flags to disable them.


Here's a sed command that will neuter the functions that generate the messages by inserting a return statement as the first line of the message function:


sudo sed -Ezi.orig 
-e 's/(def _output_esm_service_status.outstream, have_esm_service, service_type.:
)/1 return
/'
-e 's/(def _output_esm_package_alert.*?
.*?
.:
)/1 return
/'
/usr/lib/update-notifier/apt_check.py

A diff of the old and new files looks like this:


$ diff -u /usr/lib/update-notifier/apt_check.py{.orig,}
--- /usr/lib/update-notifier/apt_check.py.orig 2023-02-22 11:33:39.476095290 -0500
+++ /usr/lib/update-notifier/apt_check.py 2023-02-22 11:59:41.396527682 -0500
@@ -160,6 +160,7 @@
def _output_esm_package_alert(
outstream, service_type, disabled_pkg_count, is_esm=False
):
+ return
" output the number of upgradable packages if esm service was enabled "
outstream.write("
")
if disabled_pkg_count > 0:
@@ -206,6 +207,7 @@


def _output_esm_service_status(outstream, have_esm_service, service_type):
+ return
if have_esm_service:
outstream.write(gettext.dgettext("update-notifier",
"Expanded Security Maintenance for "

Test the fix with this command:


$ /usr/lib/update-notifier/apt_check.py --human-readable
1 update can be applied immediately.
To see these additional updates run: apt list --upgradable

Regenerate the cached message file


sudo /usr/lib/update-notifier/update-motd-updates-available --force

[#47] Sunday, July 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
feeous

Total Points: 102
Total Questions: 122
Total Answers: 119

Location: Netherlands
Member since Thu, Jul 1, 2021
3 Years ago
feeous questions
Mon, Jul 5, 21, 19:59, 3 Years ago
Mon, Aug 16, 21, 11:42, 3 Years ago
Sun, Mar 19, 23, 21:03, 1 Year ago
Wed, Dec 8, 21, 08:32, 2 Years ago
;