Resizing kernel images for Edgerouter X

How I understand it, is that /etc/config/system only contains a line for option compat_version if it's 1.1 or higher. If your device is 1.0 that line isn't there.

So I had an old backup from before the target went to 1.1 (the switch to DSA) that I partially restored, which removed option compat_version '1.1'.

Upgraded here, no issues. Smooth like butter. Much thanks!

Hi all.
I've downloaded both scripts, and make chmod+x both.
But when I try to execute te first step, I get an error:

root@Router:/tmp# ./ubnt_erx_migrate.sh
./ubnt_erx_migrate.sh: line 8: syntax error: unexpected newline

What I 've missed??

Now I've installed OpenWrt 23.05.5 r24106-10cc5fcd00 / LuCI openwrt-23.05 branch git-25.024.63972-9fa69d5

Ok I fugured it up.
You can't just download the files. Best option is git clone the files, and then execute the first file.
Everything is working fine.
My ER-X have 24.10.rc2

I can't upgrade from 24.10.rc2 to rc7 I get:

Fri Jan 31 17:29:21 CET 2025 upgrade: The device is supported, but this image is incompatible for sysupgrade based on the image version (1.1->2.0).
Fri Jan 31 17:29:21 CET 2025 upgrade: Partition table has been changed due to kernel size restrictions. Refer to the wiki page for instructions to migrate to the new layout: https://openwrt.org/toh/ubiquiti/edgerouter_x_er-x_ka
Image check failed.

Ok.
In another topic @Ramon told me

if you restored some files then you have to manually set the image version to 2.0

So I changed in /etc/config/system the compat version to 2.0, and now sysupgrade run without error.

1 Like

note only manually change the version if you have already done the resize in a previous upgrade and restored the system config file

1 Like

You can download manually, however make you select that "raw" download in github UI otherwise you are downloading some html page.

1 Like

Everything works fine.

root@Router:~# ubus call system board
{
        "kernel": "6.6.73",
        "hostname": "Router",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "Ubiquiti EdgeRouter X",
        "board_name": "ubnt,edgerouter-x",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "24.10.0-rc7",
                "revision": "r28417-daef29c75d",
                "target": "ramips/mt7621",
                "description": "OpenWrt 24.10.0-rc7 r28417-daef29c75d",
                "builddate": "1738018409"
        }
}

By the way, you can change your script to pull down the rc7 version.
Many thx for your job.

Its updated for rc7 now. Will also change over to stable releases once 24.10 is released in next week or so,

1 Like

bumped script to pull 24.10.0 images

4 Likes

do you want the wiki updated, as since 24.10 is released this needs moving up the page with a warning.

1 Like

First of all: Thank you very much for all the effort. Very happy with the result.

So I used the migration script, and all seems to have gone well, however there were some things unclear:

  1. Out of precaution I rebooted the ERX, just in case. That might be good advice for others.
  2. I executed this to get scripts to ERX, maybe its useful to decrease migration steps.
urls='
https://raw.githubusercontent.com/darkxst/erx-migration/refs/heads/main/ubnt_erx_migrate.sh
https://raw.githubusercontent.com/darkxst/erx-migration/refs/heads/main/ubnt_erx_stage2.sh
'
cd /tmp
for url in $urls;do
wget "$url" -O "/tmp/${url##*/}"
chmod +x "/tmp/${url##*/}"
done
  1. Did I have to chmod +x ubnt_erx_stage2.sh too ?
  2. Check that the comat version is set to 2: uci get system.@system[0].compat_version
    Apart from the typo ^ I was unsure if 2 meant 2.0. So did a cat /proc/mtd to see if it had worked.
# uci get system.@system[0].compat_version
2.0
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "u-boot"
mtd1: 00060000 00020000 "u-boot-env"
mtd2: 00060000 00020000 "factory"
mtd3: 00600000 00020000 "kernel"
mtd4: 0f7c0000 00020000 "ubi"
#
  1. A restore from backup set it back to 1.1, and I followed the rest of https://github.com/darkxst/erx-migration. Assuming this was the reason to check and modify compat ?
# uci get system.@system[0].compat_version
1.1
# uci set system.@system[0].compat_version=2.0
# uci commit
# uci get system.@system[0].compat_version
2.0
  1. I made another backup after this, and deleted old backup as compat was not set in it.

That's it.