Linksys AC Series Router Configuration Tips for OpenWRT: Difference between revisions

Line 2,368: Line 2,368:
Additional Information: https://restic.readthedocs.io/en/stable/ (Note: In some of their examples a tilde ( ~ ) is used, which is a user's home directory)
Additional Information: https://restic.readthedocs.io/en/stable/ (Note: In some of their examples a tilde ( ~ ) is used, which is a user's home directory)


===Webmin===
==Webmin==
Webmin can be successfully installed on OpenWRT, '''AND IT IS USEFUL'''.  The end of the previous sentence is in all CAPS and '''BOLD''' because of the large number websites and posts that do nothing more than question why anyone would want to install Webmin on OpenWRT instead of just answering the original question of how to install it.  Sometimes it is just nice to have a GUI.  The editor for config files alone is worth it.
Webmin can be successfully installed on OpenWRT, '''AND IT IS USEFUL'''.  The end of the previous sentence is in all CAPS and '''BOLD''' because of the large number websites and posts that do nothing more than question why anyone would want to install Webmin on OpenWRT instead of just answering the original question of how to install it.  Sometimes it is just nice to have a GUI.  The editor for config files alone is worth it.


There is however a word of caution to address: Do NOT use Webmin for any OpenWRT services that have an associated LuCI GUI or /etc/config/WhatEverConfigurationFile because modifications made by Webmin will be wiped out by changes made via LuCI or the /etc/config/Files...  There are many, many services such as BIND / NAMED, Apache / HTTPD, ProFTPD, OpenSSL for OpenVPN Certificate generation that have no LuCI GUI, nor are they "controlled" or configured via the /etc/config/ Files.  That means these services are safe to configure via text or by GUI.
There is however a word of caution to address: Do NOT use Webmin for any OpenWRT services that have an associated LuCI GUI or /etc/config/WhatEverConfigurationFile because modifications made by Webmin will be wiped out by changes made via LuCI or the /etc/config/Files...  There are many, many services such as BIND / NAMED, Apache / HTTPD, ProFTPD, OpenSSL for OpenVPN Certificate generation that have no LuCI GUI, nor are they "controlled" or configured via the /etc/config/ Files.  That means these services are safe to configure via text or by GUI.


====Installing Webmin====
===Pre-Installation Tasks for Installing Webmin===
Download the Webmin ...tar.gz file: wget https://prdownloads.sourceforge.net/webadmin/webmin-1.953.tar.gz
Download the Webmin ...tar.gz file: wget https://prdownloads.sourceforge.net/webadmin/webmin-1.953.tar.gz


Unzip and UnTAR the file;
Unzip and UnTAR the file;


*The location chosen when unzipping and untarring Webmin will be the installation directory where the program runs
*The location chosen when unzipping and untarring Webmin ''can'' be the installation directory where the program runs;
**Possible location: /overlay/webmin (don't use the /tmp directory or it will be gone when the router reboots)
**Typical installation locations for other Linux distributions (do NOT use the /tmp directory or it will be gone when the router reboots);
**CentOS typical location: /usr/libexec/webmin
***CentOS typical location: /usr/libexec/webmin
**Most common location noted by https://doxfer.webmin.com/Webmin/Installation_-_the_old_fashioned_way is: /usr/local
***Debian: /usr/share/webmin
***Locations suggested by Webmin tutorials: /usr/libexec/webmin, /usr/local/webmin
***Location noted by https://doxfer.webmin.com/Webmin/Installation_-_the_old_fashioned_way as the most common for "TAR" Installations: /usr/local/webmin
*gunzip webmin-1.955.tar.gz and tar xvf webmin-1.955.tar
*gunzip webmin-1.955.tar.gz and tar xvf webmin-1.955.tar


Line 2,390: Line 2,392:
(be patient, there are a LOT of files, even on a fast USB 3.0 flash drive it takes a couple of minutes.
(be patient, there are a LOT of files, even on a fast USB 3.0 flash drive it takes a couple of minutes.


*If "untarred" in a different directory, move to the installation directory chosen above
*If "untarred" a directory other than the installation, do one of the following;
**Move the untarred directory to the desired location
**When installing use the command (not yet): ./setup.sh /WhatEverPath


Before running the setup program;
* Before running the setup program;
** Add the bin Group to /etc/group using this: bin:x:10000:
** Make sure PERL is installed with necessary modules
*** opkg update
***opkg install perl perlbase-http-tiny coreutils-stty perlbase-gdbm-file perlbase-extutils perlbase-storable
**Possible Errors & Solutions during and after Installation;
***"Perl Socket module not installed" Error will occur if perlbase-http-tiny is not installed.
***"stty: not found" / "Login password: ./setup.sh: line 396: stty: not found" (the line number may be different depending on the version of the setup script an Webmin being installed) Error will occur if coreutils-stty is not installed
***"The Perl SSLeay library is not installed. SSL not available" Error will occur because the PERL SSLeay module is not available in OpenWRT
***"Can't locate Time/Local.pm in" / "you may need to install the Time::Local module" will occur if the perlbase-time module is not installed
***"No dbm on this machine at" error will occur if perlbase-gdbm-file
***"Error - Perl execution failed  Undefined subroutine &main::get_miniserv_config called at /usr/local/webmin/authentic-theme/session_login.cgi line 17" and / or ""GET / HTTP/1.1" 500 166" (in miniserv.log file) error occurs if perlbase-storable is not installed
***"Can't locate ExtUtils/CBuilder.pm in @INC (you may need to install the ExtUtils::CBuilder module" error occurs if perlbase-extutils is not installed
***" can't open '/var/log/webmin/miniserv.pid': No such file or directory" error occurs when stopping Webmin with /etc/webmin/stop


*Add the bin Group to /etc/group using this: bin:x:10000:
====A Special note on HTTPS (not the Module) for Webmin: Do NOT worry about it. Forget it. Almost impossible to get working.====
*Make sure PERL is installed with necessary modules
**opkg update
**opkg install perl perlbase-http-tiny coreutils-stty perlbase-gdbm-file perlbase-extutils perlbase-storable
 
"Perl Socket module not installed" Error will occur if perlbase-http-tiny is not installed.
 
"stty: not found" / "Login password: ./setup.sh: line 396: stty: not found" (the line number may be different depending on the version of the setup script an Webmin being installed) Error will occur if coreutils-stty is not installed
 
"The Perl SSLeay library is not installed. SSL not available" Error will occur because the PERL SSLeay module is not available in OpenWRT
 
"Can't locate Time/Local.pm in" / "you may need to install the Time::Local module" will occur if the perlbase-time module is not installed
 
"No dbm on this machine at" error will occur if perlbase-gdbm-file
 
"Error - Perl execution failed  Undefined subroutine &main::get_miniserv_config called at /usr/local/webmin/authentic-theme/session_login.cgi line 17" and / or ""GET / HTTP/1.1" 500 166" (in miniserv.log file) error occurs if perlbase-storable is not installed
 
"Can't locate ExtUtils/CBuilder.pm in @INC (you may need to install the ExtUtils::CBuilder module" error occurs if perlbase-extutils is not installed
 
" can't open '/var/log/webmin/miniserv.pid': No such file or directory" error occurs when stopping Webmin with /etc/webmin/stop
 
=====HTTPS for Webmin=====
During installation, Webmin states the Net::SSLeay Perl Module is necessary for HTTPS to work.  If not, the Webmin site is only accessible via HTTP.
During installation, Webmin states the Net::SSLeay Perl Module is necessary for HTTPS to work.  If not, the Webmin site is only accessible via HTTP.


Line 2,428: Line 2,424:
*
*


==== Installing Webmin ====
Run the setup and configuration questions during setup (Note: OpenWRT does not provide the NET::SSLeay Perl Module, so SSL will not be available for Webmin);
Run the setup and configuration questions during setup (Note: OpenWRT does not provide the NET::SSLeay Perl Module, so SSL will not be available for Webmin);


*Detailed instructions to install "The Old Fashion Way..." can be found here: https://doxfer.webmin.com/Webmin/Installation_-_the_old_fashioned_way
*Detailed instructions to install "The Old Fashion Way..." can be found here: https://doxfer.webmin.com/Webmin/Installation_-_the_old_fashioned_way
*In chosen Webmin installation directory, run: ./setup.sh
*In chosen Webmin installation directory, run: ./setup.sh /WhatEverPathToInstallWebmin (see above for potential locations)
**Config Directory: /etc/webmin
**Config Directory: /etc/webmin
**Log file directory: /var/log/webmin
**Log file directory: /var/log/webmin (NOTE: This directory is actually a symbolic link for /tmp, so it will not persist across reboots of a router.  If permanent logs for Webmin are desired, change the path)
**Full path to perl: /usr/bin/perl
**Full path to perl: /usr/bin/perl
**MiniServe Configuration (the web process for webmin): /etc/webmin/miniserv.conf
**MiniServe Configuration (the web process for webmin): /etc/webmin/miniserv.conf
**Error log: If /var/log/webmin (will be wiped out between boots, so find permanent storage location or create with script)
**Configure OS as: 110 - Generic Linux
*When prompted, configure the ETC Directory as: /etc/webmin (suggested)
***OS Choices available when installing Webmin: Pick 110) Geric Linux for OpenWRT;
*Configure the LOG Directory as: /overlay/webmin/log (suggested)
<syntaxhighlight lang="text">
*Configure OS as: 110 - Generic Linux
 
OS Choices available when installing Webmin: Pick 110) Geric Linux for OpenWRT<syntaxhighlight lang="text">
   1) Pardus Linux          2) SmartOS                3) Sun Solaris           
   1) Pardus Linux          2) SmartOS                3) Sun Solaris           
   4) Lycoris Desktop/LX    5) Caldera OpenLinux eS  6) Caldera OpenLinux     
   4) Lycoris Desktop/LX    5) Caldera OpenLinux eS  6) Caldera OpenLinux     
Line 2,480: Line 2,474:
  109) Synology DSM          110) Generic Linux        111) Windows
  109) Synology DSM          110) Generic Linux        111) Windows
</syntaxhighlight>
</syntaxhighlight>
Running Webmin service is not referred to as "webmin", instead it is this: /WhatEverPath/webmin/miniserv.pl


=====Post Installation=====
* Version: 4
Keep in mind, most of the Webmin modules will need to be configured for the OpenWRT environment for them to function properly


=====Configuring Webmin=====
The running Webmin service when viewed by PS or equivalent: {miniserv.pl} /usr/bin/perl /usr/local/webmin/miniserv.pl /etc/webmin/miniserv.conf


*Verify the /etc/webmin/config file contains the following settings;
====Post Installation====
<syntaxhighlight lang="text">
Webmin seems to have an issue detecting ARM CPUs in the Marvell SoC with OpenWRT. This results in an Error 500 Perl execution failed... ...proc::list_processes. To correct the issue modify the /overlay/webmin/proc/module.info File as follows (It disables the Webmin Processor Module because that module does not run correctly on OpenWRT for the AC Series of routers) by removing the generic-linux or *-linux setting;<syntaxhighlight lang="text">
os_type=generic-linux
os_version=4
real_os_type=OpenWRT
real_os_version=19.07.03
</syntaxhighlight>
 
*Modify the /overlay/webmin/proc/module.info File as follows (It disables the Webmin Processor Module because that module does not run correctly on OpenWRT for the AC Series of routers) by removing the generic-linux or *-linux setting;
<syntaxhighlight lang="text">
Original Line: os_support=solaris generic-linux hpux freebsd osf1 irix unixware openserver macos aix netbsd openbsd windows
Original Line: os_support=solaris generic-linux hpux freebsd osf1 irix unixware openserver macos aix netbsd openbsd windows


Line 2,506: Line 2,490:


</syntaxhighlight>
</syntaxhighlight>
"Error:  500 - Perl execution failed – Undefined subroutine &proc::list_processes called" will occur if it is not disabled, although this does not impede Webmin functionality.
Verify the /etc/webmin/config file contains the following settings;<syntaxhighlight lang="text">
 
os_type=generic-linux
For safety considerations, it is also worth disabling additional modules (Samba, etc.) that have a LuCI GUI or are configured via /etc/config using the above method.
os_version=4
 
real_os_type=OpenWRT
=====Alternative Method of Configuring Webmin=====
real_os_version=19.07.03
The /etc/webmin/config file can be set as follows<syntaxhighlight lang="text">
</syntaxhighlight>
Alternative Method of Configuring Webmin settings in /etc/webmin/config file;<syntaxhighlight lang="text">
os_type=linux
os_type=linux
os_version=4
os_version=4
real_os_type=OpenWRT
real_os_type=OpenWRT
real_os_version=19.07.03
real_os_version=19.07.03
</syntaxhighlight>...however, this necessitates that any Webmin modules that require certain operating systems (apache, bind, etc.) need to have their module.info files modified to include the os_type of linux.  The below script modifies all of the module.info files in the /overlay/webmin directory.<syntaxhighlight lang="text">
</syntaxhighlight>...however, this necessitates that any Webmin modules that require certain operating systems (apache, bind, etc.) need to have their module.info files modified to include the os_type of linux.
find /overlay/webmin -type f -name module.info -exec sed -i 's/*-linux/linux *-linux/g' {} +
</syntaxhighlight>And again, the /overlay/webmin/proc/module.info will need to be modified as above.


=====Adding and Configuring Modules=====
And again, the /overlay/webmin/proc/module.info will need to be modified as above.
 
Also, most of the Webmin modules will need to be custom configured for the OpenWRT environment in order to function properly.  See below...
 
===Adding and Configuring Webmin Features & Modules===
Before any modules are moved from the Unused-Modules Category, they must be properly configured for Webmin to detect.
Before any modules are moved from the Unused-Modules Category, they must be properly configured for Webmin to detect.


=====Date and Time=====
====Date and Time====
The LuCI GUI does not provide a method to manually change the date or time (see https://openwrt.org/docs/guide-user/services/ntp/client-server).  The reason appears to be that the AC Series of routers, among many other router models, lacks the hardware capability to maintain an internal clock when the router is off or unplugged.  Instead, it syncronizes with a known NTP (Network Time Protocol) server after booting up.  This seems to be confirmed, in that during booting, part of the boot process is to set the clock to midnight January 1, 1970 (see https://openwrt.org/toh/linksys/linksys_wrt3200acm).
The LuCI GUI does not provide a method to manually change the date or time (see https://openwrt.org/docs/guide-user/services/ntp/client-server).  The reason appears to be that the AC Series of routers, among many other router models, lacks the hardware capability to maintain an internal clock when the router is off or unplugged.  Instead, it syncronizes with a known NTP (Network Time Protocol) server after booting up.  This seems to be confirmed, in that during booting, part of the boot process is to set the clock to midnight January 1, 1970 (see https://openwrt.org/toh/linksys/linksys_wrt3200acm).


Once booted, the the Webmin interface provides a relatively easy method to configure the date and time when the module is properly configured properly.  In the default Webmin Dashboard, Time on System;
Once booted, the the Webmin interface provides a relatively easy method to configure the date and time when the module is properly configured properly.  In the default Webmin Dashboard, Time on System;


*CLOCK, Settings Icon (the gear at the top left of the configuration payne), System configuration, System time setting format, YYYYMMDDHHMM.SS Radio Button.
*CLOCK, Settings Icon (the gear at the top left of the configuration payne), System configuration, System time setting format, YYYYMMDDHHMM.SS Radio Button
 
OR
 
*/etc/webmin/config: dateformat=dd/mon/yyyy


Remember, the modified time will not persist across reboots.
Remember, the modified time will not persist across reboots.  The setting for the format in Webmin will persist, but the AC series of routers, as most others, does not maintain an internal clock when off or unplugged.  The time is set by accessing an NTP server when the router boots up.


======Users and Groups======
====Users and Groups====
System, Users and Groups, Settings;
System, Users and Groups, Settings;


Line 2,539: Line 2,530:
Group file: /etc/group
Group file: /etc/group


======Apache / Apache2 / HTTPD Module (/etc/webmin/apache/config)======
====Webmin Performance====
To decrease the Webmin CPU load on the OpenWRT router (this isn't really necessary for the AC router series as there is "horsepower" to spare);
 
*Disable Real-Time Monitoring: Webmin, Webmin Configuration, Themes, Real-time monitoring options, Enable real-time monitoring, NO
*Reduce Real-Time Monitoring Refresh: Interval for performing update, 10000 (Increasing the default value of 1000 (ms) will also cause delays in information in certain categories, such as Network I/O to be displayed slowly)
 
====Other Notes for Webmin====
Some modules, such as NAMED / BIND, may not accurately show the Stop / Start status after a stop or start until after a screen refresh, which is possibly related to the Monitoring Refresh time mentioned above, if increased.
 
====Apache / Apache2 / HTTPD Webmin Module (/etc/webmin/apache/config)====
<div class="toccolours mw-collapsible mw-collapsed" style="width:400px; overflow:auto;">
<div class="toccolours mw-collapsible mw-collapsed" style="width:400px; overflow:auto;">
<div style="font-weight:bold;line-height:1.6;">Code Block</div>
<div style="font-weight:bold;line-height:1.6;">Code Block</div>
Line 2,563: Line 2,563:
</syntaxhighlight></div></div>
</syntaxhighlight></div></div>


======BIND / BIND8 / NAMED (/etc/webmin/bind8/config);======
====BIND / BIND8 / NAMED Webmin Module (/etc/webmin/bind8/config);====
The below Code Block contains the settings to customize the Webmin interface for BIND / NAMED;
The below Code Block contains the settings to customize the Webmin interface for BIND / NAMED;
<div class="toccolours mw-collapsible mw-collapsed" style="width:400px; overflow:auto;">
<div class="toccolours mw-collapsible mw-collapsed" style="width:400px; overflow:auto;">
Line 2,643: Line 2,643:
Sadly, for the BIND / NAMED module, it didn't seem that OpenWRT included the ''named-compilezone'' command.  However, after some quick research with a major hint (from here: http://www.linuxfromscratch.org/blfs/view/svn/server/bind.html) which included a notation that the ''named-compilezone'' command was a symbolic link, then a quick check on a CentOS system which showed the /usr/sbin/named-compilezone pointing to /usr/sbin/named-checkzone, which confirmed the utility as a standalone file does NOT exist, but is simply a softlink to another file.  The solution is to add this line to the rc.local file: ln /usr/sbin/named-checkzone /usr/sbin/named-compilezone  That way the command is available to Webmin.
Sadly, for the BIND / NAMED module, it didn't seem that OpenWRT included the ''named-compilezone'' command.  However, after some quick research with a major hint (from here: http://www.linuxfromscratch.org/blfs/view/svn/server/bind.html) which included a notation that the ''named-compilezone'' command was a symbolic link, then a quick check on a CentOS system which showed the /usr/sbin/named-compilezone pointing to /usr/sbin/named-checkzone, which confirmed the utility as a standalone file does NOT exist, but is simply a softlink to another file.  The solution is to add this line to the rc.local file: ln /usr/sbin/named-checkzone /usr/sbin/named-compilezone  That way the command is available to Webmin.


=====DHCPD (/etc/webmin/dhcpd/config)=====
====DHCPD Webmin Module (/etc/webmin/dhcpd/config)====
As noted in the main DHCPC section, there is no LuCI GUI, nor is there any good reason to stay within the OpenWRT managment paradigm (at least for DHCPD).  Unlike some other instances like Samba Server where it makes sense to maintain the "OpenWRT management style" of services, with DHCPD every aspect of Webmin can be utilized.  Below are the configuration settings for the DHCPD Webmin Module;<syntaxhighlight lang="text">
As noted in the main DHCPC section, there is no LuCI GUI, nor is there any good reason to stay within the OpenWRT managment paradigm (at least for DHCPD).  Unlike some other instances like Samba Server where it makes sense to maintain the "OpenWRT management style" of services, with DHCPD every aspect of Webmin can be utilized.  Below are the configuration settings for the DHCPD Webmin Module;<syntaxhighlight lang="text">
lease_file=/tmp/dhcpd.leases
lease_file=/tmp/dhcpd.leases
Line 2,670: Line 2,670:
</syntaxhighlight>Items such as dhcpd_version can be modified to reflect whatever version of DHCPD is available in the future.  No modifications need to be made to the /overlay/webmin/dhcpd/module.info (assuming the root path of Webmin is /overlay) file as this Module seems to be compatible with every version of DHCPD on every Linux distribution.
</syntaxhighlight>Items such as dhcpd_version can be modified to reflect whatever version of DHCPD is available in the future.  No modifications need to be made to the /overlay/webmin/dhcpd/module.info (assuming the root path of Webmin is /overlay) file as this Module seems to be compatible with every version of DHCPD on every Linux distribution.


=====Samba Server (/etc/webmin/samba/config)=====
====Samba Server Webmin Module (/etc/webmin/samba/config)====
First, if it hasn't already been stated, a LuCI GUI (Services, Network Shares) for Samba exists.  AND it makes sense to stay within the OpenWRT management / configuration paradigm for services (/etc/config/samba3 or samba4).  Having noted that, the LuCI GUI does not have all the bells and whistles of Webmin, but what is there looks a whole lot better.  So for this one, a hybrid approach is best.
First, if it hasn't already been stated, a LuCI GUI (Services, Network Shares) for Samba exists.  AND it makes sense to stay within the OpenWRT management / configuration paradigm for services (/etc/config/samba3 or samba4).  Having noted that, the LuCI GUI does not have all the bells and whistles of Webmin, but what is there looks a whole lot better.  So for this one, a hybrid approach is best.


Making so Webmin recognizes the Samba Module as an active module requires editing the /overlay/webmin/samba/module file (assuming /overlay is the root of the Wemin installation path chosen).  For some reason the wildcard version of Linux (*-linux) setting is not respected with OpenWRT / Webmin.  That makes it necessary to add the full name of the os_type setting in the /etc/webmin/config file (which should be ''generic_linux'') into the /overlay/webmin/samba/module file os_support setting.  See below;
Making so Webmin recognizes the Samba Module as an active module requires editing the /overlay/webmin/samba/module file (assuming /overlay is the root of the Wemin installation path chosen).  For some reason the wildcard version of Linux (*-linux) setting is not respected with OpenWRT / Webmin.  That makes it necessary to add the full name of the os_type setting in the /etc/webmin/config file (which should be ''generic_linux'') into the /overlay/webmin/samba/module file os_support setting.  See below;


* Original line: os_support=solaris *-linux aix hpux freebsd osf1 irix openserver unixware openbsd macos netbsd  
*Original line: os_support=solaris *-linux aix hpux freebsd osf1 irix openserver unixware openbsd macos netbsd
* New line: os_support=solaris generic-linux *-linux aix hpux freebsd osf1 irix openserver unixware openbsd macos netbsd  
*New line: os_support=solaris generic-linux *-linux aix hpux freebsd osf1 irix openserver unixware openbsd macos netbsd


The below configuration for the Samba Webmin Module allows for management of Samba features not included in the LuCI GUI.  The Webmin GUI for Samba also provides a path to overstep what should be configured with Samba via Webmin, so use the "restraint" items noted below the configuration section;<syntaxhighlight lang="text">
The below configuration for the Samba Webmin Module allows for management of Samba features not included in the LuCI GUI.  The Webmin GUI for Samba also provides a path to overstep what should be configured with Samba via Webmin, so use the "restraint" items noted below the configuration section;<syntaxhighlight lang="text">
Line 2,711: Line 2,711:
Additional information can be found here: https://openwrt.org/docs/guide-user/services/nas/samba  It also illustrates the limits of the what the LuCI GUI interface can and can't do.  And it demonstrates at which point editing of the smb.conf.template via a text editor (available within the LuCI GUI on the Edit Template Tab) or in this case Webmin is necessary.
Additional information can be found here: https://openwrt.org/docs/guide-user/services/nas/samba  It also illustrates the limits of the what the LuCI GUI interface can and can't do.  And it demonstrates at which point editing of the smb.conf.template via a text editor (available within the LuCI GUI on the Edit Template Tab) or in this case Webmin is necessary.


=====Third Party Modules (OpenVPN Certificate Authority, not OpenVPN itself as that is configured via LuCI or /etc/config, etc)=====
====Third Party Modules (OpenVPN Certificate Authority, not OpenVPN itself as that is configured via LuCI or /etc/config, etc)====
Install via the Webmin GUI and remember to configure the module.info file if necessary and settings
Install via the Webmin GUI and remember to configure the module.info file if necessary and settings


Line 2,739: Line 2,739:
</syntaxhighlight></div></div>
</syntaxhighlight></div></div>


=====Starting and Stopping Webmin=====
===Starting and Stopping Webmin===
Start: /etc/webmin/start
Start: /etc/webmin/start


Line 2,746: Line 2,746:
Additonally, /etc/webmin/start can be added to the /etc/rc.local file to automatically start Webmin at boot.
Additonally, /etc/webmin/start can be added to the /etc/rc.local file to automatically start Webmin at boot.


=====Webmin Performance=====
A service can even be created in /etc/init.d/webmin with the following code;<syntaxhighlight lang="text">
To decrease the Webmin CPU load on the OpenWRT router;
#!/bin/sh /etc/rc.common


*Disable Real-Time Monitoring: Webmin, Webmin Configuration, Themes, Real-time monitoring options, Enable real-time monitoring, NO
START=99
*Reduce Real-Time Monitoring Refresh: Interval for performing update, 10000 (Increasing the default value of 1000 (ms) will also cause delays in information in certain categories, such as Network I/O to be displayed slowly)
 
reload() {
        /etc/webmin/reload
}
 
restart() {
        /etc/webmin/restart
}
 
start() {
        mkdir -p -m 0750 /var/log/apache2
        /etc/webmin/start
}


=====Special Notes for Webmin=====
stop() {
Some modules, such as NAMED / BIND, may not accurately show the Stop / Start status after a stop or start until after a screen refresh, which is possibly related to the Monitoring Refresh time mentioned above, if increased.
        /etc/webmin/stop
}
</syntaxhighlight>


===Sources===
==Sources==
https://forum.openwrt.org/t/script-mount-alternate-nand-firmware-linksys/33588
https://forum.openwrt.org/t/script-mount-alternate-nand-firmware-linksys/33588


https://forum.openwrt.org/t/solved-how-to-mount-ubifs-in-openwrt-kirkwood/32443/4
https://forum.openwrt.org/t/solved-how-to-mount-ubifs-in-openwrt-kirkwood/32443/4


===Startup Scripts===
==Startup Scripts==
/etc/rc.local
/etc/rc.local


LuCI, System, Startup, Local Startup
LuCI, System, Startup, Local Startup
Some useful startup items;<syntaxhighlight lang="text">
# In order to make the named-compilezone command work for webmin, add the following line (research indicated it was a symbolic link)
ln /usr/sbin/named-checkzone /usr/sbin/named-compilezone
# Create a TEMP Folder for phpMyAdmin
mkdir /tmp/phpMyAdmin
chmod 777 /tmp/phpMyAdmin
# If it is desirable to have the non-active Flash Memory RootFS2 partition available on a WRT3200ACM, then do the following;
#ubiattach -m 8
#mkdir /mnt/MTD8
#mount -t ubifs /dev/ubi2_1 /mnt/MTD8
# If an external drive is used as the overlay, the mtb9 / syscfg partition is attached and mounted by default as /tmp/syscfg as UBI1, so these commands aren't needed, but achieve the same result.  This appears to be a minor flaw in the OpenWRT boot process.;
#ubiattach -m 9
#mkdir /tmp/MTD9
#mount -t ubifs /dev/ubi1_0 /tmp/MTD9
# Webmin Related
# Added as a SERVICE, so not needed
#mkdir /tmp/log/webmin
#/etc/webmin/start
# OpenWRT puts the Apache directory in an unusual location for those with a CentOS / RedHat background.  Instead of modifying all of the default
# locations, it is easier to set up a softlink to the more familiar CentOS locations.  Remember, VAR redirects to TMP, hence the mkdir /tmp/www instead
# of mkdir /var/www
mkdir /tmp/www
ln -s /usr/share/apache2/htdocs /var/www/html
ln -s /usr/share/apache2/cgi-bin /var/www/cgi-bin
ln -s /usr/share/apache2/error /var/www/error
ln -s /usr/share/apache2/icons /var/www/icons
</syntaxhighlight>


==Console Connectivity==
==Console Connectivity==