32k nvram help

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
Biller007
DD-WRT Novice


Joined: 06 Feb 2015
Posts: 22

PostPosted: Thu Feb 12, 2015 18:08    Post subject: 32k nvram help Reply with quote
Hi,

I am trying to stay below the 32k mark as suggested. When I set my vpn up it takes me to 34k, any suggestions how I can lower it. The whole purpose was to use with my vpn.

thanks

I have a ea6900 Linksys router
Sponsor
Twingo
DD-WRT User


Joined: 30 Dec 2007
Posts: 135

PostPosted: Thu Feb 12, 2015 18:49    Post subject: Reply with quote
Put this line into your start-up script,


for line in `nvram show | grep =$ `; do var=${line%*=}; nvram unset $var; done

this works on both ea6700 and 6900, it's discussed in the ea6700 and ea6900 threads, with this your nvram can be lowered to ~24KB.
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Thu Feb 12, 2015 19:45    Post subject: Reply with quote
Actually...the script is.

nvram show | grep =$ | wc -l
for line in `nvram show | grep =$ `; do var=${line%*=}; nvram unset $var; done

I've been using it on all my units for about a year...it keeps the nvram that was pushing the 32K mark...back into the 20-25k size.

works for me.

redhawk

_________________
The only stupid question....is the unasked one.
Twingo
DD-WRT User


Joined: 30 Dec 2007
Posts: 135

PostPosted: Thu Feb 12, 2015 20:26    Post subject: Reply with quote
Thank you for clarification, will bookmark this thread so I can use the script for all my units Laughing
Biller007
DD-WRT Novice


Joined: 06 Feb 2015
Posts: 22

PostPosted: Thu Feb 12, 2015 20:52    Post subject: Reply with quote
this works until I put the vpn startup script in then it goes to 35. Is there a way to put in two start up scripts, or add this one to the vpn script?
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Thu Feb 12, 2015 20:55    Post subject: Reply with quote
How does

nvram show | grep =$ | wc -l

benefit the user when added to a script as all it does is count the number of empty variables? It would seem to me that it has no baring on the next command, the result is not visible when run in a script and takes up additional nvram space when added to any of the administration -> commands section.

Am I missing something?
Biller007
DD-WRT Novice


Joined: 06 Feb 2015
Posts: 22

PostPosted: Thu Feb 12, 2015 21:04    Post subject: Reply with quote
I did a factory reset and re ran the script brought it back down to 24. The VPN script replaces this one I think is the issue. need to find out if there is a way to run multiple start up scripts.
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Thu Feb 12, 2015 21:33    Post subject: Reply with quote
Biller007 wrote:
I did a factory reset and re ran the script brought it back down to 24. The VPN script replaces this one I think is the issue. need to find out if there is a way to run multiple start up scripts.


I don't see any issue with adding those lines to the beginning of your VPN script. What it does is parse your nvram variables looking for null variables and deletes them (unset). If you were to run that command twice, the second time it would do absolutely nothing as there are no more nvram null variables

I can't see any problems so long as nothing is dependent on the existence of a nvram variable even if it is null.
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Thu Feb 12, 2015 21:34    Post subject: Reply with quote
JAMESMTL wrote:
How does

nvram show | grep =$ | wc -l

benefit the user when added to a script as all it does is count the number of empty variables? It would seem to me that it has no baring on the next command, the result is not visible when run in a script and takes up additional nvram space when added to any of the administration -> commands section.

Am I missing something?


I'll be honest...I'm rather inept when it comes to scripting...however, I know I got a ton of errors when I tried to run without the "nvram show | grep =$ | wc -l" included.

I suppose this line may not be necessary...but I'm just providing feedback from my personal experience.

redhawk

_________________
The only stupid question....is the unasked one.
jheide44
DD-WRT Guru


Joined: 03 Sep 2013
Posts: 739

PostPosted: Thu Feb 12, 2015 21:46    Post subject: Reply with quote
so due to CFE limitations this device is a don't think about K3... right? The 256K NVRAM would have been nice...

http://svn.dd-wrt.com/ticket/3164

_________________
reenignE esreveR
Resistance is NOT futile... It's Voltage divided by Current!


_.-:Curently Deployed Devices:-._
Loc_1.0: R6400 -- v3.0-r51887 std (02/28/23)
Loc_2.0: R6300v2 -- Kong PTB 35550M 03-28-2018

Others: too many others to list

R7000 (& similar HW) Tips/Tricks HERE.

Assumptions:
1. Everyone on the forum has read the relevant forum section announcements.
2. For Broadcom section we have ALL at least tried to understand the "Peacock" thread,
HERE
mr.l
DD-WRT Novice


Joined: 08 Feb 2012
Posts: 32

PostPosted: Thu Feb 12, 2015 23:26    Post subject: Reply with quote
if u have problem with nvram space u can always move vpn certs and settings from nvram to jffs its not so complicated after all. I posted semi-tutorial how to move vpn server ( for client most steps are same ) from nvram to jffs maybe this will help

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=269331&highlight=
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Thu Feb 12, 2015 23:33    Post subject: Reply with quote
Actually running those commands will reduce nvram usage during runtime. Adding your vpn script via webif startup script will add it to nvram, possibly overrunning nvram at boot.

I believe your router has USB ports, if so why not add a cheap USB key with a jffs partiton. Enable ddwrt usb support, usb storage, and auto mount. Then save your script to /jffs/etc/config. Add .startup extension and make it executable. Ddwrt will then run it after every boot and use no additional nvram space.

As an added benefit of running scripts from external storage, should a script misbehave and cause a boot loop, you can just remove usb drive before boot.
Biller007
DD-WRT Novice


Joined: 06 Feb 2015
Posts: 22

PostPosted: Fri Feb 13, 2015 0:32    Post subject: Reply with quote
Is there a detailed how to on how to set this up on a usb drive?
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Fri Feb 13, 2015 2:53    Post subject: Reply with quote
1. Create a linux partition (ext 2 or 3) on the drive named jffs. I use a GParted live cd but there are various windows programs that can create linux partitions

2. Plug the USB key / drive into the router

3. In ddwrt go to services -> usb and enable core support, then usb storage and auto-mount

Apply and Reboot then return to services -> usb and you should see /jffs on page

4. If not already enabled, enable ssh

5. Install winscp on your computer. This will allow you to browse the router filesystem and to transfer files

6. Create a blank file on pc called something like vpn.startup

7. Edit that file with notepad ++ (DO NOT USE windows notepad)

The first line of the file must be

#!/bin/sh

Paste your script after this line

Save

8. Open winscp and connect to router (user=root,password=your regular password)

Off the root dir you should see a /jffs dir
Create subdir called "etc" if it doesn't exist
From within etc create subdir "config"

copy your script to /jffs/etc/config

Right click on the file and select properties
Set owner privilege X (executable)

Reboot. From this point on your script should run on every startup

Extra reading

http://www.dd-wrt.com/wiki/index.php/Script_Execution
http://www.dd-wrt.com/wiki/index.php/How_to_-_Format_and_Partition_External_Storage_Device
Biller007
DD-WRT Novice


Joined: 06 Feb 2015
Posts: 22

PostPosted: Fri Feb 13, 2015 5:18    Post subject: Reply with quote
Its all done except when I try to do anything in Winscp I get an error 4 message and it wont let me add directories or files any ideas?
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware 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