What's new

amtm amtm - the Asuswrt-Merlin Terminal Menu

  • 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!

Just been advised and tested that an swapoff command at services-stop or unmount is not needed. That the OS should sync before shutting down. However shutting down entware is still a good idea. Thanks @Adamm for your advice.
 
Just been advised and tested that an swapoff command at services-stop or unmount is not needed. That the OS should sync before shutting down. However shutting down entware is still a good idea. Thanks @Adamm for your advice.
Ah, then I'll try just stopping Entware in the unmount script.
 
Just been advised and tested that an swapoff command at services-stop or unmount is not needed. That the OS should sync before shutting down. However shutting down entware is still a good idea. Thanks @Adamm for your advice.
Well, I'm not convinced. :oops:
I ran the fsck script that @thelonelycoder added to amtm since last December and have never seen my SNB drive cleanly unmounted on my AC68U and now on my AC86U (complete clean install of everything, router, SNB scripts on new USB drive). I found that script because I had all kinds of errors and on boot saw the not cleanly unmounted in syslog which led me to investigate the fsck script. I was getting corruption of my USB drive to the point it would hang the router on /jffs scripts start. I would shut down after every change that requited a reboot, pull the USB drive and run fsck on my Linux desktop and return them to the router. What a PITA!

services-stop
Code:
#!/bin/sh

# DO NOT EDIT this part of the file #
# generated by AB-Solution 3.11
/opt/etc/init.d/rc.unslung stop
# end of DO NOT EDIT #
sh /jffs/scripts/firewall save # Skynet Firewall Addition

[ -x /jffs/dnscrypt/manager ] && /jffs/dnscrypt/manager services-stop

amtm fsck results (dcl)
Code:
 Wed Mar  7 12:10:44 PST 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 730/940240 files (7.4% non-contiguous), 607605/3753650 blocks

 Sun Mar 11 16:54:55 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 989/940240 files (6.0% non-contiguous), 795113/3753650 blocks

 Thu Mar 15 12:00:05 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 1092/940240 files (5.6% non-contiguous), 622949/3753650 blocks

 Thu Mar 15 17:07:03 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 1095/940240 files (5.6% non-contiguous), 634776/3753650 blocks

 Thu Mar 15 19:27:03 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 1095/940240 files (5.6% non-contiguous), 640114/3753650 blocks

  Fri Mar 16 16:27:43 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB was not cleanly unmounted, check forced.
 SNB: 1115/940240 files (5.5% non-contiguous), 688388/3753650 blocks
 
No progress, I'm afraid:
  • Reboot from router web GUI: usb was not cleanly unmounted, check forced.
  • reboot via ssh: usb was not cleanly unmounted, check forced.
  • Eject USB disk from router web GUI, then reboot from router web GUI: usb was not cleanly unmounted, check forced.
 
No progress, I'm afraid:
  • Reboot from router web GUI: usb was not cleanly unmounted, check forced.
  • reboot via ssh: usb was not cleanly unmounted, check forced.
  • Eject USB disk from router web GUI, then reboot from router web GUI: usb was not cleanly unmounted, check forced.
Same for me on all those tests. I also used the swapoff command in unmount script and on boot the same "not cleanly unmounted". At least the fsck script works at boot to clean it up.
 
Well knock me over with a feather.

Code:
Sun Mar 18 20:40:38 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB: clean, 1151/940240 files, 792288/3753650 blocks

Added "swapoff /tmp/mnt/SNB/myswap.swp" to both services-stop and unmount.
Issued reboot via ssh in a terminal.
 
Well knock me over with a feather.

Code:
Sun Mar 18 20:40:38 PDT 2018 Starting 'e2fsck -p /dev/sdb1'
 SNB: clean, 1151/940240 files, 792288/3753650 blocks

Added "swapoff /tmp/mnt/SNB/myswap.swp" to both services-stop and unmount.
Issued reboot via ssh in a terminal.
As @Adamm suggested this could cause problems with firewall save and ip tables not being saved correctly.
 
As @Adamm suggested this could cause problems with firewall save and ip tables not being saved correctly.
The swapoff command is after the skynet save command. I'll keep an eye on it, thanks.
My USB corruption has been going on for nine months, through two routers, six USB thumb drives (all premium quality - formatted ext4, ext3, ext2 to test) and god knows how many reboots. I have so many fingers and toes crossed I can hardly function, but lord I hope this works without skynet issues.
 
The swapoff command is after the skynet save command. I'll keep an eye on it, thanks.
My USB corruption has been going on for nine months, through two routers, six USB thumb drives (all premium quality - formatted ext4, ext3, ext2 to test) and god knows how many reboots. I have so many fingers and toes crossed I can hardly function, but lord I hope this works without skynet issues.
The problem being that skynet.ipset isn't saved. This is advice straight from @Adamm
 
The problem being that skynet.ipset isn't saved. This is advice straight from @Adamm
So don't use swapoff and interfere with skynet/ipset and get progressively worse USB corruption. :eek: o_O
Choice between two evils. :rolleyes:
 
So don't use swapoff and interfere with skynet/ipset and get progressively worse USB corruption. :eek: o_O
Choice between two evils. :rolleyes:
I'm just saying and so is @Adamm that a script/process using your usb drive is not being stopped by the routers call to services-stop in a reboot. Thus the drive doesn't disconnect properly when the OS asks. The swap is synced in the reboot process.
 
I'm just saying and so is @Adamm that a script/process using your usb drive is not being stopped by the routers call to services-stop in a reboot. Thus the drive doesn't disconnect properly when the OS asks. The swap is synced in the reboot process.
What about /jffs/scripts/unmount?
https://www.snbforums.com/threads/swap-file-mount-unmount.44425/#post-378494

unmount
Called just before unmounting a partition. Like pre-mount, this is a blocking script, so be careful with it. The script is passed the mount point as an argument which can be used in the script using $1.
https://github.com/RMerl/asuswrt-merlin/wiki/User-scripts
 
Skynet should be disabled before unswaping any swap file. On newer devices ipset tends to spit fork() errors without a swap file, so if you unswap it and by chance a command runs it will error out and potentially lead to a blank skynet.ipset file.

In any case, I don't think unswapping the swap file is necessary, from what I've read the kernel is smart enough to handle any data inside before shutdown.
 
Like @Butterfly Bones I don't get clean boots until I add swapoff /tmp/mnt/usb/myswap.swp to services-stop (after sh /jffs/scripts/firewall save)...

Can’t say I have the same issue on any of my 4 drives (formatted ext4 with a gpt partition table). Could possibly be because you are running ext2/mbr, or a processes shutdown method.

Best thing I could recommend is you and @Butterfly Bones find what is similar between your setups and eliminate the possibilities.
 
Not sure how much this is true for our routers, but this guy advises to turn off swap before "removing" a flash drive holding a swap file:

https://afrivirt.wordpress.com/2010/06/04/4/
I think it applied to all USB drive... even on pc... imagine electric current running doing read write and u abruptly pull them out. Data may be corrupted, worst case drive is burned.

For me I will try safety removal the USB drive if possible, if not swap drive, I will shut down the router to unplug it out. Most time I do it during need of updating the firmware.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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