StartAsRoot for FileCase

Rating: 
5
Your rating: None Average: 5 (1 vote)

It will create icon to start FileCase app as root. FileCase app should be installed on your device...

v0.1-3
- Should fix problem with root access.

v0.1-2
- Tablet version.

Beware, use it on your own risk !!!

Donation are welcome :)

Screenshots: 
Application versions: 
AttachmentSizeDate
filecaseroot-0.1-2.armv7hl.rpm10.56 KB13/10/2015 - 00:24
filecaseroot-0.1-2.i486.rpm10.54 KB12/03/2016 - 21:35
filecaseroot-0.1-3.i486.rpm10.86 KB26/07/2017 - 03:08
filecaseroot-0.1-3.armv7hl.rpm10.84 KB26/07/2017 - 03:08
Changelog: 

- Should fix problem with root access.

Comments

Sailbook's picture

No i dont run patches, is there a source on github so i can fix it?

I have try to run it as root from the terminal i get this:

[nemo@Sailfish ~]$ devel-su filecase
Password:
error: XDG_RUNTIME_DIR not set in the environment.
[C] unknown:0 - Failed to create display (No such file or directory)
Segmentation fault

When i do this it works, mebay you have something on this information...

[root@Sailfish nemo]# export XDG_RUNTIME_DIR=/run/user/100000
[root@Sailfish nemo]# devel-su filecase

 

Schturman's picture

can you show me output of this:

stat -c "%a %U %G" /run/user/100000/dconf

Sailbook's picture

[root@Sailfish nemo]# stat -c "%a %U %G" /run/user/100000/dconf
700 nemo privileged

 

Schturman's picture

Hmmm, I have it
stat -c "%a %U %G" /run/user/100000/dconf
700 nemo nemo
And 
stat -c "%a %U %G" /run/user/100000/dconf/user
600 nemo privileged
try to change permission to the same parameters and:

1. run FileCase normal from desktop (as user)
2. run my RootFileCase from desktop

P.S. when you extract from .rpm, you will get the all files that I have (except .spec).

Sailbook's picture

Hi,

It's not that RootFileCase dont run, the only thing is you dont have is root access when you like to change for example a .desktop file.

I have now dont

[root@Sailfish nemo]# stat -c "%a %U %G" /run/user/100000/dconf
700 nemo privileged

After that i run again the RootFileCase, and now i can change the file and have root access.

But after i close RootFileCase and start it again, then i need to do the above command again or no root access...

Is there a way you can fix this for the X or do i need to do it myself, into your app ?

Thanks!

Schturman's picture

I don't know what to change... it should be or "700 nemo privileged" or "700 nemo nemo" automatically for dconf folder...
If you want I can add checking of this to .spec file and recreate rpm.

P.S.  If I understand right you mean when you close RootFileCase the dconf folder disappear from /run/user/100000 ?

Sailbook's picture

When i set 600 nemo privileged to the dconf/user folder then it works perfect.

If I understand right you mean when you close RootFileCase the dconf folder disappear from /run/user/100000 ? No i check it the folder is still there, i mean with this i need to change again the 600 nemo privileged to run it again as root

Yes you can make a test rpm, if you like you can send it to me via email ? just let me know

 

Schturman's picture

Ok, if it always changed back to 700,, it should be interactive fix... try to do this:
1. Create script named checker.sh inside /usr/share/openrepos-filecaseroot with this content:
----------------

#!/bin/bash

if [[ $(stat -c "%a" /run/user/100000/dconf/user) != 600 ]]; then
chmod 600 /run/user/100000/dconf/user
fi
----------------------

2. Give permission:
chmod 4755 /usr/share/openrepos-filecaseroot/checker.sh
 

3. Edit /usr/share/applications/harbour-filecase-root.desktop
Instead this:
Exec=/usr/share/openrepos-filecaseroot/start-filecaseroot
write this:
Exec=sh -c "/usr/share/openrepos-filecaseroot/checker.sh && /usr/share/openrepos-filecaseroot/start-filecaseroot"

4. Open FileCaseRoot, try to edit any file in root dir and close FileCaseRoot 
5. Try it again
6. Report...

Sailbook's picture

Ok thanks, now it works only ones, when i open FileCaseRoot then it works, but when i close it again and reopen it i dont have any root access anymore (:

I just found out after 3 times open FileCaseRoot again then i have root access again, but i need to reopen it more then one time...

Schturman's picture

I think it have some timeout for changing... Try Open -> use -> close -> wait 2-3 seconds -> Open again -> use. Tell me if work...
The second test that you can do is without checking, just always changing to 600:
1. Restore .desktop file like was before:
Exec=/usr/share/openrepos-filecaseroot/start-filecaseroot

2. Edit /usr/share/openrepos-filecaseroot/start-filecaseroot-helper.c
instead this:
system( "su -c 'mkdir -p /run/user/0/dconf' && su -c 'invoker --type=silica-qt5 -n /usr/bin/filecase'" );
Write this:
system( "su -c 'mkdir -p /run/user/0/dconf' && su -c 'chmod 600 /run/user/100000/dconf/user' && su -c 'invoker --type=silica-qt5 -n /usr/bin/filecase'" );
Save file and run as ROOT:
gcc /usr/share/openrepos-filecaseroot/start-filecaseroot-helper.c -o /usr/share/openrepos-filecaseroot/start-filecaseroot
It will override existed start-filecaseroot file.
and 
chmod 4755 /usr/share/openrepos-filecaseroot/start-filecaseroot

Try again test of Open -> use -> close -> open again -> use again...

Sailbook's picture

Ok i have try it and wait then it works!

I have also try the changes you write here but it dont work as good as with the checker.sh then it works the best, when i do the changes it works one time then not anymore even after wait for 2-3 seconds.

I think it would be great to make a rpm also for the X with this checker.sh in it as i use now, what you think ? Then more people have the solution to run it on there X ;)

PS: The same problem is with the StartAsRoot for File-browser that also dont work on the X, it hink it's the same problem...

Schturman's picture

Ok.. you say it work with checker.sh and break 2-3 sec before opening it again ? I also can add "sleep 2" at the begining of script instead to wait....
Do you know more people that have the same problem with Sailfish X or maybe it localy on your device ?
Do you know how to check what this device C, 1, Tablet, Aqua or Sony ? If no, show me this command output (don't know another way):
grep 'product.device' /opt/alien/system/build.prop|head -1|cut -d '=' -f2
and
grep ID /etc/hw-release|head -1|cut -d= -f2|sed 's/[[:punct:]]//g'
and
grep NAME /etc/hw-release|head -1|cut -d= -f2|sed 's/[[:punct:]]//g'

P.S. Can you do one test please...
Objectifnul wrote on FileBrowser root that he got it working (also all other) by setting pass for root user (by installing sudo).
I'm ask you not install sudo, but just go to terminal -> devel-su + your pass -> passwd root + follow what it ask. Now reinstall my package to get it like was before modifications and try again Open -> try edit -> close -> and the same again.
Thanks.

Sailbook's picture

Ok.. you say it work with checker.sh and break 2-3 sec before opening it again ? I also can add "sleep 2" at the begining of script instead to wait....

Yes indeed hen i wat 2-3 sec it works perfect.
Thanks i will add this.

Do you know more people that have the same problem with Sailfish X or maybe it localy on your device ?

Sorry i dont know.

Outputs:

[nemo@Sailfish ~]$ grep 'product.device' /opt/alien/system/build.prop|head -1|cut -d '=' -f2
f5121

[nemo@Sailfish ~]$ grep ID /etc/hw-release|head -1|cut -d= -f2|sed 's/[[:punct:]]//g'
f5121

[nemo@Sailfish ~]$ grep NAME /etc/hw-release|head -1|cut -d= -f2|sed 's/[[:punct:]]//g'
Sony Xperia X

P.S. Can you do one test please...
Objectifnul wrote on FileBrowser root that he got it working (also all other) by setting pass for root user (by installing sudo).
I'm ask you not install sudo, but just go to terminal -> devel-su + your pass -> passwd root + follow what it ask. Now reinstall my package to get it like was before modifications and try again Open -> try edit -> close -> and the same again.

Ok i have done this, it works also but need to wait for 2-3 sec. before open it again when i close it.

Schturman's picture

Cool, thanks... Did you tried another file managers like FileTugRoot ? It also need to wait 2-3 seconds (after setup of root pass) ?

Sailbook's picture

No sorry i dont have try that.

Sailbook's picture

I have add now a sleep 3 on the script now it works perfect no wait anymore on open en close. thanks for the helpt!

objectifnul's picture

Not 100% sure yet, but apparently Filebrowser 'StartAsRoot' has root privileges only when terminal is open with devel-su. Anyway the behaviour of Filebrowser 'StartAsRoot' appears to be variable: sometimes with, sometimes without root privileges. I don't have the skills to investigate further. (Note: this is with Xperia/SailfishX. No issue with Jolla One)

Schturman's picture

Thanks... You mean about this problem (terminal should be opened) after you setup pass for root ?

objectifnul's picture

Actually the issue is not related with terminal. Probably a matter of delays and/or conflicting background actions being performed by the filesystem. For example, at this moment cargodock has root privileges while filebrowser hasn't. Weird.

--EDIT-- Obviously, the SailfishX file system is not btrfs, with little technical information available, and its behaviour is far from predictable. Currently, filebrowser, cargodock, filetug and filecase in 'startasroot' mode have a completely erratic behaviour with about 30% of occurrences with root privilege successfully granted.

Schturman's picture

Thanks for report... I don't know how to fix it... For C, 1 and Tablet - I don't have any problem....

objectifnul's picture

Thx for trying. I think there is nothing you can do on your side, this appears to be a SailfishX issue so it's up to Jolla to address it (probably if and when they implement BTRFS like in Jolla One). In the mean time, what I do is this:

(1) open CargoDock in root mode, which will most probably fail (black background, not red).

(2) close it and wait for about one minute.

(3) open it again, check if the screen background is red.

(4) if yes, you are likely to launch other 'rootable' file managers (filebrowser, filetug, filecase) successfully.

Schturman's picture

hmmm... ok...

Schturman's picture

try to run it as root:

su -c 'invoker --type=silica-qt5 -n /usr/bin/filecase'

or just:

invoker --type=silica-qt5 -n /usr/bin/filecase

The source, just extract content from rpm file and do what you want...

Sailbook's picture

[root@Sailfish nemo]# invoker --type=silica-qt5 -n /usr/bin/filecase
invoker: Invoking execution: '/usr/bin/filecase'
invoker: error: Failed to initiate connect on the socket for type silica-qt5.
invoker: warning: Booster silica-qt5 is not available. Falling back to generic.
invoker: error: Failed to initiate connect on the socket for type generic.
invoker: warning: Can't try fall back to generic, already using it
invoker: warning: Connection with launcher process is broken.
invoker: error: Start application /usr/bin/filecase as a binary executable without launcher...
[root@Sailfish nemo]# error: XDG_RUNTIME_DIR not set in the environment.
[C] unknown:0 - Failed to create display (No such file or directory)

The command su -c 'invoker --type=silica-qt5 -n /usr/bin/filecase' dont do nothing.

About the source when you extract the rpm, you dont have the complete source code only a part oif it.

Sailbook's picture

Seems not to works anymore on Sailfish X ?

Schturman's picture

i don't have sailfish x and can't check it... you can try similar patch...

monkeyisland's picture

okay thank you.

monkeyisland's picture

Hi can you port it for the tablet?

Schturman's picture

Hi. I don't have tablet :( And I can't create package with binary file on my Jolla phone...