yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] defiant07:
Although I'm not 100% certain, I am fairly confident that it is an issue with your kernel being that swapon gave that error for all those locations (unless there is some other undiscovered location).

Your kernel thinks it is capable of swap being that 'swap' or 'swp' is listed under 'features'/you pass the test at the beginning of the script, but for whatever reason swapon and swapoff are not properly implemented in the kernel.

I would advise talking with the maker of your rom/kernel. Are there other users of your rom that have successfully enabled swap via some other script, an app, or command/terminal based method?
[Android Software/Hacking General [Developers Only]] clnzx2:
Switched kernels and used /data/media/0/

And it finally works! lol. Thanks for all the help.
[Android Software/Hacking General [Developers Only]] defiant07:
Awesome...I am glad to hear it :good:.

Did you try TEST_2? It is attached to post #43. When it asks you to choose location, choose /data and it should be fully functional for you :fingers-crossed:.
[Android Software/Hacking General [Developers Only]] eushaun99:
Test 2 working fine here...no more errors finally :p

Thanks again for all you've done and I'm sure you will continue to improve this script further as time pass. Another thanks for giving me credits although I didn't really do much. :D

I have another question if you don't mind. You said in v6 swappiness is set to 20. So if I set a different value here wouldn't it conflict or something?
[Android Software/Hacking General [Developers Only]] defiant07:
Yeah, finally :p.

The most credit for this update should really go to Zep. I know very little about jb and wrongly assumed basic things like storage location names and filesystems were more or less standardized across different android versions...wish I had a jb device or there was a decent jb rom for my current device. I believe in giving credit where credit is due and it's nice as well as useful having a good tester.

I suppose technically it is conflicting (the same property is being set twice with different values during each boot process and the last one sticks), but its not really a problem if the swappiness you chose in swapit is sticking after a reboot. If after a reboot it's set to 20 search the 99SC (and KAK too if you use that...swappiness is applied in there too if I recall correctly) for swappiness and change it to your desired value (you could do this too if you don't want them to be 'conflicting'...they'd just be redundant). Or if you wanted to you could delete

echo "$(cat /data/swappinessvalue.txt)" > /proc/sys/vm/swappiness

from my init.d script and edit V6/KAK/etc so some other script set swappiness during boot; this would eliminate conflict and redundance.
[Android Software/Hacking General [Developers Only]] defiant07:
Released v5...major update.

Should now be jb compatible and added 'shift' scripts. Note: JB users will probably have to select data partition for their swap file location.

Also note v5 is the same as vTEST_2, so anyone on that version need not update.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
That's nice.

But not surprising.

The issue isn't actually fixed because the script assumed the other kernel is fine.

If you had done the cat /process/cpuinfo command with the other kernel, that output would have been informative.
[Android Software/Hacking General [Developers Only]] clnzx2:
With the other kernel when i did that command swp was listed. That's who initially I ruled out the kernel

---------- Post added at 04:41 PM ---------- Previous post was at 04:34 PM ----------

V5 works as it should. Thanks again.
[Android Software/Hacking General [Developers Only]] sanpedro_bonita:
Really love this swap, but everytime I reboot end of bootloop.. any solution? My phone is ram 512mb, I make 350mb swap,50 values.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
yes but what if there is something else that's a little different about it.

There is no substitute for following through on your end of the deal and providing complete information.
[Android Software/Hacking General [Developers Only]] defiant07:
First let me say sorry for any inconveniences my script has caused you.

I highly doubt any of those settings you mention are the cause of the bootloop. The problem lies in the init.d script, Z99SwapOn. There maybe two things in it that I can think of that maybe the problem:

(1) it contains a while loop - if this is the problem, I am not sure how to fix it because the script needs a means to wait for the swapfile to be found.

(2) it contains a sleep command - if this is the problem, Open Z99SwapOn with a text editor and towards the end there is a sleep 1 command, replace that line with

echo "waiting" > $LOG

A pretty much guaranteed solution would be to delete Z99SwapOn and then each time after you reboot you could use the 'shift' scripts to turn on swap and set swappiness, although 50 is not one of the shift scripts options...you'd have to use 40 or 60.

===EDIT===

Also did you wipe cache and dalvik before rebooting? It's a long shot, but it could help avoid bootloops.
[Android Software/Hacking General [Developers Only]] defiant07:
Good stuff...a whole slew of interesting bits of knowledge as per the usual :good:.

I think I like the obligatory boot logs too (btw that write up by [MENTION=3147360]dk_zero-cool[/MENTION] was most informative - he does a lot of nice work)...it would make it easier for users to report bugs; plus it would bring it more in line with its obvious stylistic inspiration.

The one idea I'm not sure about is the making of a swap file during boot, although I noticed at least one of those swap scripts you linked me to yesterday does this. However, I would think making such a large file during boot would have to slow things up considerably...wouldn't it?

Also although this could be overcome with a simple addition, I have found if you run the mkswap command right after the dd command the swap file ends up being significantly smaller than it ought to be. Not totally sure why, but I think even though the dd command says it's complete for whatever it hasn't actually fully populated the file with zeros...that's why I have that sleep 30 command before mkswap in swapit.

Muchas Gracias Prof. Zepinstein.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Well it would only make it if it doesn't yet exist so if it happened, it would only happen once ;)

Also, because of how it's setup, putting the sleep 30 in there wouldn't slow down boot either so why not put that in... no biggie ;)

Actually, even it if did make the swap file everytime, it wouldn't slow down boot since it all happens after android loads.

But when it'd doing it, there would likely be a stutter :p

But yeah, no worry about that since it would only be a one time thing - if at all.
[Android Software/Hacking General [Developers Only]] defiant07:
True...good points.

Also it would be a good safety precaution should the user somehow accidentally delete the swapfile.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
oh yep that's true - whatever can go wrong, will go wrong lol

I actually thought of it with the idea of it working without having to run the setup script first.

But for it to work without issue, default values for desiredsize and swappiness would have to be set if they are somehow null
[Android Software/Hacking General [Developers Only]] defiant07:
Yep :p...and it would kinda defeat the reason I decided to make this script in the first place, which is that none of the other swap scripts I looked at took user input for these properties...they all used kinda arbitrary/device specific values or they would instruct users to edit the values in the script, which for many users, even the ones floating around XDA, is a bit too intimidating for their feeble/lazy minds.

Also I think having a setup script is good too because to a certain extent it forces the user read the instructions...as I am sure you are painfully aware the dumb dumbs love not reading OPs and posting annoying questions...btw I am surprised it took you so long to add 25vikasp to the ignore list...he got way more than three strikes...lol.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Yeah he musta been posting when I had a high tolerance level.

But then I looked at all his posts in the thread and that was that... lol

And yeah, that's why I don't have V6 create other scripts until after the user chooses the option from the menu... lol

But I have added self configuration for most of them if they are run manually, such as vac - after running it you can choose to disable it on boot or enable it and if so, how often.

So it can be set up where if you run it manually/interactively, it works the same as it does now but if run via init.d/no terminal interface, it just does the boot up stuff.

If you dissect vac, you'd see alot of tricks that took alot digging and testing.

And what a pain it was to find a way to check if it's being run in interactive mode... and then I find a way that works on Android... and the test is so simple that it's maddening... I figure... after all this time and research, it better be some big ass fancy code but noooo... it's

if [ -t 0 ]; then interactive=yes; fi

When it worked flawlessly... on the first try... I'm like...

ARE YOU EFFIN KIDDING ME?!

But then I was happy it worked so that's okay after all... lol
[Android Software/Hacking General [Developers Only]] Hpsgill:
How to fix this
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Oh I've seen this problem before but dunno why it happens - the shells built in math is acting funky.

Do:

ls -l `which sh`
accramkb=4096
echo ===
echo $(($accramkb/1024))
echo ===
echo $((accramkb/1024))
echo ===
[Android Software/Hacking General [Developers Only]] RFrancis:
Help im getting this when i run con cm jb

Hi. Thanks for using my SwapItOn script.
Hope you like it!

Okay first gunna make sure your kernel
supports swap and that /etc/init.d exists.

Nice, swap is supported.

Good, init.d detected.

Now I need some input from you so as to
customize the script according to your
needs and preferences.

The required files will be made here:
/data

Please input the desired size in mb as an
integer - not a fraction or decimal - of
your swap file and then press enter.

30
/storage/primary/legacy/Download/swapit__NOT_FLASHABLE__v5/swapit[63]: /system/bin/mediaserver/1024: unexpected '/'
[Android Software/Hacking General [Developers Only]] bacrot78:
Hi defiant07

Does this work for stock rom and is there any negative impact on the ram with this script ?
[Android Software/Hacking General [Developers Only]] zeppelinrox:
See my post before yours.

Addresses the same quirk
[Android Software/Hacking General [Developers Only]] defiant07:
I always wondered what all that interactive stuff was...now maybe I understand a third of what goes on "under the hood" of V6...lol :silly:

I can empathize to an extent, although you seem to know how to fix all my though problems already :D.

Its probably like Zep said, your rom don't know the math :p...do the commands he gave you.

Or I wonder if it is not getting the 'accessible ram in kb' variable because of a missing applet...but I highly doubt it.

Its the same issue as [MENTION=4822338]Hpsgill[/MENTION]. Read the quotes and replies above...and do the command Zep gave.

It probably will NOT work on most stock roms. Read the "REQUIREMENTS" in the OP for the command to see if you kernel supports swap.

Not sure what you mean by 'neg impact on the ram.' Swap does consume some ram being that things are getting moved about, but it also frees up ram. Again read the "POSSIBLE FAQ" in the OP.

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

GD MFin SOB...was about to put up v6 with the bootloop fix and bunch other changes, but I guess I'll wait for this issue to get resolved.
[Android Software/Hacking General [Developers Only]] RFrancis:
I ran line by look line then ran the script and got this.

Hi. Thanks for using my SwapItOn script.
Hope you like it!
Okay first gunna make sure your kernel
supports swap and that /etc/init.d exists.

Nice, swap is supported.

Good, init.d detected.

Now I need some input from you so as to
customize the script according to your
needs and preferences.

The required files will be made here:
/data

Please input the desired size in mb as an
integer - not a fraction or decimal - of
your swap file and then press enter.

30
/system/xbin/swapit[63]: android.process.media/1024: unexpected '.'
1|u0_a39@android:/ # 30
sh: 30: not found
127|u0_a39@android:/ #
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Ya that's nice.

Now run the testing code and share the exact output - that would actually be useful
[Android Software/Hacking General [Developers Only]] defiant07:
At this point in the dialog you should not be inputting the value...there is some more dialog that calculates and suggests a recommended size.

But at any rate please do the commands Zep gave and then hopefully I can have a fix up by the end of the day.
[Android Software/Hacking General [Developers Only]] defiant07:
hahaha...lol...we are writing replies that echo one another at the same time :p
[Android Software/Hacking General [Developers Only]] RFrancis:
I asume this is the testing conde

u0_a39@android:/ $ ls -l `which sh`
lrwxrwxrwx root root 2013-07-02 00:10 sh -> mksh
u0_a39@android:/ $ accramkb=4096
u0_a39@android:/ $ echo ===
===
u0_a39@android:/ $ echo $(($accramkb/1024))
4
u0_a39@android:/ $ echo ===
===
u0_a39@android:/ $ echo $((accramkb/1024))
4
u0_a39@android:/ $ echo ===
===
u0_a39@android:/ $
[Android Software/Hacking General [Developers Only]] zeppelinrox:
oh yep... so the math actually works.

So there must be something wrong with getting the initial value.

Do 2 commands:

free
free | awk '{ print $2 }' | sed -n 2p

---------- Post added at 04:13 PM ---------- Previous post was at 03:56 PM ----------

ah but I don't hold back on sarcasm lol

hey I think I got a fix on the false positive for swap support...

awk '/swap/||/swp/&&/eature/' /proc/cpuinfo

is buggy.

root@android:/ # cat /proc/cpuinfo
cat /proc/cpuinfo
Processor : ARMv7 Processor rev 4 (v7l)
processor : 0
BogoMIPS : 13.50

processor : 1
BogoMIPS : 13.50

Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x1
CPU part : 0x04d
CPU revision : 4

Hardware : SAMSUNG M2_ATT
Revision : 0010
Serial : 0000d61c00007dd4
root@android:/ # awk '/0x1/||/13/&&/eature/' /proc/cpuinfo
awk '/0x1/||/13/&&/eature/' /proc/cpuinfo
CPU variant : 0x1
root@android:/ # awk '/13/||/0x1/&&/eature/' /proc/cpuinfo
awk '/13/||/0x1/&&/eature/' /proc/cpuinfo
BogoMIPS : 13.50
BogoMIPS : 13.50

There are hits even tho both 0x1 and 13 don't appear on the same line as Features :p

So... this is better

root@android:/ # awk '/13|0x1/&&/eature/' /proc/cpuinfo
awk '/13|0x1/&&/eature/' /proc/cpuinfo
root@android:/ # awk '/0x1|13/&&/eature/' /proc/cpuinfo
awk '/0x1|13/&&/eature/' /proc/cpuinfo
root@android:/ #

No hits... whew...

Add swp to the search...

root@android:/ # awk '/0x1|13|swp/&&/eature/' /proc/cpuinfo
awk '/0x1|13|swp/&&/eature/' /proc/cpuinfo
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
root@android:/ #

Hellz Yeah...

Long story short... change the code to:

awk '/swap|swp/&&/eature/' /proc/cpuinfo
[Android Software/Hacking General [Developers Only]] defiant07:
Yep he's must be missing free and/or sed.

Thanks, I need to learn/read more about combining pipes and ampersands with commands...
[Android Software/Hacking General [Developers Only]] defiant07:
I should have multiquoted...

Yeah that's it...thanks.

Do Zep's commands a couple of posts up.

It's does not seem to be a problem with the script...you're probably gunna need to install a different, more complete, busybox.
[Android Software/Hacking General [Developers Only]] RFrancis:
I just realized that the culprit may be the project extreme script since he is using the free command in terminal for something else . when I type free it clears some apps from memory... By the way what are good swap and swappiness values for cm jb 512 ram usually 100 free
[Android Software/Hacking General [Developers Only]] zeppelinrox:
If you ran the two commands I told you to, it would be clear.

Edit: ya I had a look.. he replaces a common busybox command with a drop caches script lol

Thats so dumb...
[Android Software/Hacking General [Developers Only]] defiant07:
That would make sense...if free has been redefined. However, that was really silly of that dev imo...this is why for the shift scripts I used "swapiton" and "swapitoff" instead of the more intuitive 'swapon' and 'swapoff.'

Typically free does not kill stuff...it's output should look something like this:

My suggestion get rid of PEx and use V6 :p.
[Android Software/Hacking General [Developers Only]] defiant07:
Since the most recent round of bug reports seem unrelated to SwapItOn here's...

The Official Release Post for v6...major update

=====EDIT=====

[MENTION=5286204]sanpedro_bonita[/MENTION]: dunno what happened to you, but if you're still interested update to v6...your problems should be resolved.
[Android Software/Hacking General [Developers Only]] RFrancis:
I assume my only options would be uninstall the conflicting script or try to get the dev to not redefine free... I would use v6 but I'm not all up to date with the installation process. Last time I checked it seemed to me the simplicity was gone with the patching and what not. Any suggestions for swap and swapiness?
[Android Software/Hacking General [Developers Only]] defiant07:
Correct...I plan I giving that dev a heads up in the near future...why on earth someone would redefine a busybox applet is mind boggling...even a neophyte like myself could anticipate the problems that such an action could cause.

Umm...it's not too difficult, but if V6 seems like too much for you, you should stay away...you may end up on an ignore list or two, lol.

Recommended swap file size is half your accessible ram.

Regarding swappiness level, read the "POSSIBLE FAQ" in the OP.
[Android Software/Hacking General [Developers Only]] RFrancis:
I'm not sure I understand the tone of the ignore list comment but I appreciate the help nonetheless . I know my way around android pretty well I'll just have to set some time aside to give v6 a try . Thank you for your time.
[Android Software/Hacking General [Developers Only]] defiant07:
Sorry did not mean to sound condescending...you are obviously more competent than most users being that you report bugs in a helpful way and that you figured out that PEx free problem. My honest guess is that what makes V6 seem daunting to you is Zep's jargon because the process of installing it is really easy...I must have read that OP and all the posts it links you to like 50 times before I built up the courage to try it, lol :p...and then when I did finally install it I felt retarded for having felt so intimidated because it was so easy.

The ignore list comment was meant as a warning/caution that Zep and followers of the V6 thread (myself included, lol) will chew you up, spit you out, and then ignore you if you post questions about installation being that the OP and the script itself thoroughly explain its installation, although people will try and help you if it's something kinda tricky like linking java to path.

Also I was thinking, if you don't wanna give V6 a go, why not try Fly-On Mod, Thunderbolt, or some other V6 clone...I doubt they redefine busybox applets.

And you are most welcome, I'm just happy its not my script causing the issues. It really bothers me when users report problems; I hate the idea I am inconveniencing others.

=====EDIT=====

Just thought of a possible solution...maybe if you reinstall busybox it will replace PEx's free xbin script and then you could use this alongside PEx.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
I may change the free memory check with

awk '/MemFree/{print $2}' /proc/meminfo

May as well get it from the source... lol
[Android Software/Hacking General [Developers Only]] defiant07:
yet another zepperfield one liner

this should help avoid that problem you mentioned earlier were some roms can't do elementary arithmetic...the script will be math free, well except for one -lt. stupid me still need to divide

===EDIT 2===

now that I in reality tested it :p, it should be

awk '/MemTotal/{print $2}' /proc/meminfo

i shouldn't attempt to test code in my head like you, lol
[Android Software/Hacking General [Developers Only]] famewolf:
Mount Points

I just want to point out that on my HTC Desire HD/HTC Inspire 4G running CM 10.1 the sdcard is mounted here:

/dev/block/vold/179:65

28002928 16399040 11603888 59% /storage/primary/legacy

and /sdcard is symbolically linked the /storage/primary/legacy

lrwxrwxrwx 1 root root 23 Jul 20 23:55 sdcard -> /storage/primary/legacy

It only gave me the option to put the file on /data. Worked great on my HTC HD2 though.

---------- Post added at 12:12 AM ---------- Previous post was at 12:00 AM ----------

Provided your device can take advantage of it....the devices most likely to need swap like my HTC HD2 with 512mb could only take advantage of up to class 6. They don't get speed benefits from a class 10. At the time they were released only class 2 cards were in existence.
[Android Software/Hacking General [Developers Only]] slaid480:
I talk about SD lifespan.
[Android Software/Hacking General [Developers Only]] famewolf:
I use the presets built into Rom Toolbox Pro for memory settings...currently on "Aggressive" for my devices....is there a better choice to use in conjunction with the swapfile (swappiness = 60)?
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Well, I did go for 2 or 3 months at one time, putting out updates, with no device to test on at all.

during that time, based solely on user testing and feedback, Nitro Lag Nullifier came about lol

It figures...

Quick n dirty...

storage=`busybox mount | awk '/vold/&&/sdcard/{print $3}' | awk 'NR==1'

Becomes...

storage=`busybox mount | awk '/sdcard|storage/&&/vold/{print $3}' | awk 'NR==1'

/done in my head! lol
[Android Software/Hacking General [Developers Only]] famewolf:
Assuming that line is #442 since it was the only one changed......

Nice, swap is supported.

Good, init.d detected.

Now I need some input from you so as to
customize the script according to your
needs and preferences.

./swapit[442]: no closing quote

##### code by zeppelinrox #####
storage=`busybox mount | awk '/sdcard|storage/&&/vold/{print $3}' | awk 'NR==1'
if [ "$storage" ]; then
echo " Where should I make the required files?"
echo " Pick (e)xternal sd card or (d)ata partition."
[Android Software/Hacking General [Developers Only]] defiant07:
Do you mean on the desire and inspire you can only use /data and on the hd2 you can use either option?

Or do you mean it only worked on the hd2 with the /data option?

If it is yes to the first question then that is how it is supposed to be because jb migrates its data to /data/media/0/; so ultimately it is the same as putting it on /storage/primary/legacy, which is a fake sdcard of sorts.

But I'm guessing you mean yes to the second question being that is seems the hd2 is a jb device too.

I which case, if you don't mind testing, I'll make a test version with the fix Zep gave...which option do you use the flashable or nonflashable?

I you're setting your minfrees aggressively, I assume you're a hard gamer in which case you'd likely prefer a higher swappiness...read the "POSSIBLE FAQ" in the OP.

On jb wouldn't this lead to the same swapon/off errors eushaun99 was having?

Would we need to find where it all gets migrated how with eushaun99 everything went to /data/media/0?

...I dunno, guess I still don't understand that jb fix...
[Android Software/Hacking General [Developers Only]] Far_SighT:
Hi,

I'm using swap via /cache and /data partitions (eMMC).

I read that this will decrease the life of my device.

Can someone give details as to how much decrease can I expect?