posts: ubuntu motd ads
All checks were successful
/ Deploy blog to deuterium (push) Successful in 1m10s

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2024-11-22 20:29:45 -05:00
parent d9d7ea1888
commit 18455362d3
3 changed files with 40 additions and 0 deletions

40
posts/ubuntu-motd-ads.md Normal file
View file

@ -0,0 +1,40 @@
---
title: You can turn off the Ubuntu Server ads
summary: Thanks for not making it super hard!
time: 1732324971
---
FreeBSD fans may be sad to hear that I recently migrated my [custom-built FreeBSD NAS](/custom-nas) to Ubuntu Server LTS[^1]. This was because:
1. I now run a Jellyfin media server on my NAS.[^2]
2. I miss systemd.[^3]
The bad news is that Ubuntu ships with ads on login:
<figure>
<img src="/img/ubuntu-motd-ads/ubuntu-motd-before.png" class="vertical" alt="I log into a machine called silicon. Before the shell prompt, the machine shows a bunch of useful info, like OS version, system usage, and current IP addresses, but also links to Ubuntu Pro paid support, an ad for 'secure Kubernetes at the edge', and a different ad for Expanded Security Maintenance for Applications (ESM Apps).">
<figcaption>ESM Apps users must sleep so much more soundly at night than I do.</figcaption>
</figure>
The good news is that it's easy to turn them off!
All these messages are written out by shell scripts in `/etc/update-motd.d/`, and you can simply delete the shell scripts that output ads. I deleted `10-help-text`, `50-motd-news`, `90-updates-available`, `91-contract-ua-esm-status`. The one that checked for updates seemed useful, but ended with an ad, so I wrote my own replacement for it that didn't do that.
```
$ cat 90-updates-available
#!/usr/bin/env bash
echo $(apt list --upgradable 2>/dev/null | grep -v '^Listing' | wc -l) updates available according to current apt db.
```
Note that good, well-behaved motd scripts should cache their output, but I'm lazy and don't mind the half second delay my script causes. You can do better, if you feel like it.
And now logging in is much nicer:
<figure>
<img src="/img/ubuntu-motd-ads/ubuntu-motd-after.png" class="vertical" alt="I log into silicon again, and this time the machine only displays the useful stuff before the shell prompt.">
<figcaption>Finally, I can rest easy not knowing what ESM Apps are.</figcaption>
</figure>
[^1]: Now, I much prefer [Rocky Linux](https://rockylinux.org/) on most of my servers, but apparently the current ZFS-on-Linux kernel module for RHEL 9 doesn't support a feature flag that my previous FreeBSD installation enabled. Ubuntu 24.04 had a newer module that worked with my existing ZFS pool.
[^2]: [Jellyfin does not officially support FreeBSD](https://jellyfin.org/docs/general/installation/), and the [unofficial port](https://www.freshports.org/multimedia/jellyfin/) won't let me enable hardware acceleration. My poor old pre-Ryzen AMD APU is not up to software encoding as well as I would like.
[^3]: Writing a timer is much easier and more testable than writing a cron job, you can have multiple instances of the same service without much headache, and honestly it's what I'm familiar with. Oh, and user services are great for running backup scripts without root access. I'm sure writing `rc.d` scripts is second nature to some folks, but it feels arcane to me.

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB