What's new

Skynet Skynet - Router Firewall & Security Enhancements

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Edit:
I can't remove swap file with you command or with amtm.
Code:
rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted

I just posted this directly above your reply.
If I use the "sw" command in AMTM and choose 1=Yes
Code:
 Swap file found at:
 /tmp/mnt/SNB/myswap.swp
 Delete the Swap file? [1=Yes e=Exit]
I get this
Code:
Swap file deleted:
 /tmp/mnt/SNB/myswap.swp
 Added missing swap file entry to
 /jffs/scripts/post-mount

Seems like a logic error in amtm when the system fails to release the swap file (probably due to lack of available ram) @thelonelycoder

To manually remove the swap file try the following;

Code:
sync; echo 3 > /proc/sys/vm/drop_caches
sed -i '\~swapon ~d' /jffs/scripts/post-mount
swapoff -a
rm -rf "/path/to/swap/file.swp"
 
Last edited:
Hmmm..
Code:
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/path/to/swap/file.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /path/to/swap/file.swp: No such file or directory
admin@xxx:/tmp/home/root# rm -rf "/path/to/swap/file.swp"
admin@xxx:/tmp/home/root#
Not successful....
 
Hmmm..
Code:
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/path/to/swap/file.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /path/to/swap/file.swp: No such file or directory
admin@xxx:/tmp/home/root# rm -rf "/path/to/swap/file.swp"
admin@xxx:/tmp/home/root#
Not successful....

Your supposed to replace "/path/to/swap/file.swp" with your actual swap file path :rolleyes:
 
Yes, I'm an idiot, still not successful....
Code:
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/tmp/mnt/USB/myswap.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
admin@xxx:/tmp/home/root# rm -rf "/tmp/mnt/USB/myswap.swp"
rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted
admin@xxx:/tmp/home/root#
 
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory

As suspected you don't have enough available ram to unload the contents of the swap file, so you will need to uninstall in two stages;

Code:
sed -i '\~swapon ~d' /jffs/scripts/post-mount

Followed by a reboot of your router, then;

Code:
swapoff -a
rm -rf  "/tmp/mnt/USB/myswap.swp"

Then the swap install command should work as expected.
 
Last edited:
Did you delete file from within Skynet or AMTM? If you deleted withing Skynet you will need to reboot and then do as mentioned with AMTM. All you're doing with AMTM and what's necessary is to delete and expand swapfile. The reason it doesn't work through Skynet is because the swapfile is being used because you're already in Skynet UI. Hope this helps...
I state that was the output of AMTM.
 
As suspected you don't have enough available ram to unload the contents of the swap file, so you will need to uninstall in two stages;

Code:
sed -i '\~swapon ~d' /jffs/scripts/post-mount

Followed by a reboot of your router, then;

Code:
swapoff -a "/tmp/mnt/USB/myswap.swp"
rm -rf  "/tmp/mnt/USB/myswap.swp"

Then the swap install command should work as expected.
Ok, will try that, it just has to wait for a few hours or ... :mad: :eek: :D
 
I am so glad I have 2GB swap files on any USB drive I use on a router. :)

Having a 4GB, 8GB, 16GB or larger USB drive and creating a swap file smaller than the 2GB maximum allowed seems like wasted use of resources. A larger swap file doesn't hurt anything.

I am sticking to my 2GB recommendation on an Ext4 partition with journaling enabled. :)
 
Yes, I'm an idiot, still not successful....
Code:
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/tmp/mnt/USB/myswap.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
admin@xxx:/tmp/home/root# rm -rf "/tmp/mnt/USB/myswap.swp"
rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted
admin@xxx:/tmp/home/root#
The swap file is likely in use and therefore cannot be removed.
I get this putput in amtm (if one scrolls up):
Code:
swapoff: /tmp/mnt/8GB/myswap.swp: Cannot allocate memory
rm: can't remove '/tmp/mnt/8GB/myswap.swp': Operation not permitted
The WebUI Tools page shows Swap 1.99 / 512.00 MB
Even with @Adamm's suggestion to drop_caches the swap file is still in use.
 
I am so glad I have 2GB swap files on any USB drive I use on a router. :)

Having a 4GB, 8GB, 16GB or larger USB drive and creating a swap file smaller than the 2GB maximum allowed seems like wasted use of resources. A larger swap file doesn't hurt anything.

I am sticking to my 2GB recommendation on an Ext4 partition with journaling enabled. :)

I'm also a fan of the "go big or go home" way of thinking, as well as quality usb drives or ssds.
 
I've pushed v7.1.1

Code:
Whitelist Unbound Root DNS Servers
Use ipset restore over individual ipset commands where possible for performance improvements
Commit after nvram changes
Fix Refresh_MBans & Refresh_MWhitelist
Fix WebUI
Only update files with mismatching md5 hash
Only enable WebUI on Merlin builds
Improve Check_Files()
Only allow 1GB+ swap file size to prevent fork() error
Warn if SWAP file too small
Use swapoff -a
Improve swap removal process
Use faster Whitelist_Shared () method if SWAP size allows
Warn about swap size in main menu

Now time to get some sleep o_O
 
@Adamm, you've been busy (a lot of -> min updates in the last few minutes)!

And now, a new version too. :)

Thank you for all the improvements and upgrades. :)
 
I'm also a fan of the "go big or go home" way of thinking, as well as quality usb drives or ssds.

Switching to a SSD was probably the best thing I did. no more worrying about usb drives dying. And accessing everything on the scripts are very quick.

I've pushed v7.1.1

Code:
Whitelist Unbound Root DNS Servers
Use ipset restore over individual ipset commands where possible for performance improvements
Commit after nvram changes
Fix Refresh_MBans & Refresh_MWhitelist
Fix WebUI
Only update files with mismatching md5 hash
Only enable WebUI on Merlin builds
Improve Check_Files()
Only allow 1GB+ swap file size to prevent fork() error
Warn if SWAP file too small
Use swapoff -a
Improve swap removal process
Use faster Whitelist_Shared () method if SWAP size allows
Warn about swap size in main menu

Now time to get some sleep o_O

lol now that you have added that warning i'm getting it now due to my 512mb swap file which hasn't given me any issues at all. Not sure if i'm going to enlarge it.
 
Switching to a SSD was probably the best thing I did. no more worrying about usb drives dying. And accessing everything on the scripts are very quick.



lol now that you have added that warning i'm getting it now due to my 512mb swap file which hasn't given me any issues at all. Not sure if i'm going to enlarge it.

You MUST, you MUST, you MUST!!!
 
Switching to a SSD was probably the best thing I did. no more worrying about usb drives dying. And accessing everything on the scripts are very quick.



lol now that you have added that warning i'm getting it now due to my 512mb swap file which hasn't given me any issues at all. Not sure if i'm going to enlarge it.

I highly recommend it, in the future it will be a requirement to avoid fork() errors and so that certain functions can be simplified where code mitigation's were put in place.
 
I highly recommend it, in the future it will be a requirement to avoid fork() errors and so that certain functions can be simplified where code mitigation's were put in place.

Fine since you are twisting my arm over it :p

It looks like the simple route is just to delete it and recreate it from AMTM?

Is that recommended route or do I need to start looking at it from the CLI level?
 
Fine since you are twisting my arm over it :p

It looks like the simple route is just to delete it and recreate it from AMTM?

Is that recommended route or do I need to start looking at it from the CLI level?

Skynet has swap uninstall/install functions fwiw, I believe amtm's were based on them. In any case, the manual method is only if you get errors trying to uninstall your swap file using the automated method.
 
Skynet has swap uninstall/install functions fwiw, I believe amtm's were based on them. In any case, the manual method is only if you get errors trying to uninstall your swap file using the automated method.

ok thanks I will give it a go from the skynet menu.

I found it in the [12]Debug Options - [4]Swap File Management

Uninstalled then installed a 1GB swap.
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top