Hi there.
I'm trying to write a "cache module" (which runs in post-fs stage, after the system has been mounted but before data).
Why do I need it?
Because I want to execute an "iptables -P OUTPUT DROP" to block every outgoing connection until afwall+ kicks in (in post-fs-data) and establishes the proper rules for the apps.
I can't find a proper "module template" on github.
moreover...Is there a way to "print to magisk_debug.log" from the script?
I would like to "iptables -L" pre-script execution and post-script execution so I can check that everything has gone ok.
Is there a function to do that or should I "iptables -L > /tmp/iptables.log"
Any hint?
Thank you.
In post-fs, Magisk only does a simple mount of any files found in /cache/magisk_mount/system. No scripts are run... That's not until post-fs-data.
See here for more details (if you haven't already):
https://github.com/topjohnwu/Magisk/blob/master/docs/details.md
Didgeridoohan said:
In post-fs, Magisk only does a simple mount of any files found in /cache/magisk_mount/system. No scripts are run... That's not until post-fs-data.
See here for more details (if you haven't already):
https://github.com/topjohnwu/Magisk/blob/master/docs/details.md
Click to expand...
Click to collapse
Thanks Didgeridoohan, I already read that but if you read carefully
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
He says he can run script in different stages. That "simple mount thing" sounds to me like "hey, look...don't ask me to do mounts different than simple mounts."
Moreover I found this on another script...
so it must be possible...(or it was possible with previous versions of magisk)
LinoX said:
Thanks Didgeridoohan, I already read that but if you read carefully
He says he can run script in different stages. That "simple mount thing" sounds to me like "hey, look...don't ask me to do mounts different than simple mounts."
Moreover I found this on another script...
so it must be possible...(or it was possible with previous versions of magisk)
Click to expand...
Click to collapse
"Simple mounts" means that it doesn't add anything new, only replaces already existing files/folders. But you've read the docs, you know that...
Here's some reading on cache modules:
https://forum.xda-developers.com/showpost.php?p=69621730&postcount=7
It might be possible to run scripts in post-fs in the future (that's up to @topjohnwu). Right now it isn't...
Didgeridoohan said:
Here's some reading on cache modules:
https://forum.xda-developers.com/showpost.php?p=69621730&postcount=7
Click to expand...
Click to collapse
Thank you very much for that.
Yeah I didn't read that specific post (even if I searched for it a lot) and it replies my question: Cache modules aren't supported anymore.
I guess I'll have to deal with post-fs-data mode then...
Even if I don't need the data partition and even if, once data is mounted, it could be too late to block the network (some services might have already accessed it..yet not the apps themselves)
Thank you again, man.
LinoX said:
Thank you very much for that.
Yeah I didn't read that specific post (even if I searched for it a lot) and it replies my question: Cache modules aren't supported anymore.
I guess I'll have to deal with post-fs-data mode then...
Even if I don't need the data partition and even if, once data is mounted, it could be too late to block the network (some services might have already accessed it..yet not the apps themselves)
Thank you again, man.
Click to expand...
Click to collapse
No worries...
Just in case you haven't thought about it: if you want to run the script as early as possible, place it in /magisk/.core/post-fs-data.d rather than in the post-fs-data.sh file of a module.
I am using Magisk 16.7 on Android 8.1
On my phone there is no /magisk folder
For using a boot script should i just create the folder structure or where do i have to place my files?
m45k said:
I am using Magisk 16.7 on Android 8.1
On my phone there is no /magisk folder
For using a boot script should i just create the folder structure or where do i have to place my files?
Click to expand...
Click to collapse
Boot scripts should be placed on /sbin/.core/img/.core/post-fs-data.d
Sent from my LGE w5 using XDA Labs
Related
Posted this on my Twitter (@ruqqq) yesterday. Not sure how many people use ConnectBot (like I do). But anyway, I took a whole day to learn Fragment API and decided to use ConnectBot as my "test subject". Below is the result:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Code:
[B]Features:[/B]
- Standard ConnectBot features
- ActionBar UI
- Fragments UI
[B]Known bug:[/B]
- While a console is open, if you click the EditText on bottom right, the console will lose focus. When that happens, click the list item of the current console to regain focus.
YOU NEED TO UNINSTALL THE CURRENT CONNECTBOT ON YOUR DEVICE BEFORE INSTALLING THIS VERSION BECAUSE OF DIFFERENT SIGNATURES
GitHub Link: https://github.com/ruqqq/connectbot
APK Link: REUPLOADED
I won't continue developing this and I hope somebody out there would improve the code. I've also mention ConnectBot lead developer in my tweet in hope he see this link and would merge my changes.
I get a force close when I 'sudo tail'
sudo tail?
EDIT: Reuploaded with major bugfix thanks to @mattyboy247 report
Attempting to 'sudo tail -f /var/log/apache2/error.log'
FC's at 'sudo tail'
you meant you ran the command on your server? anyway.. try the reuploaded apk.
With the first APK uploaded, after a connection to the server, I would attempt to view its apache2 error log. imediately after typing 'sudo tail ' it would FC.
The re uploaded one seems to be working now. Thanks for this.
I'll fork your Git for future reference to the code, that way I am not depending on you to see why I'm having problems, and can attempt to correct them
sure. please do. i'm only porting the UI for my use and for learning fragment api. i don't intend to further develop or maintain this.
Love the app,
but is there anyway to disable volume control for the control the text size?
is there a way to hide the host list?
What does this do if I may ask?
much apreaciated man, it works wonderfull on my gtab 10.1v.
gqstatus0685 said:
What does this do if I may ask?
Click to expand...
Click to collapse
yeah what does it do? Oo
same thing as connectbot, SSH terminal connections but with a modified UI for honeycomb tablets.
Did you send a pull request on github? Best way to get him to merge things. I know for a fact he watches those.
I have a fork with modification to use Search key on a Transformer for ESC. So I'll learn how to use the pull request function with you.
Great app idea! I love it. One problem though - didn't install for me. Running rooted stock HC 3.1 on Asus Transformer. I do have the original Connectbot installed, would that have anything to do with it?
TimD123 said:
Great app idea! I love it. One problem though - didn't install for me. Running rooted stock HC 3.1 on Asus Transformer. I do have the original Connectbot installed, would that have anything to do with it?
Click to expand...
Click to collapse
Yes, in the OP he says in big red letters:
YOU NEED TO UNINSTALL THE CURRENT CONNECTBOT ON YOUR DEVICE BEFORE INSTALLING THIS VERSION BECAUSE OF DIFFERENT SIGNATURES
Click to expand...
Click to collapse
ViViDboarder said:
Yes, in the OP he says in big red letters:
Click to expand...
Click to collapse
D'OH! my bad - thanks for the heads up.
hey arctu, thanks for this, i use connectbot almost every day!
Hello there,
can anybody upload apk somewhere and make a mirror? OP's link doesn't work for me ATM.
TIA
Hi arctu
I just wonder why you used the base ConnectBot.
I prefer the already modified version, Irssi ConnectBot, which sports a bunch of features such as the long touch menu, symbols, device and language specific fixes, etc.
I used to use ConnectBot for local terminal emulating, but then I discovered that one modified for irssi and now I can't do a lot of things on my X10i without it.
I hope you will start to modify Irssi ConnectBot as well.
So after a couple days of f***ing around I have got CM9 compiled!
Haven't flashed it yet (fixing fast boot/NVFlash for disaster recovery purposes)
Will update this post as soon as I have, although I HIGHLY doubt it's even going to boot at this point due to the fact that I had to remove A LOT of proprietary crap just to get this to build.
Either way exciting stuff!
Big thanks go out to giveen and DJ_Steve for all the amazing work they have put into this, as well as for releasing their device tree.
Update 1
Well I flashed it and as expected it did not boot. Stayed on the DELL logo the whole time. Damn
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I could have told ya it wasn't going to boot, lol.
Good job with your work though. I'm looking into the laws/rules of the "vendor/nvidia" directory"
giveen said:
I could have told ya it wasn't going to boot, lol.
Good job with your work though. I'm looking into the laws/rules of the "vendor/nvidia" directory"
Click to expand...
Click to collapse
Awesome, the last piece of the puzzle will soon (hopefully) be with-in my reach
I'm waiting for some answers from several places I posted. I don't think I am violating any copyright laws, but I need to check first.
Also DerArtem (a Folio 100/Thrive) developer said that we need to manually create the system.img to get it to boot, and I've asked Steve a few times to write me a guide to compiling the AOSP for our device but he never responded so I am assuming he is busy as usual trying to get things in his life in order.
Yeah I saw. Doesn't look like he's got a lot of time on his hands these days :/
Yeah, at least he managed to give me a quick PM on Twitter to let me know it was okay for me to release our work.
hmmm...
Upon further inspection of my builds of cm I am noticing a very large difference in system.img size.
The system.img from ICS-B4 is 344,064 KB
My CM9 build is coming in at 176,188 KB
It's like half the size! wtf? Seems like I've got a longer road ahead of me than I thought
Just for S&G's I flashed the system image from ICS-B4 and kept my boot image flashed, and it actually booted! So at least the boot image is getting created properly lol.
I took a look at the contents of the system that was compiled and it is definitely missing some important, but normally common, files.
To name the first one that prevents boot 'sh'.
Like why isn't that getting put into the system image? You would think that would be installed by default!
HC replaced SH with ASH, SH isnt even included in stock 3.x.
Previously it was a symlink to toolbox (i believe), now it simply points to nothing/isnt there.
Unless you're rooted, the only things that have access to the shell is the system itself, so you could just remove it and have them all point directly to ASH.
There might be an export to define what shell is being used (dunno if it's valid on android), but dropping SH isnt an issue when users arnt normally allowed access.
So what would cause adb to say "/system/bin/sh does not exist"?
Just curious since you seem to know a thing or two about this XP
I cant say, if CM9 really is still using SH, it would include it as CM has it's dependencies already included.
Is busybox and toolbox properly compiled and symlinked in your rom at least?
Busybox includes the basic SH as a symlink (i think)
You could always grab your own SH/ASH/BASH from somewhere and add it in+symlink it and see if it boots to begin with.
snarg, check your PM
Progress...
A logcat after my last build
Had to use the boot.img from ICS-B4 but it's progress
http://pastebin.com/YmVD8pn6
I made a few changes, that might resolve the boot.img issue.
There is probably a guide for this already, but if there is, it is deep, deep down
What we will need:
Some way to connect the SD Card to the PC (using the phone USB with storage mode on is fine)
Minitool partition wizard - http://partitionwizard.com - the home edition is fine for this.
The steps:
Connect the SD card to the computer
Launch minitool
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Select your SD Card MAKE SURE YOU DO NOT SELECT YOUR HARD DRIVE!
On the left, there will be an option to Resize the drive. Select this and resize as necessary (If you have a 6GB drive, and want a 1GB ext2, resize it to 5GB).
Do the same again for a swap partition.
Check the operations on the left bar, to make sure you are happy with them and click 'Apply'.
Wait for it to complete. DONE! Eject you sdcard, and put it back into your phone. You can now download an app like link2sd to use it, or use swap
NOTE: I am in no way responsible if your data goes missing!
NOTE2: Not all ROM's have swap support. Most (if not all) CM rom's now do, however, you may need the 07swapon script. Please check my post to get that
It's the same thread like this?:
http://forum.xda-developers.com/showthread.php?t=1317362
it aint deep down... its pinned >_>
-Grift- said:
it aint deep down... its pinned >_>
Click to expand...
Click to collapse
hahaha true.
-Grift- said:
it aint deep down... its pinned >_>
Click to expand...
Click to collapse
exactly, next time do a LITTLE research, ._.
He did state, "There is probably a guide for this already, but if there is, it is deep, deep down " but i dont mind...
I might as well not do things. I always do them wrong, and I get upset. Delete this thread then
Sent from my GT540 using Tapatalk 2
liamwli said:
I might as well not do things. I always do them wrong, and I get upset. Delete this thread then
Sent from my GT540 using Tapatalk 2
Click to expand...
Click to collapse
Nah, just keep looking for material that's missing, so you can make a tutorial .
Ziore said:
Nah, just keep looking for material that's missing, so you can make a tutorial .
Click to expand...
Click to collapse
I think you or anyone could make a tutorial about how to build up a system (not a kernel, but just a e.g. cm7, cm9, aokp, aosp), in order to make our developer thread much more colorful. Just an idea...
To build from source it builds both system and kernel...
-Grift- said:
To build from source it builds both system and kernel...
Click to expand...
Click to collapse
OK, then both, I think it doesn't mean much...
There are many guides out there but for gt540 its slightly different.
-Grift- said:
There are many guides out there but for gt540 its slightly different.
Click to expand...
Click to collapse
This is the reason I requested this type of guide...
So how is link2sd and clockwormod recovery backup?
When I have ext2/3/4 secondary partition and create backup, than do files and linked stuff go to sd-ext? After restore will there be working linking during boot? And what happens when the secondary partition is fat32?
prwnd said:
So how is link2sd and clockwormod recovery backup?
When I have ext2/3/4 secondary partition and create backup, than do files and linked stuff go to sd-ext? After restore will there be working linking during boot? And what happens when the secondary partition is fat32?
Click to expand...
Click to collapse
When you backup with CWM, as long as the ROM you are using mounts the /sd-ext.
When the backup file is made, the sd-ext file contains all the symlinks, so yes, backups work (I have made it loads of times).
Hi guys I thought I would share this bit of work ive done, hope u like and enjoy it
I took a good while to do this.
Tested on: official Cm11, Sensonic HD Rom......
Screenshots:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download link: d-h.st/Mv0
Instalation process:
1- Boot cwm
2- wipe /dalvik & /cache
3- flash my .zip
4- boot and enjoy
Dont forget the thanks button!!
Reserved!
Sent from my MT11i
Reserved! ...
Sent from my GT-P3100 using XDA Premium 4 mobile app
@DarkStryder I've struggling for some days, trying to adapt good old vrtheme script to CM 11.
I saw yours and I miss something: I had to rewrite most of the code, and the first thing that gave me error was setting permissions to 755 to the scripts extracted on /sdcard.
How you succeded in that? A specific update-binary, different from CM's? A different recovery?
I worked a lot to make the whole thing work again, so I'm very interested in how you left everything as it used to be and still made it work
Markox89 said:
@DarkStryder I've struggling for some days, trying to adapt good old vrtheme script to CM 11.
I saw yours and I miss something: I had to rewrite most of the code, and the first thing that gave me error was setting permissions to 755 to the scripts extracted on /sdcard.
How you succeded in that? A specific update-binary, different from CM's? A different recovery?
I worked a lot to make the whole thing work again, so I'm very interested in how you left everything as it used to be and still made it work
Click to expand...
Click to collapse
Take a look at the modifications to the vrtheme script Ive made on the Dark Holo Theme thread here. CM11 now enforces selinux which requires specific "set_metadata" commands in the updater-script. The "set_metadata" command not only sets the file permissions, but it also sets the selinux labels. This new "set_metadata" command replaces the previous "set_perm" command and requires a new version of ClockWorkMod to support it. Make sure you are using CWM 6.0.4.7 or newer to support selinux file permissions.
Tsjoklat said:
Take a look at the modifications to the vrtheme script Ive made on the Dark Holo Theme thread here. CM11 now enforces selinux which requires specific "set_metadata" commands in the updater-script. The "set_metadata" command not only sets the file permissions, but it also sets the selinux labels. This new "set_metadata" command replaces the previous "set_perm" command and requires a new version of ClockWorkMod to support it. Make sure you are using CWM 6.0.4.7 or newer to support selinux file permissions.
Click to expand...
Click to collapse
Thank you, learning new things is always awesome!
In my ignorance I just rebased the whole script in another partition, where set_perm is still allowed
But, again: good to know!
Sent from my GT-P5110 using Tapatalk
Markox89 said:
Thank you, learning new things is always awesome!
In my ignorance I just rebased the whole script in another partition, where set_perm is still allowed
But, again: good to know!
Sent from my GT-P5110 using Tapatalk
Click to expand...
Click to collapse
The set_perm command is still allowed with the new versions of CWM. It is for backwards compatibility of the older scripts. Also, sometimes set_perm is still needed when you want to set permissions of a file on a fat32 sdcard that does not support selinux labels. Selinux requires ext3 or ext4 file systems for the labeling, but you have a sdcard that usually formatted as fat32 by default.
Tsjoklat said:
The set_perm command is still allowed with the new versions of CWM. It is for backwards compatibility of the older scripts. Also, sometimes set_perm is still needed when you want to set permissions of a file on a fat32 sdcard that does not support selinux labels. Selinux requires ext3 or ext4 file systems for the labeling, but you have a sdcard that usually formatted as fat32 by default.
Click to expand...
Click to collapse
Oh, so the file system is the problem! That's why it works everywhere but on sdcards
Thank you very much! :highfive:
Sent from my GT-P5110 using Tapatalk
Sent from my MT11i
nice mod
:good: thx
Working fine in CM10?
I'm looking for /data/logs for dumpstate/logs purpose. I'm currently on cm10.1.6 modded by mardon. But there is no such file in the directory. i tried google search and they say to get rid off "Storage Space Running Out" notification is by dial this code *#9900# but nothings happen. Is there a way to delete dumpstate using Terminal Emulator? And lastly, is it safe to delete dumpstate files/logs? Will there be a bug/error on data connection or radio stuff?
P.S. Sorry for a lot of questions i have. I'll appreciate your help.
daehyunjae said:
I'm looking for /data/logs for dumpstate/logs purpose. I'm currently on cm10.1.6 modded by mardon. But there is no such file in the directory. i tried google search and they say to get rid off "Storage Space Running Out" notification is by dial this code *#9900# but nothings happen. Is there a way to delete dumpstate using Terminal Emulator? And lastly, is it safe to delete dumpstate files/logs? Will there be a bug/error on data connection or radio stuff?
P.S. Sorry for a lot of questions i have. I'll appreciate your help.
Click to expand...
Click to collapse
Its actually in /data/log. Yes, it is safe to delete dumpstate logs. You can delete the dumpstate log from Terminal Emulator using the following commands,
Code:
su
cd /data/log
rm dumpstate*
exit
Do post the result. Hope I Helped
mahithm said:
Its actually in /data/log. Yes, it is safe to delete dumpstate logs. You can delete the dumpstate log from Terminal Emulator using the following commands,
Code:
su
cd /data/log
rm dumpstate*
exit
Do post the result. Hope I Helped
Click to expand...
Click to collapse
See this first command.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
daehyunjae said:
See this first command.
Click to expand...
Click to collapse
Can you show me the contents of /data? Use the following command,
Code:
su
cd /data
ls
Do post the result.
mahithm said:
Can you show me the contents of /data? Use the following command,
Code:
su
cd /data
ls
Do post the result.
Click to expand...
Click to collapse
Here's the result. maybe link2sd related?
daehyunjae said:
Here's the result. maybe link2sd related?
Click to expand...
Click to collapse
Its not a link2sd problem that I can guarantee. What's odd is CM 10.1 doesn't have a log folder in /data. What this means is no dumpstate logs on your device.
mahithm said:
Its not a link2sd problem that I can guarantee. What's odd is CM 10.1 doesn't have a log folder in /data. What this means is no dumpstate logs on your device.
Click to expand...
Click to collapse
weird and I'm curious where the error logs file goes? (fc's,wait,report,call logs) anyway thanks for helping.
daehyunjae said:
weird and I'm curious where the error logs file goes? (fc's,wait,report,call logs) anyway thanks for helping.
Click to expand...
Click to collapse
No problem. You should better ask about this in the Developer's thread
thanks! i will.
daehyunjae said:
thanks! i will.
Click to expand...
Click to collapse
@Mardon please help @daehyunjae. Thanks