Migrating config from 19.07 to 21.02 (swconfig to DSA)

What is the best method, what is my workflow, for migrating an OpenWRT configuration from a "swconfig" version to a "DSA" version? What process can I use to make certain that I don't overlook any aspect of the existing configuration? The config system in Luci is deeply nested and doesn't lend itself to a linear list, to my knowledge; it would require dozens of screenshots to record everything. Is there a better way?

I have been using OpenWRT with a Linksys WRT3200AACM router for several years. I am not especially knowledgeable about either OpenWRT or router technology or even networking in general, however (I have forgotten most of what I once learned). I have likely never enjoyed its full capabilities, nor have I been aggressive about upgrades.

So three years hence I'm trying to upgrade the OpenWRT firmware image, and I've run into a snag because of the migration from "swconfig" to "DSA". That topic is completely opaque to me, well beyond my skillset, so I need to muddle through as best I can. I obviously want to preserve my existing configuration as much as that is possible. I have not had need of any VLAN configuration... YET. I may finally want to utilize that feature regarding my NAS when the firmware is updated.

As you appear to already know, you're going to need to start from scratch on the settings -- you cannot keep settings across this upgrade due to the migration from swconfig to DSA.

The general advice would be as follows:

  • make a backup -- you can use this as a reference as you are recreating your settings post-upgrade.
  • before you upgrade, also take inventory of what you might have added (packages) or configured such that it is significantly different from a default configuration (hint: you can actually get a list of all installed packages).

Getting more to the point, though: how different is your configuration relative to the default? Obviously things like wifi will be non-default, but what else have you changed?

How exactly do I use the contents of a backup as a (human-readable) reference? Is every file in the backup already human readable?

Aside from what extra software I installed - neither of which I wound up using - I'm not fully aware of how my configuration differs from default. I barely knew what I was doing when I initially configured it, and I haven't revisited it in the three years since. The Luci UI is not conducive to a quick grasp of it all, being so deeply nested as it is.

Is there a means that I can list the entire configuration in some linear JSON-like format? That would be MUCH easier for me to consume... and replicate.

Download the backup-- it is a tar archive so Linux can handle it directly as well as archive / zip programs on Windows.

The files inside particularly in /etc/config are text files with a basic structure. All of the differences between DSA and swconfig will be in /etc/config/network.

1 Like

I will have a closer look at all the individual files tomorrow, when I have opportunity to attempt this. I will load them all up in Notepad++ and use them as a reference to reconfigure it, trusting that everything I did change at least will be recorded in them.

Maybe it is best to start over from scratch and simply recreate your wifi settings and basic network config. Then add things as you need from there.

2 Likes

An unofficial but tested sysupgrade method for 19.07 to 21.02 is renaming /etc/config/network and /etc/config/system prior to uploading a sysupgrade image, then forcing it. You'll get a scary warning still, but providing these files are named something like /etc/config/network.old and /etc/config/system.old, the sysupgrade process will work fine as they'll just get regenerated with fresh valid configuration files.

As you are aware there is no choice but to wipe your network configuration due to the switch management under DSA, if you don't wipe your old network config, you'll semi brick your router (well at least one boot partition, given the dual flash on the WRT3200ACM).

This somewhat crude method will allow you to at least keep most package files and configurations intact outside of network/DSA, although some packages i.e. DDNS, may have changed since 21.02, so you may need to do some reconfiguring i.e. using old/invalid configuration variables. For the most part though, most packages should just run with the 19.07 configuration in place, but your mileage may vary subject to what packages you have.

I found this way suited my upgrade process due to a lot of additional packages. I used imagebuilder to generate a sysupgrade image with all my packages installed and it was also handy to use my /etc/config/network.old to copy non DSA specific settings for interfaces. Using imagebuilder with packages installed from 19.07 is however likely to yield issues when trying to generate an image due to different packages or packages that don't exist in 21.02, so I needed to do some manual handling there to get an image to build.

Example: wireguard as a package is no longer present in 21.02, being part of the kernel itself but was installed under 19.07, this package would need to be excluded from image builder for 21.02.

As advised, a full tar backup is still a very good idea, in the event a sysupgrade goes wrong or you need to revert back to 19.07. Fortunately, with dual flash, one of your partitions will have your previous 19.07.x build on which you'll be able to boot to, but best to cover all areas.

Wireguard most certainly exists as a package in 21.02

Summary
root@OpenWrt:~# opkg list | grep wireguard

kmod-wireguard - 5.4.179-1 - WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPSec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. It uses UDP.

luci-app-wireguard - git-20.244.42172-21563a2 - WireGuard Status

luci-i18n-wireguard-ar - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - العربية (Arabic)

luci-i18n-wireguard-bg - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - български (Bulgarian)

luci-i18n-wireguard-bn - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - বাংলা (Bengali)

luci-i18n-wireguard-ca - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Català (Catalan)

luci-i18n-wireguard-cs - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Čeština (Czech)

luci-i18n-wireguard-da - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Dansk (Danish)

luci-i18n-wireguard-de - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Deutsch (German)

luci-i18n-wireguard-el - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Ελληνικά (Greek)

luci-i18n-wireguard-en - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - English

luci-i18n-wireguard-es - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Español (Spanish)

luci-i18n-wireguard-fi - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Suomi (Finnish)

luci-i18n-wireguard-fr - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Français (French)

luci-i18n-wireguard-he - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - עִבְרִית (Hebrew)

luci-i18n-wireguard-hi - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - हिंदी (Hindi)

luci-i18n-wireguard-hu - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Magyar (Hungarian)

luci-i18n-wireguard-it - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Italiano (Italian)

luci-i18n-wireguard-ja - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - 日本語 (Japanese)

luci-i18n-wireguard-ko - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - 한국어 (Korean)

luci-i18n-wireguard-mr - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Marāṭhī (Marathi)

luci-i18n-wireguard-ms - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Bahasa Melayu (Malay)

luci-i18n-wireguard-no - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Norsk (Norwegian)

luci-i18n-wireguard-pl - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Polski (Polish)

luci-i18n-wireguard-pt - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Português (Portuguese)

luci-i18n-wireguard-pt-br - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Português do Brasil (Brazilian Portuguese)

luci-i18n-wireguard-ro - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Română (Romanian)

luci-i18n-wireguard-ru - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Русский (Russian)

luci-i18n-wireguard-sk - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Slovenčina (Slovak)

luci-i18n-wireguard-sv - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Svenska (Swedish)

luci-i18n-wireguard-tr - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Türkçe (Turkish)

luci-i18n-wireguard-uk - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Українська (Ukrainian)

luci-i18n-wireguard-vi - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - Tiếng Việt (Vietnamese)

luci-i18n-wireguard-zh-cn - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - 简体中文 (Chinese Simplified)

luci-i18n-wireguard-zh-tw - git-22.072.58822-9be6f29 - Translation for luci-app-wireguard - 繁體中文 (Chinese Traditional)

luci-proto-wireguard - git-21.243.21928-71fe35c - Support for WireGuard VPN

wireguard-tools - 1.0.20210223-2 - WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPSec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. It uses UDP. This package provides the userspace control program for WireGuard, `wg(8)`, a netifd protocol helper, and a re-resolve watchdog script.

I use a diff program to compare configs, and use that as a guide.

Example -

I do the same for packages.

WG changed from being a package to a kmod hereabouts.

1 Like

Fair enough :-). Valid distinction, for sure.

As @anomeome clarified for me, I was referring to the fact the package itself named wireguard doesn't exist in 21.02, but did in 19.07 so if you were to try and use imagebuilder in 21.02 with packages installed from 19.07, that's one of the gotchas, but it's not exclusive to Wireguard, just an example I know of. Wireguard itself of course exists in 21.02, sorry if I wasn't being clear there.

1 Like

Shortly I'm going to try this shortcut procedure, since it seems applicable to my simplistic use of the router. Thank you for mentioning it. I can still use WinMerge to compare the before and after copies of the network and system files. I've forgotten how the dual-ROM feature works, but nevertheless I have a 19.07 backup, so if it were necessary I could clean-install 21.02, make a backup of that, compare all the files and not just network and system, and then edit from there.

power switch method, you can also install app or use CLI.

This will no doubt reveal the depth of my ignorance, but how exactly do I rename these files? For the first time I enabled SSH on the router, used Kitty to connect to it via BusyBox and get a command prompt... but now I'm stuck. I recall precious little about using Linux via a command line; the last time I did that might have been around '93 with Slackware! I tried to use cd to switch to the /etc directory, but was told it didn't exist. I then tried ls to list everything, but the command returned nothing. I then guessed and tried ls -all, and while that provoked a response it was nothing more than "." and "..", so it's seeing no files or directories.

What am I doing wrong?

Addendum: Okay, apparently I wasn't at the root! cd / got me to the root, and then ls had some things to report. Onward....

cd /etc/config
mv network networkBAK
mv system systemnnBAK

do not forget this is happening on the image from which you are flashing away from

cd /etc/config
mv network network.old
mv system system.old

Ha @anomeome beat me to it.

Already done! I managed to reeducate myself....

What does that mean, and how does it affect what I'm doing? Do you mean to say that my commands here are not acting upon the ROM image that will be upgraded, or that the upgrade ROM will actually be written to the non-active Flash, leaving these renamed files behind in the Flash that will become non-active? I've forgotten how the dual-Flash feature works.

The image that you flash will have the change, but since those files do not exist the startup system will generate default OOTB configs. But should you go back to the previous image as per above, you will again have OOTB defaults so:

cd /etc/config
mv networkBAK network
mv systemBAK system

to actually get back from whence you came will be required; or restore that backup that you generated.