[Q] [kernel] Set SE permissions to busy box during init boot process - Android Q&A, Help & Troubleshooting

Hello guys, maybe one of you might be able to help me out
I have a sh script that patches the fstab before it got mounted.
Sadly since its in the during the init process i need to define some se permissions to busybox
here is the debug kernel log
http://pastebin.com/HZmJdRWv
anyone could help me out how to setup the permissions required?

Khaon said:
Hello guys, maybe one of you might be able to help me out
I have a sh script that patches the fstab before it got mounted.
Sadly since its in the during the init process i need to define some se permissions to busybox
here is the debug kernel log
http://pastebin.com/HZmJdRWv
anyone could help me out how to setup the permissions required?
Click to expand...
Click to collapse
maybe these pages will help?
http://selinuxproject.org/page/TypeRules
http://www.newandroidbook.com/21-Security.pdf
selinux has been giving me fits since it went enforcing in kitkat.
as far as busybox goes, running it as su seems to let it get past selinux restrictions... I was able to use busybox in root adb shell to mount an ext2 partition without the ext2 security attribute set in the kernel config, while trying to mount it with any other method would fail because of selinux.

Related

[Q] NFS mount freezes tablet?

Hi,
I am trying to get my GT-7510 (retail with the latest updates, rooted) mount an NFS share.
I have built the necessary modules and loaded them via insmod.
However, when I attempt to mount a share the tablet freezes. Screen is on, can't connect or ping in any way.
I've tried adb logcat - it just stops showing any output. I've tried getting a core dump without any success.
Is there any way I can see what the dmesg output was when the thing froze? Any suggestions on how to troubleshoot this?
And I don't want to use CIFS because it's slow and it generally sucks.
Thanks in advance!
Does anybody use NFS on the GT-7510?
Hi weasel,
I'm also struggeling with NFS. I tried using pershoot's Kernel with his modules. But I'm not even near to get NFS mounted or the Tab frozen ;-)
Maybe you can share which modules you loaded, which kernel, which mount command, how you issued the command.
So far I don't have a solution but maybe we can find one together!
Here is what I did so far:
[Kernel] - 2.6.36.4 - OC-VFPv3-d16_FP 1.4GHZ - Galaxy Tab 10.1 (9/13/11; 9.00PM EDT)
Installed the kernel above, loaded the following modules in the following order:
1. sunrpc.ko
2. auth_rpcgss.ko
3. lockd.ko
4. nfs_acl.ko
5. nfs.ko
When I try to mount my nfs share running on a Ubuntu 10.04 server with this command line:
mount -o nolock -t nfs <IP>:/<Path> /sdcard/<mountpoint>
I'm getting the following error message: Invalid argument
Is this a bug in the kernel/module. Am I doing something wrong?
I did get it to work but I had to use the source from Samsung's site and not the android source.
The modules you have listed are correct but you need to use the mount command that comes with busybox because the built-in mount doesn't support nfs. Also check your dmesg output after you load the last module to make sure there are no error messages.
So try using
/system/xbin/mount
instead of just mount
Oh, and I'm using the stock kernel so that's why I needed Samsung's source, you shouldn't need to re-compile your modules.
weasal said:
Oh, and I'm using the stock kernel so that's why I needed Samsung's source, you shouldn't need to re-compile your modules.
Click to expand...
Click to collapse
Did you compile those modules on your own? Do you know any howto for doing that? Or can you even provide me with the modules?
I'd like to use the stock kernel as well!
Thanks again!!
I already managed to compile them on my own. Thanks again for the hint.
For all of you who are searching for the required modules for the stock Kernel as well - please find attached.
The correct mount option:
/system/xbin/mount -t nfs -o nolock <ipaddress>:/<path> <mountpath>

[Q] How to handle mounts and r/w access in rooted Custom ROM (80 G9 SDE)

Hi,
I'm new to Archos Hardware and their SDE, but I'm a long time Android user
and Custom ROM installer .
I have a hard time understanding how the SDE and multi boot works on the
Archos devices. I think only one kernel is used and the second filesystem
(2nd ROM) is mounted as a loop device.
Recently I tried to install DropBear SSH server II from the Play Store, but
the actual install failed throwing an error message about /system
being R(ead)O(nly).
As far as I know /system is not mounted in the custom ROM (freezenook). It seems to
be a regular folder in the loop file system. That's why I don't get the message
about it being read-only.
Furthermore I have a hard time executing ARM binaries on the Archos. I
copied over some binaries to tinker with DVB-T hardware, but I always
get 'permission denied' messages when I try to run them as root in the shell.
I tried to chmod +x them and to put them in places that were not mounted with
the noexec flag. But I didn't succeed.
To cut a long story short:
1. How do I make certain areas of the file system read/write-able in order to
install things such as DropBear SSH server?
2. Do I need to do something special to execute cross compiled binaries?
(I have a gut feeling that it's also connected to the loop file system and mount
set up for the SDE.)
Many thanks in advance,
Kleo2

[Q] How to add fsck script at boot before mount?

I was wonder how to add file system check every boot since my data partition often unclean. I had try to add line in init.rc before mount and static e2fsck binary to /sbin.
Like this one: "e2fsck -fy /dev/block/data" but I think it has no effect since my tablet failed to boot. I must go to recovery and do fsck via adb shell. It is annoying. I want to make it automatically. Please help me.
Thank you..
juliantito said:
I was wonder how to add file system check every boot since my data partition often unclean. I had try to add line in init.rc before mount and static e2fsck binary to /sbin.
Like this one: "e2fsck -fy /dev/block/data" but I think it has no effect since my tablet failed to boot. I must go to recovery and do fsck via adb shell. It is annoying. I want to make it automatically..
Click to expand...
Click to collapse
Assuming you know that you need to repack your boot image to change init.rc and you did that, try prefixing your command in init.rc with "exec".
I want to run E2FSCK on every boot and repair the disk if there is some problem on Odroid N2 Android. I have used the tune2fs -c 1 command to check the disks on every boot.I want to confirm whether this command will repair the problem (if detected) as well.
I think that in Android Source code they have made sure that the disk will be checked however, I don't know whether they fix the disk as well. Please confirm this as well.
In Odroid N2 Android image, the directory /etc/default/rcS is missing, so I can't make changes to it. I can't run a script on each boot because the disks are mounted by then and I can't umount them because the disk is being used.
If anyone has some solution, I will really appreciate your help.

Fix SELinux contexts for all applications

Hello,
I'm running CyanogenMod 12 on a Nexus 7 (2013, flo, 2015-02-03 nightly).
I messed with SELinux contexts while on recovery (MultiROM TWRP) and now none of the applications work. I temporarily fixed it by editing the kernel's command line and setting SELinux policy to permissive and flashing the updated kernel, but this is obviously not a permanent fix as it lowers security and needs to be reset after every update. How can I restore all the contexts for all the apps without wiping data (I have important stuff)?
I tried "restorecon -FR /data/*" but it didn't help.
Thank you very much, have a nice day!
Sorry to bring this back, but this issue is likely to be shared by others (beyond me right now), so did you ever find a solution?
Well for those interested, I found a solution. To restore the SELinux context for an app whose data is in "/data/data/org.app.app", run (as root):
Code:
restorecon -Rv /data/data/org.app.app
You can run
Code:
ls -Z
before and after to see the changes made to the files.
Once SELinux context is restored, should be able to use your app normally and check that SELinux is still being enforced with getenforce:
Code:
[email protected]:/data/data/org.app.app # getenforce
Enforcing
Hope this helps.
Please help
thisisabore said:
Well for those interested, I found a solution. To restore the SELinux context for an app whose data is in "/data/data/org.app.app", run (as root):
Code:
restorecon -Rv /data/data/org.app.app
You can run
Code:
ls -Z
before and after to see the changes made to the files.
Once SELinux context is restored, should be able to use your app normally and check that SELinux is still being enforced with getenforce:
Code:
[email protected]:/data/data/org.app.app # getenforce
Enforcing
Hope this helps.
Click to expand...
Click to collapse
I'm very inexperienced with all this, and I don't understand how to do the given solution. I need step by step instructions ?. I don't know if the type of os matters, but I'm running kitkat on a rooted Samsung Galaxy s4
Mikey6God said:
I'm very inexperienced with all this, and I don't understand how to do the given solution. I need step by step instructions ?. I don't know if the type of os matters, but I'm running kitkat on a rooted Samsung Galaxy s4
Click to expand...
Click to collapse
Hi. Just to be sure, if you are very inexperienced, why do you think you are having SELinux-related issues?
Otherwise, to answer your question, you need to run these commands in a terminal emulator. So either using adb shell on your computer or directly on the device with a terminal emulator such as Termux. If you don't know how to run commands, then look into that before, as there is a real possibility to mess things up badly when using a shell as root.
thisisabore said:
Well for those interested, I found a solution. To restore the SELinux context for an app whose data is in "/data/data/org.app.app", run (as root):
Hope this helps.
Click to expand...
Click to collapse
Thank you very much. It solves all my problems !!!
I really had alot problems with selinux.
After two years, I have the solution, because of you.
Thank you very much again

No R/W on Stock Rooted 5.1.1 (Unlocked Bootloader)

As the title says, I have no write access in device root. I am running stock 5.1.1. SuperSu installed and working.
Would sure appreciate some help. Being half-rooted is not acceptable.
Thanks in advance
Problem is fixed. Bad BusyBox install it seems.
Hi, i have the same problem.
For example, im not able to make the tablet adfree with the rom-toolbox.
The romtoolbox errormessage is "can not remount read/write"
Use NextApp SDfix
The romtoolbox still reports "faild mount read/write"
The Micro-SD-Card is writeable.
(sorry for my english)
SeLinux is set as enforced. You need to set it to permissive. Google up tools and means for doing that. I often use paragon ntfs.
Tanks a lot!
I didnt found a tool, but i can Set it temporarly with a terminal emulator:
Su
Setenforce 0

Categories

Resources