Correct way to upgrade OpenWRT on D-Link DIR-860L B1, including configuration and packages (15.05-->18.06)

Hi!

I'm looking to upgrade an OpenWRT installation on a D-Link router - D-Link DIR-860L B1 from the actual 15.05.1 to the latest 18.06.0. Just to be sure I won't fail, I'm considering doing the upgrade by using LEDE as an intermediary step: 15.05.1 --> 17.01.5 -->18.06.0
The actual OpenWRT 15.05.1 setup contains custom configuration, some done through LuCI, some manual, a firewall custom script, and a few files that I created by folowing the OpenWRT guides:
/usr/bin/set_gpio
/etc/hotplug.d/iface/99-led
Then there are some additional packages installed - copy-paste from my changelog:

opkg update
opkg install ip
opkg install tcpdump
opkg install mc
opkg install libpthread
opkg install htop
opkg install lsof
opkg install openvpn-openssl openvpn-easy-rsa
opkg install luci-app-openvpn

And finally, there are some openvpn keys I generated and copied around where they belong, basically in /etc/easy-rsa/keys/ & /etc/openvpn

As the subject says, I'm looking for the correct way to upgrade OpenWRT and keep all the work & setting I've done plus the additional packages I need.
Will the following work? / Is it the proper way of doing it?
15.05.1 - backup configuration and reset it to default, uninstall all additional packages
upgrade --> 17.01.5
upgrade --> 18.06.0 - restore the 15.05.1 configuration and reinstall additional packages

Thanks in advance for any useful inputs!

Hi justme123,

I never uninstalled packages before upgrade. I had upgraded 3 different routers to version 18.06.0 and had no problems.
Only one backup before always is important. We must always prepared for surprises.
At System/Backup and Flash, select "Keep settings" that will maintain the actual /overlay.

Best regards,
carliedu

Thanks!
I'm worried that the old packages, that were compiled towards older kernel headers and libs, won't run anymore. And while I don't really need most of them, the openvpn will start at boot time and eventually crash.
I'm pretty sure I'll loose /usr/bin/set_gpio & /etc/hotplug.d/iface/99-led, but those files I can amend afterwards.
I'll try your approach and once on 18.06.0 I'll update the packages by following this LEDE related hint (hope it also applies to 18.06.0):

opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade

Problem is, this router is not in my possession but remote, not the best scenario for experiments :wink: Hope I won't kill it or loose the possibility to connect to it anymore. This is actually the reason why I was looking for a "correct" way to upgrade.

1 Like

No / No

The are some hardware detection/config changes between the ancient 15.05 branch and 18.06. So keeping settings or restoring a backup is risky. Changes are expecially related hardware switch and also network interfaces. Restoring old settings might lock you out. (especially dangerous are /etc/config/system, network)

  • no need to uninstall packages or reset before upgrade
  • usually no need to install 17.01.5 in between
  • you should untick "keep settings" and sysupgrade without settings, so that new default settings are created
  • then in 18.06 you can install packages
  • then in 18.06 you can re-create settings, by using the old config files as reference, but you should preferably create the settings by hand from scratch. Only change the new defaults, if really needed.

You forgot to mention the device. That may have impact on the steps...

1 Like

Thanks for your explanations. Sorry, I was in a hurry when I composed my original post and haven't really considered that the router model matters. However, I updated my original post (including the title) and provided the router model, which is D-Link DIR-860L B1
https://wiki.openwrt.org/toh/d-link/dir-860l
I stayed away from using the switch functionality (VLANs) on all my OpenWRT installations just because I always considered a "minimal invasive surgery" approach to the configuration and using a Routed AP scenario, disabling the packet forward on both LAN & WiFi and only allowing specific protocols and ports with custom firewall rules.
With exactly the same configuration, excluding OpenVPN, I was able to upgrade my TL-WR741ND v4 - see:

On this DIR-860L B1 I did some extra surgery, inspired by the OpenWRT Wiki, in order to fix some issues, specifically:

vi /usr/bin/set_gpio
#paste:
#!/bin/sh
PIN=$1
VALUE=$2
PIN_FILE=/sys/class/gpio/gpio$PIN
if [ -z "$PIN" -o -z "$VALUE" ]; then
    echo "Usage: $0 pin value"
    exit 1
fi
echo $PIN >/sys/class/gpio/export
if [ $(cat $PIN_FILE/direction) = "out" ]; then
    echo $VALUE >$PIN_FILE/value
else
    echo "Can't set the value of an input pin!"
fi
echo $PIN >/sys/class/gpio/unexport
chmod +x /usr/bin/set_gpio
_________

vi  /etc/rc.local
#paste before exit 0:
# turn power led green
set_gpio 13 1
set_gpio 15 0
# signal that we are waiting for internets
set_gpio 14 0
____________
vi /etc/hotplug.d/iface/99-led
#paste:
#!/bin/sh
[ "$INTERFACE" != wan ] && exit 0
if [ "$ACTION" = ifup ]; then
    set_gpio 14 1
    set_gpio 16 0
fi
if [ "$ACTION" = ifdown ]; then
    set_gpio 14 0
    set_gpio 16 1
fi
chmod +x /etc/hotplug.d/iface/99-led

Just for the record, I managed to directly upgrade the D-Link DIR-860L B1 from 15.05.01 to 18.06.1 by executing the following steps:

  • LuCi - created a backup of the 15.05.01 configuration
  • LuCi - upgraded to openwrt-18.06.1-ramips-mt7621-dir-860l-b1-squashfs-sysupgrade.bin, unchecked "Keep settings"
  • first boot with 18.06.1, created a backup of the 18.06.1 default configuration through LuCi, just to have a reference, compared some conf files with the ones from 15.05.01
  • installed all the required packages (dozens) with opkg install
  • LuCi - restored 15.05.01 configuration backup and rebooted
  • after the reboot I noticed dnsmasq failing to start, couldn't find the dnsmasq group
  • added to /etc/group
    dnsmasq:x:453:dnsmasq
  • added to /etc/passwd
    dnsmasq:x:453:453:dnsmasq:/var/run/dnsmasq:/bin/false
  • added to /etc/config/system
    config led 'led_wan'
    option name 'wan'
    option sysfs 'dir-860l-b1:green:net'
    option trigger 'netdev'
    option mode 'link tx rx'
    option default '0'
    option dev 'eth0.2'
  • rebooted and everything was working fine, except for the WAN LED, which is always green (it has 2 colors, orange/green) and blinks according to the link activity (RX/TX)

It's either me (my limited understanding of the LED controls) or this LED control system is broken on D-Link DIR-860L B1.
I did install:
opkg install kmod-ledtrig-netdev
And followed this link:
https://openwrt.org/docs/guide-user/base-system/led_configuration
Tried to disable the "Force Link" for the WAN interface and define my own events handling (link up/down) script in /etc/hotplug.d/iface/99-led by playing with /sys/class/leds/dir-860l-b1:green:net/trigger and mode without any positive results. I just stopped wasting time on it, the WAN green LED blinking on activity is fine for me ATM.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.