Skip to content

Creating a custom motd on Debian Jessie

Chris edited this page Dec 26, 2017 · 10 revisions

A couple of hours in the evening, a couple of hours in the after, and a few questions on IRC later, I have a custom motd (message of the day). I'm taking the time to write this article just for the sheer fact that this process took way longer than expected, and for the fact that I want to have something to reference if I ever have to do this again.

cheers 🍻
Chris

So if I remember correctly Debian 8 (Jessie) was the first major version of Debian to introduce systemd (let's not go down the systemd love / hate rabbit πŸ‡ hole) shall we.

So, doing a quick google search for debian motd will more than likely put this article in the top of the results. Now as informative at that article is, I find lacking some information to complete the custom motd on a Debian 8 (Jessie) box. I'll try and fill the gaps where that article leaves off.

For starters, my Debian 8 box is a digital ocean droplet, and not a Raspberry Pi.

So the first I noticed, is that motd is now a service provided by systemd. If one try's to run the below command,

systemctl start motd

your more than likely not going to get that far, just for the fact that the motd service is in a masked state. So before you can even enable the motd service, you're going to want to "unmask" the service. So if your thinking well let me just run the below command,

systemd unmask motd

however, that won't get you that far either. 😏 So after going back to the googler and refining my searches I came across this nice answer. So if you don't want to go down the link rabbit πŸ‡ hole (can't say that I don't blame you) then I will try and transpose what that answer states. If the systemd service is linked to /dev/null then run the below commands.

file /lib/systemd/system/motd.service

which should return

/lib/systemd/system/motd.service: symbolic link to /dev/null

so your going to want to delete,

sudo rm /lib/systemd/system/motd.service

Since you changed a unit file, you need to run this:

sudo systemctl daemon-reload

now check the status:

systemctl status motd

Now it's green and running :) The service has no systemd unit file, but systemd happily uses the script for it in /etc/init.d instead.

Clone this wiki locally