Migrating to new router - building an image with the same packages

New hardware is arriving. I'm migrating from an all-in-one Buffalo Buffalo WBMR-HP-G300H to a setup with 3 devices: modem, router, ATA. All three will be running OpenWRT. They were chosen after receiving golden advice in these forums ( VDSL modem/router with VoIP capability ).

Now I have to migrate the configuration. The new router just arrived - it's a Netgear R7800 (AC2600) Nighthawk X4S. There are two things I have to do:

  1. Build an OpenWRT image for the Netgear with the same optional packages as I have in the Buffalo.
  2. Copy the relevant configuration options from the Buffalo to the Netgear.

I've made some searching, and I've found that Point 2 can't be accomplished by simply loading the old tar.gz into the new machine ( Transfer config to new router , Migrate configuration from 17.01 to 18.06 possible? (different device) ). Files must be manually chosen and edited by hand. Well, I'll take care of that next. What I'm busy with now is Point 1.

The matter is, I don't even remember which packages were default and which were added by me over the years. I thought about using diff to compare Buffalo/Netgear .config files, but it looks a little involved and messy. Does anyone have suggestions to speed up and simplify the process?

the wiki has guides for dumping packages "since installed"...

  • if there has been a long time, you'd be better off just dumping all packages... then manually re-ordering it by what you recognise...
opkg list-installed | cut -d' ' -f1 > /tmp/allpackagesold.txt
  • then make a new file of what you know you need

you can then automate the re-installation

several things can complicate exporting a package list, including changing the opkg metadata folder, using packages from multiple install locations including extroot and using opkg upgrade.

1 Like

Use caution as you migrate settings - most of the settings can be copied directly, but some cannot without risk/issues. In particular, the wireless and network config files should not be copied over - just use your existing ones as a reference while you configure the new router.

I would recommend working with a standard stable release image, at least initially, and testing as you do the configuration. This way you can be reasonably certain that the failsafe mode will work should you make a mistake along the way. Once you have a working config, if you want to generate your own image, you’ll have all the relevant configs to work with.

I would not try to carry forward your current config

make defconfig && make oldconfig && ./scripts/diffconfig.sh > curDiff
rm .config
make menuconfig

select the new target and some likely packages, and

make defconfig && make oldconfig && ./scripts/diffconfig.sh > newDiff
diff -y --suppress-common-lines curDiff newDiff
cp newDiff .config

repeat, dependencies will be added by package selection, but are not removed on deselection, so build up to your image, or cruft will build up on you. or some such.

1 Like

@anon50098793 I'm preferably looking for ways to generate a suitable config file for building, rather than using opkg after the fact.

@psherman Thanks for the heads up. I've found similar warnings and suggestions to migrate settings, and I'll deal with it later. I expect it to be somewhat tedious.

@anomeome Your tip is exactly what I was looking for. Getting to work on it tomorrow. I'll report. Thank you! :slight_smile:

A few iterations down the road, here's what I'm left with. There might have been some "cruft" in the lantiq xway config already to begin with - like experiments not completely undone. I'm not sure about the kernel modules, and I'd leave them alone until they are actually needed by some higher level service.

Any obvious misses?

CONFIG_TARGET_lantiq=y					      |	CONFIG_TARGET_ipq806x=y
CONFIG_TARGET_lantiq_xway=y				      |	CONFIG_TARGET_ipq806x_generic=y
CONFIG_TARGET_lantiq_xway_DEVICE_buffalo_wbmr-hp-g300h-a=y    |	CONFIG_TARGET_ipq806x_generic_DEVICE_netgear_r7800=y
# CONFIG_ATH_USER_REGD is not set			      <
CONFIG_BUILD_PATENTED=y					      <
# CONFIG_KERNEL_AIO is not set				      <
# CONFIG_KERNEL_CGROUPS is not set			      <
# CONFIG_KERNEL_FANOTIFY is not set			      <
# CONFIG_KERNEL_FHANDLE is not set			      <
# CONFIG_KERNEL_NAMESPACES is not set			      <
# CONFIG_KERNEL_SECCOMP is not set			      <
CONFIG_OPENSSL_ENGINE=y					      <
CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM=y			      <
CONFIG_OPENSSL_WITH_ASM=y				      <
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y			      <
CONFIG_OPENSSL_WITH_CMS=y				      <
CONFIG_OPENSSL_WITH_DEPRECATED=y			      <
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y			      <
CONFIG_OPENSSL_WITH_NPN=y				      <
CONFIG_OPENSSL_WITH_PSK=y				      <
CONFIG_OPENSSL_WITH_SRP=y				      <
CONFIG_OPENSSL_WITH_TLS13=y				      <
CONFIG_OPENVPN_openssl_ENABLE_DEF_AUTH=y		      <
CONFIG_OPENVPN_openssl_ENABLE_FRAGMENT=y		      <
CONFIG_OPENVPN_openssl_ENABLE_LZ4=y			      <
CONFIG_OPENVPN_openssl_ENABLE_LZO=y			      <
CONFIG_OPENVPN_openssl_ENABLE_MULTIHOME=y		      <
CONFIG_OPENVPN_openssl_ENABLE_PF=y			      <
CONFIG_OPENVPN_openssl_ENABLE_PORT_SHARE=y		      <
CONFIG_OPENVPN_openssl_ENABLE_SERVER=y			      <
CONFIG_OPENVPN_openssl_ENABLE_SMALL=y			      <
CONFIG_PACKAGE_blkid=y					      <
CONFIG_PACKAGE_collectd-mod-netlink=y			      <
CONFIG_PACKAGE_ddns-scripts_no-ip_com=y			      <
CONFIG_PACKAGE_e2fsprogs=y				      <
CONFIG_PACKAGE_hostapd-utils=y				      <
# CONFIG_PACKAGE_iwinfo is not set			      <
CONFIG_PACKAGE_kmod-crypto-aead=y			      <
CONFIG_PACKAGE_kmod-crypto-crc32c=y			      <
CONFIG_PACKAGE_kmod-crypto-hash=y			      <
CONFIG_PACKAGE_kmod-crypto-manager=y			      <
CONFIG_PACKAGE_kmod-crypto-null=y			      <
CONFIG_PACKAGE_kmod-crypto-pcompress=y			      <
CONFIG_PACKAGE_kmod-fs-ext4=y				      <
CONFIG_PACKAGE_kmod-fs-vfat=y				      <
CONFIG_PACKAGE_kmod-lib-crc16=y				      <
CONFIG_PACKAGE_kmod-nf-nathelper=y			      <
CONFIG_PACKAGE_kmod-nls-cp437=y				      <
CONFIG_PACKAGE_kmod-nls-iso8859-1=y			      <
CONFIG_PACKAGE_kmod-nls-utf8=y				      <
# CONFIG_PACKAGE_kmod-owl-loader is not set		      <
CONFIG_PACKAGE_kmod-sched-connmark=y			      <
CONFIG_PACKAGE_kmod-scsi-core=y				      <
CONFIG_PACKAGE_kmod-scsi-generic=y			      <
CONFIG_PACKAGE_kmod-tun=y				      <
CONFIG_PACKAGE_kmod-usb-ehci=y				      <
CONFIG_PACKAGE_kmod-usb2=y				      <
CONFIG_PACKAGE_libblkid=y				      <
CONFIG_PACKAGE_libcomerr=y				      <
CONFIG_PACKAGE_libevent2=y				      <
CONFIG_PACKAGE_libext2fs=y				      <
CONFIG_PACKAGE_liblzo=y					      <
CONFIG_PACKAGE_libminiupnpc=y				      <
CONFIG_PACKAGE_libnatpmp=y				      <
CONFIG_PACKAGE_libnfnetlink=y				      <
CONFIG_PACKAGE_libopenssl=y				      <
CONFIG_PACKAGE_libopenssl-conf=y			      <
CONFIG_PACKAGE_libpcap=y				      <
CONFIG_PACKAGE_libss=y					      <
CONFIG_PACKAGE_libusb-1.0=y				      <
CONFIG_PACKAGE_luci-lib-json=y				      <
CONFIG_PACKAGE_luci-mod-rpc=y				      <
# CONFIG_PACKAGE_odhcpd-ipv6only is not set		      <
CONFIG_PACKAGE_openssl-util=y				      <
CONFIG_PACKAGE_openvpn-easy-rsa=y			      <
CONFIG_PACKAGE_openvpn-openssl=y			      <
CONFIG_PACKAGE_swap-utils=y				      <
CONFIG_PACKAGE_tcpdump=y				      <
CONFIG_PACKAGE_usbutils=y				      <
# CONFIG_PKG_CHECK_FORMAT_SECURITY is not set		      <
# CONFIG_TARGET_ROOTFS_INITRAMFS is not set		      <
							      >
							      >	CONFIG_PACKAGE_e2fsprogs=y
							      >	CONFIG_PACKAGE_kmod-fs-ext4=y	
							      >	CONFIG_PACKAGE_kmod-fs-vfat=y
							      >

Why are you compiling all the packages yourself, instead.of using the (much easier) image builder?

Default packages and settings will get selected automatically, so do not worry about them.
Select only stuff that you need and want, and let those packages pull their dependencies. Set only those config options that you actively know that you want to modify.

For example, this is my own R7800 recipe from my R7800 community build.
(when put to .config, it can be expanded with "make defconfig" to a full .config)

# Use "make defconfig" to expand this to a full .config
CONFIG_TARGET_ipq806x=y
CONFIG_TARGET_ipq806x_generic=y
CONFIG_TARGET_ipq806x_generic_DEVICE_netgear_r7800=y

# Per-package build logs in <buildroot>/logs
CONFIG_DEVEL=y
CONFIG_BUILD_LOG=y

# Debugging options (build gdbserver, include package debug)
CONFIG_PACKAGE_gdbserver=m
CONFIG_DEBUG=y

# Include package list in build
CONFIG_INCLUDE_CONFIG=y

# exfat is patented
CONFIG_BUILD_PATENTED=y

# Longer waiting for failsafe button push
CONFIG_IMAGEOPT=y
CONFIG_PREINITOPT=y
CONFIG_TARGET_PREINIT_TIMEOUT=5

# Busybox tweaks
CONFIG_BUSYBOX_CUSTOM=y
#CONFIG_BUSYBOX_CONFIG_DIFF=y
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_FLAGS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_REGEXP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_WINCH=y

## # Mainline ath10k wifi firmware and driver instead of -ct
## CONFIG_PACKAGE_ath10k-firmware-qca9984=y
## # CONFIG_PACKAGE_ath10k-firmware-qca9984-ct is not set
## CONFIG_PACKAGE_kmod-ath10k=y
## # CONFIG_PACKAGE_kmod-ath10k-ct is not set

# Add-on programs
CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_nano=y
CONFIG_PACKAGE_ccrypt=y
CONFIG_PACKAGE_curl=y
CONFIG_LIBCURL_OPENSSL=y
#CONFIG_PACKAGE_vsftpd-tls=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_patch=y
CONFIG_PACKAGE_diffutils=y
CONFIG_PACKAGE_tree=y
CONFIG_PACKAGE_irqbalance=y
CONFIG_DROPBEAR_ECC=y

# USB device mount & file systems support
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_kmod-usb-storage=y
CONFIG_PACKAGE_kmod-fs-cifs=y
CONFIG_PACKAGE_kmod-fs-exfat=y
CONFIG_PACKAGE_libblkid=y
CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-fs-hfsplus=y
CONFIG_PACKAGE_kmod-fs-msdos=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_ntfs-3g=y
CONFIG_PACKAGE_kmod-nls-cp1250=y
CONFIG_PACKAGE_kmod-nls-cp437=y
CONFIG_PACKAGE_kmod-nls-cp850=y
CONFIG_PACKAGE_kmod-nls-iso8859-1=y
CONFIG_PACKAGE_kmod-nls-iso8859-15=y
CONFIG_PACKAGE_kmod-nls-utf8=y

# IPv6 support
CONFIG_PACKAGE_6in4=y
CONFIG_PACKAGE_6to4=y
CONFIG_PACKAGE_6rd=y

# IPv6 NAT support (ip6tables NAT extensions, ipt-nat6 and nf-nat6 kmods)
CONFIG_PACKAGE_ip6tables-mod-nat=y

# WLAN/WPS support
CONFIG_PACKAGE_hostapd-utils=y
#CONFIG_WPA_MSG_MIN_PRIORITY=2
CONFIG_WPA_MSG_MIN_PRIORITY=4
CONFIG_PACKAGE_wpad-openssl=y
# CONFIG_PACKAGE_wpad-basic is not set

# SSL certificates
CONFIG_PACKAGE_ca-certificates=y

# Luci (SSL from OpenSSL)
CONFIG_PACKAGE_luci-ssl-openssl=y
CONFIG_PACKAGE_luci-app-commands=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-sqm=y
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-wol=y

# Luci statistics
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_collectd-mod-conntrack=y
CONFIG_PACKAGE_collectd-mod-cpufreq=y
CONFIG_PACKAGE_collectd-mod-entropy=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-sqm=y
CONFIG_PACKAGE_collectd-mod-thermal=y
CONFIG_PACKAGE_collectd-mod-uptime=y

# Build material and openwrt-2020 themes, default is still bootstrap
CONFIG_PACKAGE_luci-theme-material=y
CONFIG_PACKAGE_luci-theme-openwrt-2020=y

# kernel support for tunnels, VPNs
CONFIG_PACKAGE_kmod-tun=y

# wireguard
CONFIG_PACKAGE_luci-app-wireguard=y

# PPTP support
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_ppp-mod-pptp=y

# iptables add-on ipsec
CONFIG_PACKAGE_iptables-mod-ipsec=y

# Support for IETF BCP38
CONFIG_PACKAGE_luci-app-bcp38=y

# Adblock package with Luci support, initially disabled
CONFIG_PACKAGE_luci-app-adblock=y

# BanIP package with Luci support, initially disabled
CONFIG_PACKAGE_luci-app-banip=y

# nlbwmon app
CONFIG_PACKAGE_luci-app-nlbwmon=y

# chaoskey TRNG USB dongle
CONFIG_PACKAGE_kmod-chaoskey=y

It takes some time to look at the dependencies (with menuconfig or by looking at tmp/.packagedeps) , but I think that you can still prune your list somewhat.
For example, I only select luci-app-wireguard, and it then selects the dependencies like kmod-wireguard and wireguard-tools.

Ps. you did not want the LuCI GUI, right? (As the actual LuCI is missing from your list)

@eduperez Any nonstandard feature in the kernel will make it impossible to include the pre-built packages. I started with full builds just to learn a little, then stayed on it because I needed to spare RAM and flash space on my smaller (AP) devices.

@hnyman what I posted is just the output of diff -y --suppress-common-lines curDiff newDiff as suggested by @anomeome in Post #4. That is, the differences between: a) changes made from the lantiq xway defaults to the custom lantiq xway config I'm trying to replicate and b) changes made from the default ipq806 config to the custom ipq806 config that tries to replicate it. LuCI is in both, so it doesn't appear in the diffs I posted.

On the other hand, I didn't know exfat is patented. Actually, it wasn't included in my lantiq xway config, even if I do use a FAT32 stick plugged in it. I learned this by looking at your config.seed, thanks :slight_smile:

(That is currently a leftover, as exfat sources arte now in kernel 5.4 main sources, and is no more patented.)

1 Like

I have migrated config between several routers by using meld just fine. There are things to pay attention to, like switch config, how wifi radios are numbered (which one is radio0 and which one is radio1), and is wan eth0 or eth1. Everything else is transferred as is. I find the ability to migrate the config a great differentiator from The off-the-shelf consumer routers that must be rebuilt each time.

1 Like

@fantom-x I've never used meld, but I'm willing to give it a spin. It seems like you're referring to replicating the settings once the image is build with the necessary packages - Point 2 in the first post. Are you using it file by file on the .tar.gz backup contents of the two routers?

It is a Linux based diff and merge program. You can use WinDiff or anything else that allows for a side by side file comparison. The process I follow is boot a new router and download the default config and the config from the old router. Then I would untar the files and compare the files under /etc/config only. This way I can merge all configuration block by block after a review. Once all looks good, I scp config files to the new router and reboot. Something there are minor issues to resolve after, but if the files and from the same release then there is usually no issue.

1 Like

Just pay attention to radio0/1, eth0/1, and the switch configuration. The rest is transferable as is. There are one or two files (ucitrack or something) that are auto generated and should be left unchanged. So if it does not look look like something that you changed, then keep it as is.

I have a build conflict between odhcpd and odhcpd-ipv6only. My ISP only offers IPv4, and I mostly use IPv4 in the local LAN as well: many clients are automatically set up with IPv6, but my router's DHCP server (dnsmasq as far as I can tell) only dispenses IPv4 addresses. What's the best course of action?

Answer to my own question: Best not to include odhcpd at all. It isn't needed in normal setups, since by default dnsmasq takes care of ipv4 dhcp service.

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