47

I installed Ubuntu 22.04 on Windows 11 using WSL. I then moved it on another disk with the WSL commands (--export/--import).

After moving it, the default user was root, so I added the below lines in /etc/wsl.conf:

[user]
default=numa

Now in the message which is shown once a day when I start Ubuntu (MOTD I think), I can see this message:

[/etc/update-motd.d/50-landscape-sysinfo: 17: cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied]

Although it seems to be no harm, I wonder how can I avoid this.

NotTheDr01ds
  • 22,082
Sinedolo
  • 643

4 Answers4

72

Short answer:

Two options:

  • Recommended:

    sudo apt remove landscape-common
    sudo apt autoremove # Optionally, but recommended so that you can 
    confirm the problem is gone after restarting
    rm ~/.motd_shown
    

    Exit and restart Ubuntu/WSL, and the error should no longer appear.

  • Or, if you enable Systemd per this answer, the error shouldn't appear either. However, I don't recommend enabling Systemd just to suppress this error message. That's a lot of overhead if you don't need it for other purposes.

More detail:

Don't worry - This isn't related to you moving the distribution. The problem is there in all 22.04 installations on WSL. Funny I never noticed it until you pointed it out -- That shows just how much attention I pay to the MOTD :-/.

This is reported at the bottom of this Github issue, but it's not related to that particular issue (which was previously, and continues to be, fixed).

The problem here is that the Ubuntu distribution for WSL is based on Ubuntu Server, which includes support for Landscape, a feature for managing servers.

This really isn't applicable to WSL, of course, and probably (I'm guessing here, but I'll try to confirm later) requires Systemd support anyway, which WSL does not have. I have a feeling that there's a Systemd unit that sets up the Landscape directory that isn't getting run on WSL; hence the error.

It's safe to remove this package with the above command, and the error will no longer appear.

NotTheDr01ds
  • 22,082
2

Fixed with:

sudo usermod -a -G landscape $USER

This command adds your user to the landscape group.

Then log out and log back in.

1

This answer already does a fine job of getting rid of the error message.

As a matter of taste, I prefer to run the following commands :

sudo apt remove -y landscape-common # Remove the package
sudo apt autoremove -y              # Remove orphaned packages
rm -rf ~/.landscape/                # Clean up, no longer used
mv ~/.motd_shown ~/.hushlogin       # Silence “Message Of The Day”
echo lsb_release -dc >> ~/.bashrc   # Display distro at login

Each of these commands should be run only once per Ubuntu distribution.
I've chosen to permanently disable the Message Of The Day (MOTD).
Instead, I modify ~/.bashrc to display a description of the Linux distro on each login. 1


1 Of course, the last two commands don't really have anything to do with the question asked.
I just prefer to replace the "MOTD" with something that's more useful to me.
In addition, I start WSL in the user's home directory, by calling wsl ~ -d Ubuntu rather than changing the directory in ~/.bashrc. I attribute this comment for pointing out the wsl ~ option to me. Either option is fine – it's just a matter of taste. However, if you want to use the ConEmu context menu, then you must not use either of the options. If you do, WSL will not start in the current directory – the one from where you call WSL Bash Here (ConEmu - Admin).

Henke
  • 119
  • 8
1

If you want to keep using landscape, then you can change the stamp for the landscape-sysinfo.cache location to be stored say in /tmp.

sudo nano /etc/update-motd.d/50-landscape-sysinfo

and make the following changes that starts at like the 4th line:

# stamp="/var/lib/landscape/landscape-sysinfo.cache"
stamp="/tmp/landscape-sysinfo.cache"

Write Out the file and exit. It shouldn't give you any more grief until the next update that makes a change to that 50-landscape-sysinfo file.

Terrance
  • 43,712