Now that OpenWRT has released a new stable version: Barrier Breaker 14.07, it was time to upgrade my D-Link DIR-835 router running snapshots to it.
Do do this, I first did the following:
1. Save a list of the packages, using the command:
opkg list-installed
Then using some scripting on the output to ignore the version numbers.
2. Updating the /etc/sysupgrade.conf file to look like this:
/etc/rc.local /etc/syslog-ng.conf /etc/crontabs/ /etc/custom/ /etc/config/
This preserves the above files and directories over the upgrade.
3. I then basically followed the sysupgrade process.
Almost everything came up. The router had LuCI running, WiFi as well as DNS and DHCP came up normally.
Getting opkg to work again with Barrier Breaker
The only glitch was that opkg would refuse to install the packages I had working before the upgrade. This is because the packages were split into categories.
To get this working again, I changed the /etc/opkg.conf file to look like this:
src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/packages
src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base
src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/luci
src/gz barrier_breaker_management http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/management
src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/routing
src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/telephony
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
I then issued the command:
opkg update
Followed by installing the packages from the list I created above.
All packages were found and are working fine, including USB storage, LEDs, curl, ncurses, htop, iftop, ...etc. The only packages that are so far not available, are: syslog-ng3, file, and dstat.
Syslog-NG Alternative
To work around the fact that syslog-ng3 is not available, I used the built in logging feature, as follows:
This assumes that you already have USB storage working, as we detailed in this article.
Then you need to change the file /etc/config/system, and add the following under the 'config system' stanza:
config system ... option log_size '4096' option log_type 'file' option log_file '/mnt/usb/logs/syslog.log'
Then restart the logging:
/etc/init.d/log restart
Also add the above line to /etc/rc.local, right before the 'exit 0' line.
This will create a daily log file, that gets rotated at 7:23 am every day.
If you want to keep longer, then you can implement a cron script to append the previous day's log to a log file with the year and month in its file name.
I use the following script:
#!/bin/sh DIR=/mnt/usb1/logs OLD_LOG=$DIR/syslog.log.old # The hour that this script will run in # This must be the after the daily log rotation at 7:23 HOUR=09 if [ `date +%H` != "$HOUR" ]; then # We are not at the specified hour exit fi # Now get the year and month of the previous month YEAR_MONTH=`date +%Y-%m` # Stop the log temporarily /etc/init.d/log stop # Append the contents of the rotated log to the year-month log cat $OLD_LOG >> $DIR/syslog-$YEAR_MONTH.log # Remove the old log rm $OLD_LOG /etc/init.d/log start
Add the above to crontab as follows:
30 9 * * * /etc/custom/logrotate.sh
Most Comments
Most commented on articles ...