Monthly Archives: December 2019

Introducing show-motd, Message Of The Day for WSL and container shells

People logging in to Ubuntu systems via SSH or on the virtual terminals are familiar with the Message Of The Day greeter which contains useful URLs and important system information including the number of updates that need to be installed manually.

However, when starting a Ubuntu container or a Ubuntu terminal on WSL, you are entering a shell directly which is way less welcoming and also hides if there are software updates waiting to be installed:

user@host:~$ lxc shell bionic-container
root@bionic-container:~#

To make containers and the WSL shell friendlier to new users and more informative to experts it would be nice to show MOTD there, too, and this is exactly what the show-motd package does. The message is printed only once every day in the first started interactive shell to provide up-to-date information without becoming annoying. The package is now present in Ubuntu 19.10 and WSL users already get it installed when running apt upgrade.
Please give it a try and tell us what you think!

Bug reports, feature requests are welcome and if the package proves to be useful it will be backported to current LTS releases!

Ubuntu on WSL: X and sound server detection explained

When I started using Ubuntu more than a decade ago I was impressed how well it worked out of the box. It detected most of my machine’s hardware and I could start working on it immediately. The Windows Subsystem for Linux is a much newer Ubuntu platform which can also run graphical applications without any extra configuration inside Ubuntu.

If you set up and start an X server or a PulseAudio server on Windows and start Ubuntu in WSL, the starting Ubuntu instance detects the presence of the servers and caches the configuration while the instance is running. The detection takes a few hundred milliseconds at the first start in the worst case, but using a cached configuration is fast and the delay is unnoticeable in subsequently started shells.

The detection is performed by /etc/profile.d/wsl-integration.sh from the wslu package and the configuration is cached in $HOME/.cache/wslu/integration.

If you would like to use a different X or sound configuration, like redirecting graphical applications to a remote X server you can prepopulate the cached configuration with a script running before /etc/profile.d/wsl-integration.sh or you can disable the detection logic with a similar script by making $HOME/.cache/wslu/integration an empty file.