Error occurred while executing method\n2: [system] No such file or directory - error when opening or loading any file

Same issue than:

But solution there does not work.

Problem occurs when I double click on the system file explorer, when I click on the rstudio file explorer, when I use the function file.edit

This is the output of the commands path.expand("~") and Sys.getenv("HOME")

> path.expand("~/")
[1] "/home/daniel/"
> Sys.getenv("HOME")
[1] "/home/daniel"
> path.expand("~")
[1] "/home/daniel"

My system:

Ubuntu 18.04.5 LTS

RStudio Version 1.4.1106

R version 4.0.5 (2021-03-31)

I just upgraded Rstudio from 1.2

I also followed advice from :

running as super user solves the issue. However, there is no .rstudio-desktop folder any where to be chmoded.

It seems that the brutal

sudo chmod -R 777 ~/.local/share/rstudio*

solved the issue

I also did
sudo chown -R <user>:<group> ~/.config/rstudio/rstudio-prefs.json