We have moved to a new Sailfish OS Forum. Please start new discussions there.

Launch App as Root

asked 2020-03-30 16:23:07 +0300

Levone1 gravatar image

updated 2020-03-30 16:24:19 +0300

Issue when attempting to launch, for example, a file manager app from terminal as root, (always launches fine as standard user). Sometimes works fine, sometimes I get: error: XDG_RUNTIME_DIR not set in the environment. [C] unknown:0 - Failed to create display (No such f ile or directory) Sometimes works fine as with devel-su, sometimes with su, sometimes with sudo. My most consistent method to get it to work so far is to open a terminal app, attempt it, get an error, then open a different terminal app, attempt it, and it works. I have searched the error message, and found advice about exporting display, etc, but seems obviously not a system config issue, since it works sometimes. What is happening, and what could I do to avoid the error? Thanks

edit retag flag offensive close delete



there is nothing cool in launching userspace app as root user.

coderus ( 2020-03-30 22:05:55 +0300 )edit

@coderus - Thanks for the reminder - I'm mostly just curious about what is happening. Since you mention it, though, what's the difference between doing that, and using a 'run as root' patch? Or, is there a way to grant an app 'root permissions' by some other means?

Levone1 ( 2020-03-30 22:43:37 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-04-10 05:24:57 +0300

Levone1 gravatar image

updated 2020-04-10 05:25:28 +0300

Found it:

chmod -R 777 /run/user/0
export XDG_RUNTIME_DIR=/run/user/0

Now launches from root user...

edit flag offensive delete publish link more



It is merely not about setting rights for this directory,
but creating it all (as @Schturmanused already. So:

mkdir /run/user/0
export XDG_RUNTIME_DIR=/run/user/0

is the one to use,
default setting of /run/user/0 is set to 755, which should suffice?

peterleinchen ( 2020-04-10 11:48:04 +0300 )edit

dir was already there for me, (maybe bc I have Schturman patches already), but 700. User 1000 dir is set to 755, but the other 2 are 700, (and they revert on restart).

Levone1 ( 2020-04-10 13:13:03 +0300 )edit

You should not use those patches!

After a reboot the /run/user dir only has one entry for nemo/100000
and its rights are set to 700

After login as root (via devel-su) and
mkdir run/user/0
the rights for this are set to 755

peterleinchen ( 2020-04-10 15:14:03 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2020-03-30 16:23:07 +0300

Seen: 421 times

Last updated: Apr 10 '20