yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] defiant07:
[MENTION=4561223]frago21ps[/MENTION]

I was playing around with things this morning and I think I figured why you were getting all that lag. It is because the sdcard is not mounting soon enough for the swapfile to be detect, which causes the init.d script to create the swapfile...this in turn produces constant never clearing lag at least on my device and I am hypothesizing this is the case for your device too...for others this caused boot loops :p.

If you are still interested in using my script, I will be uploading v10 within the next half hour...give it a try and when it asks you if you are using the vold.fstab switch trick just say 'yes' even if you don't use that trick... lmk if this resolves your lag issue.
[Android Software/Hacking General [Developers Only]] defiant07:
Uploaded v10...minor update...should now be compatible with vold.fstab switch trick and slow mounting sdcards :victory:.

[MENTION=4561223]frago21ps[/MENTION] and [MENTION=886367]inunxelex[/MENTION] please try v10 and lmk/confirm that this resolves your respective issues ;).

Note: If you did not have issues with the previous version there is no need to update, unless ya wanna check out my new groovy closing graphics :D.
[Android Software/Hacking General [Developers Only]] defiant07:
Damn...I missed this post...you added that line four times?!?!?!....you could have just added one line sleep 240, which would be equivalent. Your device must take forever to load/mount everything.

That seems really crazy especially since the other method you tried only used sleep 75 and worked.

v10 might not work for you...it will only add sleep 60.
[Android Software/Hacking General [Developers Only]] inunxelex:
no, im use only sleep 60, tried and it's working, result from my dumb script.
[Android Software/Hacking General [Developers Only]] defiant07:
Oh, good...that four minute wait time seemed highly excessive and made no sense...I figured a one minute wait should be more than sufficient especially since the script already waits for android to load before it executes...glad v10 is running smoothly and does the trick :highfive:...thanks for lmk.
[Android Software/Hacking General [Developers Only]] Lefteris Fragiadakis (Frago):
Nice I just try v10 with the trick enable and is working excellent
[Android Software/Hacking General [Developers Only]] famewolf:
Why is it your scripts always hate me?

Input your desired swap file size in mb

as an integer: 512

/system/xbin/swapit[308]: 2011

2011

1123

1123

1123: unexpected '2011'

Please wait while I create the swap file,

boot script, and switch swap scripts

according to your specifications.

It could take 1-5 minutes.

==============================================

Making the swap file...

It still created the file....am I going to have issues? I chose no minfree settings...installing to /data.....
[Android Software/Hacking General [Developers Only]] defiant07:
Awesome, thanks for giving it a second go and letting me know :D.

lol...dunno...I think you just like finding and reporting bugs :p...see lines 9-10 in the script and enable dubug...post that output/log it should provide a clearer idea of what's going on...but ultimately...

I am not sure why you're having issues, especially since the previous version worked...I did not touch either of those parts of the script...the only real change to the code of v10 was the addition of the of the option to add a delay to the init.d script...but this would not account for those really odd 2011/1123 errors and stalling at creation.

The code that is giving you the 2011/1123 nonsense is something in lines 235-239...what do ya get when you do busybox df -m | busybox grep /data | busybox awk '{print $((NF-2))}'? It should print the amount of free space in mb on /data; also note everything in the script is aliased through busybox and this is why I called busybox in for the test command.

Why it stalls out on you when it goes to make the swapfile is beyond me...shot in the dark, delete: 2>&1 | sed 's/^/ /' from the end of line 251.

But my guess it that you have recently flashed a new rom (??? maybe a new busybox version???) and that rom/busybox version is screwed up being that it's not properly handling code which it ought to be able to handle.
[Android Software/Hacking General [Developers Only]] famewolf:
Shush! Your not supposed to know I just installed the latest cm 10.1 nightly on my desire. I think my busybox IS hosed and/or I need to run fix permissions as other commands also send me to that fstrim command....but I made mistake of installing project extreme so waiting for my dinosaur of a phone to decide if it's booting up or not...logcat is showing activity so I'm leaving it alone. ;)
[Android Software/Hacking General [Developers Only]] defiant07:
ha, bet ya didn't know I was clairvoyant :cool:.

lol..yeah, sounds like that nightly ain't gunna become a release candidate...read about something similar in the V6 thread recently where all the commands on some rom just displayed the word 'toolbox'...lol...Zep actually managed to solve the issue if recall correctly...you could read the last 50 or so pages of that thread, but it would probably be easier to just flash a rom that ain't totally jacked up.
[Android Software/Hacking General [Developers Only]] famewolf:
Bug Reports: If the swapfile is not found you rebuild it but you don't do the same thing if the swappiness file is missing...perhaps with a sane default of 60 with a note. So I reran swapit...which worked as expected except for one area:

Making init.d script and power shift style...

Super Stupendous Switch Swap Scripts...

/system/xbin/swapit[695]: can't create /system/xbin/swap30: File exists

chmod: /system/xbin/swap30: No such file or directory

...done.

The files all appear ok:

-rwxr-xr-x root root 316 2013-08-15 02:08 swap0

-rwxr-xr-x root root 319 2013-08-15 02:08 swap10

-rwxr-xr-x root root 322 2013-08-15 02:08 swap100

-rwxr-xr-x root root 319 2013-08-15 02:08 swap20

-rwxr-xr-x root root 319 2013-08-14 08:30 swap30

-rwxr-xr-x root root 319 2013-08-15 02:08 swap40

-rwxr-xr-x root root 319 2013-08-15 02:08 swap50

-rwxr-xr-x root root 319 2013-08-15 02:08 swap60

-rwxr-xr-x root root 319 2013-08-15 02:08 swap70

-rwxr-xr-x root root 319 2013-08-15 02:08 swap80

-rwxr-xr-x root root 319 2013-08-15 02:08 swap90

-rwxr-xr-x root root 38060 2008-08-01 08:00 swapit

-rwxr-xr-x root root 261 2013-08-15 02:08 swapitoff

-rwxr-xr-x root root 267 2013-08-15 02:08 swapiton

lrwxrwxrwx root root 2013-08-14 15:21 swapoff -> busybox

lrwxrwxrwx root root 2013-08-14 15:21 swapon -> busybox
[Android Software/Hacking General [Developers Only]] defiant07:
Interesting general idea to add some sort of precaution for the swappiness value...it would only be worth doing if it saved the user's desired swappiness (need to think of an efficient way to implement this)...the way you describe implementing such a precaution would be kinda pointless being that if the swappiness file is not found the line that sets swappiness in the init.d script will return an error (this should not cause problems) and the kernel's default value would be used, which in most cases is 60.

Regarding that error: Being that nothing in the script's code has changed in the way the switch swap scripts are created/updated and being that for whatever reason the problem was confined to swap30, my guess is that your rom had a brain fart. If it was a problem with swapit you should have gotten the same error for all of the switch swap scripts.

Try rerunning swapit to see if you can recreate the exact same error...my guess is if you get any errors they will be different (i.e. your rom will brain fart somewhere else in the creation of the switch swap scripts).

===EDIT===

thought of a way to entirely avoid the usage of the swappiness file. who sed old dogs can't learn new tricks, lol :p
[Android Software/Hacking General [Developers Only]] luguxd:
I install it and reboot, Files are created in External sd but in /data/ there is no Ran_swapon.log, and when I run "free" command at terminal Swap values are 0 0 0 0, what im doing wrong? I have installed it with the script, and flashing it.
[Android Software/Hacking General [Developers Only]] defiant07:
You are most welcome, glad you found it useful :).

hmm...not too sure based upon the information provided. I assume your init.d is working.

In /data do you get a "BootLog_SwapOn.log" file? If yes, post it (note: this file is produced if there are any errors in the init.d script).

I am guessing there was swapon related error that you did not notice while running the base set up script ("swapit"); in which case your kernel does not properly implement swap...the BootLog would show this error.

If there is no BootLog, open up "swapit" with your root file manager's text editor and delete the hash tags at the beginning of lines 9 and10. Next, rerun "swapit" using the option to create a new swapfile and this will produce /data/Debug_SwapIt.log, which you can post and I will look through for errors.
[Android Software/Hacking General [Developers Only]] Dilesh Perera:
I GET BootLog_SwapOn.log saying : cannot open for write: read only file system

:eek:
[Android Software/Hacking General [Developers Only]] datvui2211:
It 's happen to me too! I opened bootlog and here is it

swapon: /data/swapfile: Function not implemented

vm.dirty_background_ratio = 60

vm.dirty_ratio = 95

vm.vfs_cache_pressure = 10

vm.dirty_writeback_centisecs = 2000

vm.dirty_expire_centisecs = 1000

How to fix it?

Gửi từ Galaxy Y bằng cách sử dụng tia X truyền từ mặt trời!
[Android Software/Hacking General [Developers Only]] Dilesh Perera:
i have tried several times and still same log file. could u please advice what to do now?
[Android Software/Hacking General [Developers Only]] defiant07:
Okay, the "function not implemented" error means your problem is that your kernel does NOT properly implement swap :(...this is the third kernel I have come across so far where the dev most likely forgot to enable a module or something in the kernel, which results in some swap relate things working (e.g. the making of the swapfile) and some not to work (e.g. turning swap on/off). Needless to say this is problematic.

The solution is to either talk to your kernel's dev and inform him of the problem or to flash a different kernel that fully implements swap.

If there are no custom kernels for your device you are sol...sorry.

Okay, I am pretty sure your problem is that the init.d script is executing before the file system where the swapfile is located is accessible, which causes the init.d script to try and recreate the swapfile someplace that is apparently read only...

The solution to this would be to rerun the base "swapit" script and when it asks you if you are using the 'vold.fstab trick' just say "yes." This will add an additional one minute delay to the init.d script, which should be sufficient to allow all the file systems to be accessible.

Hope this works, I was gunna upload a minor update this morning, but I will wait until this issue is resolved...lmk :fingers-crossed:
[Android Software/Hacking General [Developers Only]] ashishk87:
Thanks !!

Hi defiant07,

Thank u very much for the RAM swap script !!

I m using Micromax A110 canvas 2 running custom ROM based on 4.1.2 & project xtreme core v5....

I flashed the script yesterday......There is no change in the free RAM amount, which is 50-60mb before & after flashing your script.....BUT, all my games are running without any lags & clock widget not freezing.... so, :highfive: :D

I still have a doubt......please dont mind if it is silly :o

My phone has 3 storages....phone memory 1.5gb, internal sd card 1gb & my external sd card is 8gb....

After flashing the script, I searched my phone for the swap file, which is 230mb, I fount it on the ROOT /Data folder......There is no change in the used storage on my internal & external sd card......

Does this mean the swap file is on the phone storage & I don't have any chance of degrading my sd card life?:confused: ....or does this will degrade my phone life? :p

Also, I didn't find BootLog_SwapOn.log file on my phone....can u help? Thanks again !!
[Android Software/Hacking General [Developers Only]] defiant07:
You are welcome dude...let me clarify some things for you...

My script will NOT effect your amount of free ram...the minfree values set by Project Xtreme determine the amount of free ram...swap just allows background stuff to be moved to the swapfile, which in turn frees up ram for foreground stuff and this is why games run smoother ;).

I am not sure why there is no change in your used storage on your internal sd being that you are using /data...there ought to be...it's probably a bug in your rom.

Being that /data is where you set up the swapfile, your phone's internal sdcard will experience degradation...but from what I have read it is negligible enough that unless you plan on keeping your phone for a long time (I am talking numerous years) it should not matter...in other words, you'll likely replace your device before any degradation related problems manifest.

If you are still concerned about degradation, rerun "swapit" and use the custom location option to try and set up the swapfile on your external sd. This may result in swapon related errors; in which case you are stuck with /data.

The fact the you do NOT get the BootLog is a good thing...it is only created if the init.d script has errors...the file that indicates/verifies everything is working properly is Ran_SwapOn.log which is located in /data...based upon what you have said you should have this file because everything working as indicated by your reduced lag :).

===EDIT===

Hope ya see this...forgot to mention (although it is in the closing notes of the script), be sure to run "unswapit" before rerunning "swapit" should you try and change the location of the swapfile.
[Android Software/Hacking General [Developers Only]] ashishk87:
I know that this script will not change free ram, but will work in background to give more ram for foreground stuff.....I just mentioned it, for no reason....nywayz, thanks :)

Even I m surprised to see no change in used storage in my both cards....funny thing is, my internal sd card of 1gb is completely empty.....it has just 2 folders, data & LOST.DIR, total size of 16kb.....

Also, no change in my external sd card used storage.....

I flashed this script to get my internal sd card in use, which is empty from many days & i don't mind even if it crashes :p

I have tried many ROMs on my phone & never had anything on internal sd card.....

So, my plan was to use internal sd card to store swap file, but now it seems that the swap file is in phone storage.....

btw, I have 2 files swapfile & swappinessvalue.txt having value 49 in /Data folder, but didn't find Ran_SwapOn.log :confused:

EDIT

Yes, I have already read about running "unswapit" before re-running "swapit" :)
[Android Software/Hacking General [Developers Only]] defiant07:
It seems really odd to me that your device does not use its internal sd for much of anything. Out of curiosity, where do all the files your apps create get made?

You are supposed to have those two files...regarding Ran_SwapOn.log: did you reboot? If you just did a fresh set up without rebooting that file would NOT have been created.

If you did reboot and there is no Ran log, do the free command in terminal. If it shows swap is being used then there is something wrong in your rom. If it shows swap is NOT being used then there is something going wrong on my end and I will need more info in order to trouble shoot.
[Android Software/Hacking General [Developers Only]] luguxd:
BootLog_SwapOn.log says:

swapon:/mnt/sdcard/external_sd/swapfile: Function not implemented

/mnt/sdcard/external_sd/swappinessvalue.txt: No such file or directory

Btw, swapinessvalue.txt is in my SD card, I dont know whats happening
[Android Software/Hacking General [Developers Only]] defiant07:
Ha...two in one day :eek:...see post #287 on previous page...what follows is more or less a copy and paste from that post...

The "function not implemented" error means the problem is that your kernel does NOT properly implement swap ...this is the fourth kernel I have come across so far where the dev most likely forgot to enable a module or something in the kernel, which results in some swap related things working (e.g. the making of the swapfile) and some not to work (e.g. turning swap on/off). Needless to say this is problematic.

The solution is to either talk to your kernel's dev and inform him of the problem or to flash a different kernel that fully implements swap.

If there are no custom kernels for your device you are sol...sorry.

===edit===

the second error, 'No such file or directory,' is a moot point given the first error, but likely could have been resolved by adding the additional delay to init.d script.
[Android Software/Hacking General [Developers Only]] Dilesh Perera:
thanks for the reply. i will try again :) and i have some questions (noob maybe) but really like to a answer from u

my SD card is Sandisk 32GB class 10 . Ultra

if i select Swappiness to 0 will the read and write on partition same as some other higher value?? and same decrease the life of sd no matter what swappiness we select ?

thanks again :good:

EDIT- I did as u said and now bootlog file still available but it is empty inside. . means all all right?
[Android Software/Hacking General [Developers Only]] ashishk87:
some details

Let me tell u some details.....

I bought mmx a110 with ICS 4.0.4....In that version, I had the option to move my apps to internal sd card......I had 500mb phone storage & 2gb internal sd card.....

Then I got official upgrade to v2 ICS only, but phone storage increased to 1.5gb & internal sd card decreased to 1gb.....In that version, I had the option to move my apps to external sd card.....From that time, my internal sd card is empty.....only 2 folders "Data" & "LOST.DIR", having total size of 16kb....

Nothing changed in the official JB 4.1.1 update.....means I can move my apps to external sd card.....

I have the folders ".android_secure", "android" on my external sd card....that means my apps are getting created in external sd card only.....

Now, regarding Ran_SwapOn.log file......

I did reboot immediately after completing the installation of swap.....then i rebooted my phone once or twice.....still not getting the log file......

I tried "free" command in terminal.....What i got is in the image attached.....pls check it & let me know what is happening....

As I can move my apps directly to external sd card, I have not used any script to swap my internal & external sd cards.....hence, while installing your script, i said NO to "vold.fstab Switch Trick".....Also, the script suggested me swap file size around 236mb & i set it to 230mb......and swappiness value to 49.....let me know if you want any more details

Thank you very much for ur all help :) :good:
[Android Software/Hacking General [Developers Only]] defiant07:
First things first, let us deal with whether or not things are working...the fact the bootlog is empty is a step in the right direction...to totally confirm things are working you can either do the free command in terminal and you should see numbers in the bottom row

or

you can look in /data/Ran_SwapOn.log, which contains the output from the free command as well as other info such as time, swappiness, and optional tweaks.

Regarding your questions: The degradation caused by swap is quite minimal, especially if you are using a sandisk class 10 (if you don't believe me read the first page of this thread [MENTION=4282676]slaid480[/MENTION], who is a RC and RD, says as much)...No, the higher the swappiness value the more read/writes there will be...so logically the lower the swappiness, the less read/writes there are, which in turn means less degradation, but, again, it is quite negligible to begin with so I would not worry too much; experiment and do what yields the best results for your usage style and your device (read the FAQ in the OP).

Not that it matters to the issues at hand, but that's some weird, interesting stuff...never heard of stock rom that allows apps to be moved to external sd.

On to business, you see that bottom row in the output from the free command named "swap"...there should be non-zero values...basically all those zeros mean it is NOT working. I am thinking the issue is one of two things:

(1) Being that you get neither of the logs...I strongly suspect your init.d is broken...download the attached zip, extract it, place the script in /etc/init.d, give it rwxrwxrwx permissions, and reboot. You should get a /data/Test.log...if this file is not produced this will fully confirm your init.d is broken.

(2) If 1 is not the cause, then I am guessing there are errors in the base "swapit" script that you are not noticing...since you previously said you found the swapfile in /data, in terminal do:

su
swapon /data/swapfile

NOTE: the test script is not mine...it is from THIS thread.
[Android Software/Hacking General [Developers Only]] Dilesh Perera:
thanks a lot friend . i can confirm its working now . there was a app in play store called memoryinfo swapcheck. it shows the free and used details of swap partition. i have put 0 as swappiness since i thought its enough for me at the moment. will keep close monitoring and maybe try other values later. i was causes cos Class 10 SD card still very expensive in my country :)
[Android Software/Hacking General [Developers Only]] defiant07:
Nice, thanks for letting me know :)...yeah those class 10s ain't cheap anywhere :p.

I will upload an update once I figure out [MENTION=5239249]ashishk87[/MENTION]'s issues.
[Android Software/Hacking General [Developers Only]] ashishk87:
init.d

Firstly, sorry for a late reply.....

OK, this is embarrassing, but yes, my init.d seems like not working.....i was using pimp my rom.....However, while activating swapiton via terminal, the script said, "Good, init.d detected" :confused:

I tried the test init.d script & it also failed.....then i removed pimp my rom & got init.d from the script u gave me.....Again i tried the test script & it worked.....so, i thought init.d was finally working....

Then i removed swapiton by "unswapit" in terminal, rebooted & again tried activating swapiton......everything went well (i think).....BUT, still not getting non-zero values after using "free" command in terminal......does that mean swap is not getting activated? :confused:

Then I removed project xtreme core & swapiton too.....rebooted....once again tried swapiton......still same result......

looks like there is a problem with my init.d....

for your info, i m attaching screenshots from the terminal while activating swapiton.....take a look......

2 questions for u.....

1. what are vm/swap related settings values like thunderbolt, middle ground, kickasskernelizer? i said "none" for that....(image 2)

2. in image 4, making the swap file, i got a line

swapon: /data/swapfile: Function not implemented

...done.

what does that mean?
[Android Software/Hacking General [Developers Only]] Zeratul91:
Hi! I have a nexus s and after trying various kernels all with nominal swap support but none really working, I finally managed to find a working one :D. Now I have a "theoretical" question: the mentioned kernel also supports zRam, should I enable it too or use only swap?

Inviato dal mio Nexus S usando Tapatalk 4