Hard Reboot when Acess Restrictions setting is changed

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Sat May 18, 2019 21:01    Post subject: Hard Reboot when Acess Restrictions setting is changed Reply with quote
Hi Everyone
I am having two different problems.I hope someone can help me.
First:
When I turn off or turn on access restrictions for a couple of clients I have set up, the router does a hard reboot.

Second:
I am using DNSMasq. The lease file is being written just fine. But when the router boots from the above procedure the file is wiped clean.

Update:
Just turned off "Use JFFS2 for client lease" and again the router did a hard reboot.
This does not seem right.

Does anyone know why this might be happening?
Thanks
Mike

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
Sponsor
bushant
DD-WRT Guru


Joined: 18 Nov 2015
Posts: 2036

PostPosted: Mon May 20, 2019 15:33    Post subject: Reply with quote
If you are using 37305, it had many problems on many devices.
If you were to reinstall probably best to try newer.

_________________
Forum Guide Lines (with helpful pointers about how to research your router, where and what firmware to download, where and how to post and many other helpful tips!)
How to get help the right way

Before asking for help - Read the forum guidelines AND Upgrade DD-WRT!
Adblock by eibgrad (1.1M blocked) + Blocklist Collection

machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 19:59    Post subject: Reply with quote
I had the latest install prior to this.
ddwrt-linksys-wrt1900acsv2-webflash.bin 19-Apr-201915:32 39325696
The problems I had with that one was it only wrote the lease file when it felt like it.
Do you recommend a particular build?
Thanks
Mike

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 20:27    Post subject: Reply with quote
machineman5107 wrote:
I had the latest install prior to this.
ddwrt-linksys-wrt1900acsv2-webflash.bin 19-Apr-201915:32 39325696
The problems I had with that one was it only wrote the lease file when it felt like it.


I am using dnsmasq and have a usb mounted. I have jffs enabled in services.
When I was using the build above the dnsmasq.lease file was being written and updated as it should. Then for some reason it just stopped working. Nothing I did would get it to write again. This is why I switched to the current build but i doing so it created the problems I mentioned in my first post.
Hope this makes sense.

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 21:02    Post subject: Reply with quote
To be honest I do not know.
I formatted a usb drive with an ext2 partition and plugged it into the back of the router. I added this dhcp-leasefile=/jffs/dnsmasq.leases to dhcpd options.
Here are a couple of screen shots tha might help.



Capture2.JPG
 Description:
 Filesize:  59.04 KB
 Viewed:  1670 Time(s)

Capture2.JPG



Capture1.JPG
 Description:
 Filesize:  27.38 KB
 Viewed:  1670 Time(s)

Capture1.JPG



_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 21:30    Post subject: Reply with quote
eibgrad wrote:
Ok, I see several problems here.

First, the dhcp leases are being handled by DNSMasq, NOT DHCPd! So remove that reference to /jffs/dnsmasq.leases

Second, once you've checked the "Use JFFS2 for client lease DB", you don't need the directive, at all. By checking that option, the router will automatically add that directive, *and* to the proper location, to DNSMasq.

Finally, it appears you have JFFS mounted to your USB drive (probably because you named the partition jffs when you created it, that's how automount works). That's a problem because USB mounts happen rather late in the bootup process. But DNSMasq is initialized very early in that process. And so if you have storage needing by DNSMasq that's not yet available, DNSMasq moves on without it!

That's why having jffs bound to the router's flash is much safer. JFFS2 gets initialized reliably *before* any USB drives, and before DNSMasq gets started. And now your leases will be saved and restored reliably.


Ok I have unchecked "use jffs2 for client lease db"
I removed dhcp-leasefile=/jffs/dnsmasq.leases from Dhcpd options.
How do I bind jffs to the routers flash?
Thanks
MIke

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 21:57    Post subject: Reply with quote
Ok rechecked Use JFFS2 for client lease DB and renamed the volume.
So I will see what happens now.
One last question...
Is there a command I can run to view the file? If so how do I do that?

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Mon May 20, 2019 22:07    Post subject: Reply with quote
Yes I see. It is being written.Cool
Hopefully this will be more reliable.
Thank you for the help. Very Happy I am a newbie but enjoy learning.
I will let you know how it goes.
Thank you
Mike

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
machineman5107
DD-WRT User


Joined: 16 Apr 2019
Posts: 63

PostPosted: Tue May 21, 2019 0:44    Post subject: Reply with quote
Thank you
I was not aware of that.

_________________
WRT1900ACSV2-Router
Firmware: DD-WRT v3.0-r39855 std (05/25/19)
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Sat May 25, 2019 13:46    Post subject: Reply with quote
While not trying to contradict the above advice pertaining the internal/external "jffs" issues.
That informed may be dated. As while watching the logs continuously using more recent builds, the USB is loaded & mounted very early in the boot process & certainly before dnsmasq.

While in the recomendation if using " internal jffs2, many issues are pointed out.
But not mentioned is the biggest issue of using it & flashing a new build (which most all of us do)...
If the flash size changes, bigger or smaller (which it does & will).
This will corrupt the jffs2 partition. Sometimes causing strange issues & as reported by others, sometimes causing a brick!

As far as making your dnsmasq.leases survive a reboot, while using the safer method of not using the internal "jffs2" & instead mounting jffs on a USB drive....have a look at this post here & see if it sutes your needs.¯\_(ツ)_/¯

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Sat May 25, 2019 16:11    Post subject: Reply with quote
eibgrad wrote:
You might be right about things being different today. I ran into this problem many years ago. I was storing my DNSMasq customizations on USB and referencing the USB drive in DNSMasq. Then I noticed that every once in a while DNSMasq just failed to start, or it started but didn't have my customizations (it's been so long ago, I've actually forgotten which). But then I realized what was happening and moved my customization to /jffs, which was bound to flash. Problem solved.

I find it funny and agree... The lessons we figure out &/or learn the hard way on our own, tend to leave a permanent mark in our thought's.

eibgrad wrote:
Even if the USB is mounted earlier these days, I assume what's happening here is that users are enabling JFFS2 and having it bound to internal flash initially, then (unknowingly) it gets rebound to USB later because they named their USB partition jffs. That itself can cause problems.

Yes, many blindly do this. Even while many others have stated to never do so, in many different threads over the years.

eibgrad wrote:
Regardless, I just think it's bad practice to ever bind /jffs to anything other than internal flash. To do otherwise is to invite potential problems.

JMTC

Well, with the cravats you've pointed out & the few potentially catastrophic ones I've pointed out. I think you'd agree that neither method comes without some risk or drawback. On top of the ones of merely using these firmware's.


Just want to be clear...

I by NO means was questioning your vast knowledge or your well appreciated contributions to these forums.
I was just adding my findings to them as information, as I feel they are also accurate.

P.S. This may be OT to this thread, but as I may have your attention...
I'm curious of your thought's on my "hack" for retaining the leases file through reboots that I linked to in my last post...aside from it being on USB jffs of course.
As at least to me, it "appears" to work well, without any "visible" drawbacks.
Thanks

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12915
Location: Netherlands

PostPosted: Sun May 26, 2019 8:57    Post subject: Reply with quote
Just to throw in my thoughts, I bricked a router when upgrading and having jffs2 enabled exactly like dr_K described
So I am no fan of jffs2.
Many user problems arise from enabling it and then also have jffs on USB.

So I favour the approach/script from @eibgrad, thanks!

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Tue May 28, 2019 22:56    Post subject: Reply with quote
eibgrad wrote:
@Dr_K

Rather than assume it works, I decided to actually implement it. Here's something significantly better (and tested).

Code:
(
set -x
partition="jffs"
start_time=$(date +%s)
while :; do
    df | grep -Eq "[[:space:]]+/$partition\$" && break
    [ $(($(date +%s) - start_time)) -ge 60 ] && exit
    sleep 3
done
while ! pidof dnsmasq > /dev/null 2>&1; do sleep 3; done
stopservice dnsmasq && sleep 3
[ -f /$partition/dnsmasq.leases ] || cp /tmp/dnsmasq.leases /$partition/
ln -sf /$partition/dnsmasq.leases /tmp/
restart dnsmasq
) 2>&1 | logger -t $(basename $0)[$$] &


You can specify the partition of your choice. And it will wait until that partition is actually mounted (which is more important in the case of a USB drive). If it doesn't find the partition mounted within 60 secs, it just quits, without making any changes. It also writes to the syslog so you can actually see it working and detect errors/problems.

If there's no /jffs/dnsmasq.leases file, it copies anything it finds in /tmp/dnsmasq.leases to /jffs/dnsmasq.leases. Hopefully this catches any leases that happen to get allocated early. After that, everything else added to /tmp/dnsmasq.leases should persist on /jffs/dnsmasq.leases.

I'll probably just add this to my collection of scripts on PasteBin.com, along w/ better documentation. I just wanted to show something working.

UPDATE: I fully documented and immortalized the script on my PasteBin account.

https://pastebin.com/MxA19W1M

@eibgrad
Thank you for your giving your time & attention to this.

Once again, going above & beyond in making something much better… & with logging!

I will edit my typo in my linked post for any future reader….good catch, Thank you.

If I may, I’d like to also amend the end of that post with your improved version.
Quoting your above last post & clearly giving the credit to you of course.


If you’re still following this thread... In youre version on Pastebin, I’d like to make 2 comments & ask 1 question, if I may… respectfully not criticality.

In your instructions, step 1 is to enable “jffs2”. If you use jffs2, even though your script is more robust, wouldn’t it be easier to just use the GUI setting under Services/Services “Use JFFS2 for client lease DB”? Or is it just to use your script installer?

You point to a specific location “/tmp/mnt/sda1”. This could become problematic if you’re using more than one USB drive, as occasionally on reboots they will mount to different locations (eg. sda, sdb or sdc). Whereas calling for jffs &/or opt will always hit its mark.

Can I use your last line for logging from your Pastebin version in place of the one you posted above, if I use that one? If so, what more info will it provide?


One last thing…
In your earlier comment, you touched on another issue I’ve been having that I have been fixing manually from time to time.

As after a predetermined number of reboots, the logs suggest to run e2fsck on all my Linux type partitions…

Could you please shed some light on how to call on these “premounting actions”. Or better yet, only when needed. Then maybe ended with a reboot, to avoid the potential issue you also mentioned earlier.

Or point to where I can find any dd-wrt compatible information to figure it out, as in the past I’ve found the wiki dry of any such info.


Thank you again for your time & efforts.

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Thu May 30, 2019 13:36    Post subject: Reply with quote
eibgrad wrote:
It's only meant for the installer. Obviously the intent of the script is to keep the actual dhcp leases database OFF jffs.

Actually, more specifically OFF jffs2 & instead on jffs(USB)

I apologize for my not fully understanding the script installer, as I’ve always avoided such things, partly out of distrust & more to actually learn from what I’m trying to doing.
Dr_K wrote:
You point to a specific location “/tmp/mnt/sda1”. This could become problematic if you’re using more than one USB drive, as occasionally on reboots they will mount to different locations (eg. sda, sdb or sdc). Whereas calling for jffs &/or opt will always hit its mark.

eibgrad wrote:
In this particular case, the point of the dhcp lease script is to keep the dhcp lease DB off jffs. So defaulting to jffs makes no sense. As you said previously, you could as well let the router use jffs to store the dhcp leases and avoid using my script.

I suppose /opt is another default option. But I don't know where that's actually mounted to. Sometimes ppl just mount it back to /jffs (e.g., /jffs/opt)(!), perhaps for an Entware install.

I chose /tmp/mnt/sda1 specifically because a) it's likely to be an external USB drive, and b) most ppl will have one USB drive w/ one partition. So /tmp/mnt/sda1 seemed a reasonable (although not foolproof) assumption. But as w/ any script, you're never going to be right every time. For those cases, you'll have to modify the script.

I think you looked past my point...

I use two USB drives (though maybe uncommon, I’m surely not alone)

1st USB has 4 Linux type partitions: (automounted)
/dev/sda1 mounted to /opt
/dev/sda2 mounted to swap (only really used to tell me that I’ve flashed a really bad build, as that is the only time I’ve seen it used)
/dev/sda3 mounted to /jffs
/dev/sda4 mounted to /tmp/mnt/sda4 (mainly for semi private storage)

2nd USB is a hard drive with 4 NTFS partitions (for Samba Share’s &/or FTP): (automounted)
/dev/sdb1 mounted to /tmp/mnt/sdb1
/dev/sdb2 mounted to /tmp/mnt/sdb2
/dev/sdb3 mounted to /tmp/mnt/sdb3
/dev/sdb4 mounted to /tmp/mnt/sdb4

Like I said, sometimes(?) the two drives mount in a different order..

eg. swapping the /sdaX & the /sdbX

Not really critical for Samba or FTP, but kinda catastrophic for something called out in a script.
Where as pointing to something in /jffs &/or /opt will always find it’s target, no matter how it is mounted.

Also I feel the few who mount /opt from within /jffs(2), are those that can't figure out how to create one on USB &/or don't understand the meaning of irreplaceable memory.
eibgrad wrote:
As a rule, I don't use the automount feature. Instead, I have a startup script that mounts my USB partitions manually by adding them to /etc/fstab. Just prior to mounting, I run e2fsck.

Code:
### mount optware and dropbox partitions
e2fsck -p /dev/sda1
e2fsck -p /dev/sda2
mkdir -p /mnt/dropbox
echo "LABEL=optware /opt         ext2 defaults 1 1" >> /etc/fstab
echo "LABEL=dropbox /mnt/dropbox ext2 defaults 1 1" >> /etc/fstab
mount -a


/opt is for my Entware installation. /mnt/dropbox is a general purpose "dropbox" I maintain on the network for easy file sharing purposes. Any device can read from or write to it.

Once the file is checked (and repaired if necessary), and /etc/fstab is updated, I just call for a remount w/ the -a option.

Yes, I have seen you post similar manual mounting scripts in the past.
I have avoided using them in my misunderstanding of your use of “/etc/fstab” & not knowing what it will or won’t do differently, especially in regards to the drive with jffs, swap & opt.

I guess I’ll have to keep doing my manual “redundant” multi step process of unmounting & running e2fsck –yvf (I’ll have to look into your used “-p” option) on each partition then rebooting (out of concern of screwing up the remount process) all from a SSHd terminal.

Only one time did I need to do it to fix a problem. Mostly I do it because I don’t like seeing errors/ warnings that I can fix in my logs. (The dev’s leave us with plenty enough already)

Thank you again for your time & for sharing your knowledge.

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum