I have created a custom distro using Cubic which comes from Ubuntu 20.04.2 LTS Desktop 64-bit.
I have noticed that if I open the file manager as root and then double click on the file then it works.
I have also noticed that in the ubiquity.desktop file, if I change the default line:
Exec=sudo --preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR sh -c 'ubiquity gtk_ui'
In:
Exec=sudo --preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR ubiquity gtk_ui
The problem is solved.
There seems to be a problem with the sh -c '' command when is executed in a file manager with normal privileges through a .desktop file, even if the sudo command is used inside it.
Instead it runs correctly from the terminal both as a normal user and as root.
Why?