Solved swap corrupted? AX86u

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

zany130

Occasional Visitor
my swap is not being used at all and is causing mem usage to be 100% trying to do a swapoff gives
swapoff -a
swapoff: /tmp/mnt/SYSTEM/myswap.swp: Cannot allocate memory


and trying to use the amtm utility doesn't seem to do anything it gives this on each run

Swap file deleted:
/tmp/mnt/SYSTEM/myswap.swp
Added missing swap file entry to
/jffs/scripts/post-mount
 

bbunge

Very Senior Member
May I recommend using a swap partition vs. a swap file. Make a swap partition on the USB drive and in the post-mount script mount it with
swapon /dev/sda1

Google is your friend if you need to learn how to create a swap file and mount it on an Asus router. But I have had far fewer issues with a swap partition than swap file on Linux.
 

zany130

Occasional Visitor
look command
free



free
total used free shared buffers cached
Mem: 934060 902140 31920 4268 1416 296924
-/+ buffers/cache: 603800 330260
Swap: 2097148 0 2097148
 
Last edited:

zany130

Occasional Visitor
May I recommend using a swap partition vs. a swap file. Make a swap partition on the USB drive and in the post-mount script mount it with
swapon /dev/sda1

Google is your friend if you need to learn how to create a swap file and mount it on an Asus router. But I have had far fewer issues with a swap partition than swap file on Linux.
this still doesn't resolve the issue that I have a swap file on my USB that cant be removed
 

zany130

Occasional Visitor
So I was able to delete the swap file by using another computer and create a new one with amtm, and now I don't get those messages in amtm anymore and I can even delete the swapfile now from amtm (Like I said I couldn't before), but it still doesn't seem to be using the swap instead filling up the router's system memory
 

ColinTaylor

Part of the Furniture
but it still doesn't seem to be using the swap instead filling up the router's system memory
It won't use swap unless there no memory available. In your post #5 you had 330MB of memory still available.
 

zany130

Occasional Visitor
It won't use swap unless there no memory available. In your post #5 you had 330MB of memory still available.
it still happens when it says 0MB available I actually had the router crash rn cuz it ran out of memory
 

zany130

Occasional Visitor
as you can see here my router is starting to run of mem and it's still not touching the swap

free
total used free shared buffers cached
Mem: 934060 906092 27968 6720 236 406940
-/+ buffers/cache: 498916 435144
Swap: 4194296 0 4194296


should I open a bug report? maybe swap isn't working on the ax86u although if this was the case I think more people would have known about this by now, and I can't seem to find anything about swap not working on this model on the issue tracker or elsewhere
 
Last edited:

joe scian

Very Senior Member
as you can see here my router is starting to run of mem and it's still not touching the swap

free
total used free shared buffers cached
Mem: 934060 906092 27968 6720 236 406940
-/+ buffers/cache: 498916 435144
Swap: 4194296 0 4194296


should I open a bug report? maybe swap isn't working on the ax86u although if this was the case I think more people would have known about this by now, and I can't seem to find anything about swap not working on this model on the issue tracker or elsewhere

You still have 27968 free. I dont have any issues on my AX86U - stop looking at your memory and your problem is fixed. Linux kernel knows how to utilise memory and will use swap as required assuming your swap is not corrupt. PS what exactly do you have running on AX86U- i have over 211588 free and Im running all scripts as per my signature. Is your Diversion Block list abnormally huge? or something else ? Use htop to see your biggest memory users.
 
Last edited:

zany130

Occasional Visitor
You still have 27968 free. I dont have any issues on my AX86U - stop looking at your memory and your problem is fixed. Linux kernel knows how to utilise memory and will use swap if required assuming your swap is not corrupt.
so then why is my router going into an unresponsive state where I can't ssh or use the WebUI and this only happens when I let the mem usage get too high. the most logical conclusion is that it is running out of memory and not using the swap

I know that merlin wrt is set up to only use the swap when the router's mem gets full, as it has a swappines of 0. but it seems its not kicking in as like I said the router is freezing

as a test I set the swapiness to 100 meaning it should always swap regardless of free mem and it's still not swapping

free
total used free shared buffers cached
Mem: 934060 808304 125756 6500 1044 368672
-/+ buffers/cache: 438588 495472
Swap: 4194296 0 4194296

and I know I still have quite some amount of free memory here that's because I purposely stopped several processes so that my router does not run out of memory, so it doesn't freeze again
 
Last edited:

joe scian

Very Senior Member
check and see whats using your memory as per my post. Cheers.
 

zany130

Occasional Visitor
check and see whats using your memory as per my post. Cheers.
rclone uses a lot of memory especially when you mount cloud storage with lots of files so that's what's causing my system to run out
I'm seeing this in the routers logs so something is definitely going on
Write-error on swap-device (8:0:5152984)
 
Last edited:

joe scian

Very Senior Member
rclone uses a lot of memory especially when you mount cloud storage with lots of files so that's what's causing my system to run out
I'm seeing this in the routers logs so something is definitely going on
Write-error on swap-device (8:0:5152984)


Ok there is your problem. Its trying to write files to the swap device but cant therefore running out of memory. Are you using a USB formatted to Ext4 for your swap device? What is the capacity of your USB stick? I notice you have 4Gigabyte swapfile - previously you had 2GB - Maybe you need a new USB and BTW 2Gigabyte swap should be more than adequate
 
Last edited:

joe scian

Very Senior Member
It won't use swap unless there no memory available. In your post #5 you had 330MB of memory still available.

I think its actually 31920kb free Colin!
 
Last edited:

zany130

Occasional Visitor
Ok there is your problem. Its trying to write files to the swap device but cant therefore running out of memory. Are you using a USB formatted to Ext4 for your swap device? What is the capacity of your USB stick? I notice you have 4Gigabyte swapfile - previously you had 2GB - Maybe you need a new USB and BTW 2Gigabyte swap should be more than adequate
its a segate onetouch 1tb ssd formatted ext4 I just bought it so it should be working fine. did an fsck and everything came back fine
yeah it's supposed to be 4 but when my router freezes and the swap gets corrupted it increases to 4 for some reason and then I have to delete it from another computer to create a new one
 

joe scian

Very Senior Member
If you have a spare USB stick lying around I would use that formatted to ext4 with journaling through amtm for your swap. If that works fine then come back to your sea gate and work out why you cant write to the swap file.
 
Last edited:

zany130

Occasional Visitor
If you have a spare USB stick lying around I would use that formatted to ext4 with journaling through amtm for your swap. If that works fine then come back to your sea gate and work out why you can write to the swap file.
I get that error on 3 different drives I tried I don't get why swap seems to be broken only on my router
 

Similar threads

Sign Up For SNBForums Daily Digest

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