Wsl shell always shows an error message on the daily inform.
/usr/lib/ubuntu-release-upgrader/release-upgrade-motd: 31: cannot create /var/lib/ubuntu-release-upgrader/release-upgrade-available: Permission denied
This is what the message shows on wsl once a day. Although it seems to be no harm, I still wonder how can I avoid this.
I have tried the chmod command to open the permission of release-upgrade-available, but it doesn't work. Since the release-upgrade-motd belongs to root, there shouldn't be any permission denied problem.
Thanks. However I ran into trouble when trying some seemingly incomplete fix in the link. Someone on that page posted a 'harmful' fix of an official package because he posted this fix in an inappropriate way - offering a non-official ppa containing a special version designed by himself. This package destroyed my apt and I have no idea about how to deal with this situation. Since my working environment in wsl is easy to rebuild, I reinstalled the wsl on my pc. Surprisingly, this issue - the error message - didn't pop up since then. So in a nut shell, Reinstalling wsl may fix this problem, although it's not a good idea.
I ran into the same issue. I resolved it by removing /var/lib/ubuntu-release-upgrader/release-upgrade-available. This causes /usr/lib/ubuntu-release-upgrader/release-upgrade-motd to skip to the second condition, but since I don't login as root it never tries to write the file.
@spaulaus maybe this is a solution, but I don't like it. You say, it never tries to write the file unless you login as root? However, whenever I login, no matter if I am root, it always tries to write the file. I have to admit that I made the conclusion too soon in the last comment. I said that reinstalling wsl will help, but it didn't. The message pop up later again. Luckily, I managed to 'fix' it by opening the access of /usr/lib/ubuntu-release-upgrader (not the file, but the folder) using the command
$sudo chmod 775 /usr/lib/ubuntu-release-upgrader
and the message haven't shown since then. It's strange for that release-upgrade-motd should have the root authority but it cannot write the file.
@sffred : I agree that this isn't an optimal solution since it prevents the file from being generated.
Here's the contents of /usr/lib/ubuntu-release-upgrader/release-upgrade-motd on my WSL install.
stamp=/var/lib/ubuntu-release-upgrader/release-upgrade-available
if [ -f "$stamp" ]; then
# Stamp exists, see if it's expired
now=$(date +%s)
lastrun=$(stat -c %Y "$stamp") 2>/dev/null || lastrun=0
expiration=$(expr $lastrun + 86400)
if [ $now -ge $expiration ]; then
# Older than 1 day old, so update in the background
/usr/lib/ubuntu-release-upgrader/check-new-release -q > "$stamp" &
elif [ -s "$stamp" ]; then
# Less than 1 day old, and non-empty, so display now
cat "$stamp"
echo
fi
elif [ "$(id -u)" = 0 ]; then
# No cache at all, so update in the background
/usr/lib/ubuntu-release-upgrader/check-new-release -q > "$stamp" &
fi
As you can see, the first if checks if the file exists. If the file does not exist, the elif checks if the executing user is root. My solution prevents the upgrade check from happening at all, by ensuring that both of these conditions are false. The file doesn't exist and I don't login as root.
Discussion based on a previous version of the above comment.
By default /usr/lib/ubuntu-release-upgrader has the following permissions:
drwxr-xr-x 2 root root 4.0K Jun 13 07:21 ubuntu-release-upgrader
Setting 664 on this directory will give drw-rw-r--, which will prevent any script from actually navigating into the folder at all. This gives the same effect as my solution since the script cannot confirm that the file exists, and the script is not being run as root. See the image below:

@spaulaus : I made a mistake because I am not familiar enough with chmod. Actually I set it to 664 first and then found it was wrong and set it to 775 instead. Sorry for that and I have updated the comment.
I looked at my /usr/lib/ubuntu-release-upgrader/release-upgrade-motd and it's just the same. Yeah, I agree with you that deleting the file will prevent it from being generated again, but when I deleted the file the message is still there. (Actually this is the first thing that I tried.) It's really odd, but I'd ignore this issue and go on my work. Anyway, I have solved it now, at least to some extent.
@sffred : No worries! I've confirmed that the script is running as the user logging in.
One more question: Did you get this message after upgrading to a new version of Ubuntu (e.g. from 19.10 -> 20.04) using do-release-upgrade?
After a little more research, I found the following solution, which prevents the release check all together. This is probably the safest solution.
sudo chmod -x /etc/update-motd.d/91-release-upgrade
@sffred : No worries! I've confirmed that the script is running as the user logging in.
One more question: Did you get this message after upgrading to a new version of Ubuntu (e.g. from 19.10 -> 20.04) using
do-release-upgrade?
hhh that's a sad story. I run do-release-upgrade several month ago and it totally broke my disto. I really experienced a hard time because I tried to fix it manually and it took me several hours. And I chose to reinstall wsl at last. After that I still get the message so I came here for help.
After a little more research, I found the following solution, which prevents the release check all together. This is probably the safest solution.
sudo chmod -x /etc/update-motd.d/91-release-upgrade
Really? But I found that /etc/update-motd.d/91-release-upgrade is already a executable script
$ l /etc/update-motd.d/91-release-upgrade -l
-rwxr-xr-x 1 root root 299 Dec 19 2019 /etc/update-motd.d/91-release-upgrade*
That's correct. /etc/update-motd.d/91-release-upgrade is executable. -x removes the execute bit from the script and prevents it from executing.
-rw-r--r-- 1 root root 299 Jun 18 08:29 91-release-upgrade
Reproducing again in 22.04 WSL
Can confirm :
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
/etc/update-motd.d/50-landscape-sysinfo: 17: cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied
Is there a downside to fixing it this way?
sudo chmod a+w /var/lib/landscape/landscape-sysinfo.cache
@QNimbus Hello, have you found a solution to your problem? I'm also having the same error message on my terminal. I'm new to Linux and just started out with Ubuntu 22.04 LTS on WSL2. I kinda do not understand what the problem is or how to fix it?
sudo apt remove python3-twisted sudo apt install python3-pip pip3 install twisted
sudo apt remove python3-twisted sudo apt install python3-pip pip3 install twisted
Does Ubuntu 22 uses python3-twisted for something? Otherwise one could just remove it (first line above).
sudo apt remove python3-twisted...
I think it's better to:
sudo apt remove landscape-common
sudo apt autoremove
@msveshnikov
Reproducing again in 22.04 WSL
@QNimbus
cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied
This is a new error in 22.04, not related to the previously fixed issue that this thread refers to. Apparently they left the Landscape feature from Ubuntu Server in the 22.04 WSL distro when it probably should have been removed.
Also tracking this at this Ask Ubuntu question, but it probably needs a Launchpad bug report if there isn't one already (haven't checked yet, but will).
/usr/lib/ubuntu-release-upgrader/release-upgrade-motd: 31: cannot create /var/lib/ubuntu-release-upgrader/release-upgrade-available: Permission denied
please has anyone found a solution to this prompt message? please help I'm new to linux