Ubuntu 20.04 WSL three issues gcc, sleep, cat

This is Ubuntu 20.04 running on Windows 10 in WSL.

‘gcc’ option -Os does not work. Optimize for size.

shell ‘sleep’ command fails with “cannot read realtime clock:”. Messes up
shell scripts with delays.

sudo cat ABC >> DEF Fails with “perrmisssion denied” Used to work to append
ABC to the end of DEF.

ABC and DEF are owned by root and group root.

Did you access the Ubuntu file system through Windows Explorer? Did you access any file on the Ubuntu file system from Windows?

If yes, you likely corrupted something, because these random errors are typical behaviour for that.

I suggest you should wipe the old WSL installation and install a fresh and new WSL.

Running Debian 11 Bullseye on WSL myself, everything runs perfectly fine. No issues like that, at all. I specifically tested your examples and they all work flawlessly.

1 Like

I did not see “Debian 11 Bullseye on WSL” . Do you have the URL?

A friend of mine gave me a better more appropriate way to
append to files owned by root

cat ABC | sudo tee -a DEF >/dev/null

Well, that doesn’t solve the initial issue. Can you not cat and redirect (cat ABC >> DEF) any regular file on the filesystem?

Yes, on a regular file it works cat abc >> def

Where is Debian 11 Bullseye for WSL downloadable from?

Meanwhile, I have written a guide on how to upgrade a Debian system the right way: