Page MenuHomeFreeBSD

motd: stop prepending "uname -v" output dynamically
Needs ReviewPublic

Authored by michaelo on Feb 1 2024, 6:25 PM.
Tags
None
Referenced Files
F153972791: D43703.diff
Sat, Apr 25, 4:58 AM
Unknown Object (File)
Thu, Apr 23, 2:10 PM
Unknown Object (File)
Tue, Apr 21, 5:14 PM
Unknown Object (File)
Fri, Apr 10, 8:03 AM
Unknown Object (File)
Mar 7 2026, 4:51 AM
Unknown Object (File)
Feb 28 2026, 7:17 AM
Unknown Object (File)
Feb 27 2026, 4:04 AM
Unknown Object (File)
Feb 3 2026, 11:40 PM
Subscribers

Details

Summary

Make the motd generation completely static with this change.
Prepending the output of uname(1) may lead to confusing and/or incorrect
output if you are in a jail which has a different version of world
compared to the jailhost kernel/world. For those who need a fully
dynamic motd can still use sysutils/dynamic_motd port.

PR: 276763
Approved by: jrm (mentor), otis (mentor), emaste

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 72495
Build 69378: arc lint + arc unit

Event Timeline

This one comes from: https://github.com/BastilleBSD/bastille/issues/393

Feel free to add someone you think appropriate to review.

I don't have strong options either way. On the one hand, I can appreciate how this would confuse some users when they log in to a jail. On the other hand, I expect some users would miss seeing this information (by default) when they log in. While it may also be confusing, it's reporting accurate information that many would expect, i.e., version information about the running kernel.

Brainstorming ideas, what about appending something like this to /var/run/motd?

echo "$(hostname) $(uname -smi) running kernel/userland: $(uname -r)/$(freebsd-version -u)"

In a 14 jail running on a 15-CURRENT host, the output looks like this.

myhostname FreeBSD amd64 GENERIC-NODEBUG running kernel/userland: 15.0-CURRENT/14.0-RC4
In D43703#1000910, @jrm wrote:

I don't have strong options either way. On the one hand, I can appreciate how this would confuse some users when they log in to a jail. On the other hand, I expect some users would miss seeing this information (by default) when they log in. While it may also be confusing, it's reporting accurate information that many would expect, i.e., version information about the running kernel.

Brainstorming ideas, what about appending something like this to /var/run/motd?

echo "$(hostname) $(uname -smi) running kernel/userland: $(uname -r)/$(freebsd-version -u)"

In a 14 jail running on a 15-CURRENT host, the output looks like this.

myhostname FreeBSD amd64 GENERIC-NODEBUG running kernel/userland: 15.0-CURRENT/14.0-RC4

Yeah, I am open as well. What I would like to see is consistency: either no information or always correct information. What I don't know whether we should try to add something which is done by sysutils/dynamic_motd already. I also wonder whether both freebsd-version -r/freebsd-version -u can also confuse users. While we could introduce a parameter with none, kernel, userland, both, but then we are back with sysutils/dynamic_motd.

Remove MFC since it might violate POLA.

How to proceed with this review? I still have the feeling that we shouldn't try
two replicate the dynamic motd port here.

How to run commands in the motd?

How to run commands in the motd?

You can't, you have to switch to sysutils/dynamic_motd.

Folks, is this change something we should abandon or still worth considering for 15?

Rebase...

Should we (re)consider this for 16-CURRENT or abandon?

Rebase

I think this one is still worth pursuing since the actual problem is not solved.

Login into a jail:
$ ssh cafe-custom-uis@cui-dev.cafe
Last login: Thu Apr 23 19:06:07 2026 from dw-eng-rsc.innomotics.net
FreeBSD 14.4-STABLE (GENERIC) 818243722

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories: https://www.FreeBSD.org/security/
FreeBSD Handbook: https://www.FreeBSD.org/handbook/
FreeBSD FAQ: https://www.FreeBSD.org/faq/
Questions List: https://www.FreeBSD.org/lists/questions/
FreeBSD Forums: https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with: pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed: freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages: man man
FreeBSD directory layout: man hier

To change this login announcement, see motd(5).
$ bash
cafe-custom-uis@deblndw013x3j:/usr/home/cafe-custom-uis
$ freebsd-version
14.4-RELEASE-p1