46

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.

4 Answers 4

70

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.

5
  • 1
    As of September systemd is available in WSL
    – PerseP
    Commented Oct 8, 2022 at 8:29
  • 1
    @Henke Right - All good points. While I probably could have gone into more detail on why I recommended removing the ~/.motd_shown, it's really so that it's easy to confirm that the problem is really resolved when you exit and restart. Otherwise, the MOTD might not be shown again until the next day. I suggest leaving it in place (but it's fine to remove it entirely), just temporarily delete it to make sure it triggers again for confirmation. Commented Nov 29, 2022 at 16:16
  • There's no need to restart the entire computer. You can restart the WSL subsystem alone by running wsl --shutdown on the Windows side to shutdown the entire WSL subsystem and kill all WSL processes, then start a new WSL shell. (Remove ~/.motd_shown first if you want to test the MOTD message.) Commented Jul 30, 2023 at 18:58
  • @DevenT.Corzine Of course - Agreed that there's no need to restart the whole computer; but I never said to restart the computer itself ;-). When I say "exit and restart" in this case, I just mean exit the shell and restart. There's not even any reason to restart the subsystem itself in this case with wsl --shutdown. Commented Jul 30, 2023 at 21:37
  • @DevenT.Corzine Updated the answer for clarity :-) Commented Jul 30, 2023 at 22:36
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
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).

1
  • 1
    All good, except for that last one. I really would recommend that users don't put the auto-cd into their startup config, as that can cause unintended consequences elsewhere. Best to let the terminal application handle that by starting wsl ~. I recently came across a comment from one of the WSL developers recommending against the cd in ~/.bashrc, as well, but I forgot to save it. Commented Nov 30, 2022 at 20:38
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .