Resizing kernel images for Edgerouter X

Hi:
thanks again for your work. I hope they can fix kernel 6.6 issues all together with your patches. it took so long...

1 Like
make[3]: *** No rule to make target '/home/bruno/Documentos/openwrt-imagebuilder-ramips-mt7621.Linux-x86_64/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/ubnt_edgerouter-x-kernel.bin', needed by '/home/bruno/Documentos/openwrt-imagebuilder-ramips-mt7621.Linux-x86_64/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-ubnt_edgerouter-x-squashfs-sysupgrade.bin'.  Stop.
make[2]: *** [Makefile:247: build_image] Error 2
make[1]: *** [Makefile:153: _call_image] Error 2
make: *** [Makefile:310: image] Erro 2

I tried, it gave me this error that I have no idea how to resolve, I don't know what it is.

https://openwrt.org/docs/guide-user/additional-software/imagebuilder

make image \
PROFILE=ubnt_edgerouter-x \
PACKAGES=luci luci-app-adblock luci-app-banip luci-app-upnp luci-app-bcp38 \
DISABLED_SERVICES=firewall

currently edgerouter x is excluded. you can not use imagebuilder.
and there are other issues.

1 Like

You need to build from source, after applying the PR.
https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem

atleast this is affecting builds for now:

1 Like

Do you have the link to the 6.6 kernel image that failed on eth1?

I wanted to install it here to test and see if I have the same error.

I'm a bit confused about the status of the ER-X currently. Two days ago, the commit to resize the kernel partition was merged to MASTER and builds have been re-enabled.

However, it wasn't backported to the 24.10 branch... So we now have SNAPSHOT images from MASTER, but no 24.10-SNAPSHOT images.

It's confusing, because the wiki describes the upgrade process for 24.10 based images which thus don't exist while the linked migration scripts actually flash a MASTER based SNAPSHOT...

So the resize-commit should be backported to 24.10, and the scripts should reference that 24.10-SNAPSHOT image (or soon, a RC image) to get some testing done on the device. Correct?

I will update the scripts once there are 24.10 images actually available. However once migration is complete, and new partition layout in place, you should be able to sysupgrade between master and 24.10 snapsots, without any issues.

24.10 snapshots for Edgerouter X are now built. I suppose RC images will land in the next few days.
https://downloads.openwrt.org/releases/24.10-SNAPSHOT/targets/ramips/mt7621/

My migration scripts are now updated to install the latest 24.10 snapshot.

2 Likes

Having an EdgeRouter-X, this is why I love OpenWRT.

Thanks guys for all the work you put in.

1 Like

Have updated scripts to migrate to the 24.10.0-rc2 release

1 Like

I still think you should have been allowed to make the whole process automatic :innocent:

Awesome work! Really appreciate it.

Yeh, there were objections to modifying sysupgrade code in 23.05.

However hopefully, they will accept my PR to pre-install migration scripts in the next 23.05.x stable release

1 Like

Ooh! Great idea. Makes everyone happy. I can see the other side of the coin too, not wanting to modify upgrade scripts that are part of the previous version, this should solve things for everyone. Great work.

Hi:
I tried to follow the steps at https://github.com/darkxst/erx-migration but can not make it work.

  1. install 22.03 firmware via https://github.com/stman/OpenWRT-19.07.2-factory-tar-file-for-Ubiquiti-EdgeRouter-x

  2. copy both scripts to /tmp and run it. at first the script failed to download anything, then I found I need to add "--no-check-certificate" to wget command or the certificate check failed.

  3. run the script and er-x get bricked. the command result like below:

root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# ls -la
drwxrwxrwt 12 root root 340 Dec 13 09:20 .
drwxrwxrwt 16 root root 360 Jan 1 1970 ..
drwx------ 2 root root 80 Nov 13 2022 .uci
-rw-r--r-- 1 root root 4 Nov 13 2022 TZ
-rw-r--r-- 1 root root 419 Jan 1 1970 board.json
drwx------ 2 root root 60 Dec 13 09:20 dropbear-18b2c15e
drwxrwxrwt 2 root root 240 Nov 13 2022 lock
drwxr-xr-x 2 root root 80 Nov 13 2022 log
lrwxrwxrwx 1 root root 35 Nov 13 2022 resolv.conf -> /tmp/resolv.conf.d/resolv.conf.auto
drwxr-xr-x 2 root root 60 Nov 13 2022 resolv.conf.d
drwxr-xr-x 3 root root 120 Nov 13 2022 run
drwxrwxrwt 2 root root 40 Jan 1 1970 shm
drwxr-xr-x 2 root root 60 Nov 13 2022 state
drwxr-xr-x 2 root root 80 Jan 1 1970 sysinfo
drwxr-xr-x 2 root root 40 Nov 13 2022 tmp
-rwxr-x--- 1 root root 2685 Dec 13 09:19 ubnt_erx_migrate.sh
-rwxr-x--- 1 root root 2168 Dec 13 09:19 ubnt_erx_stage2.sh
root@OpenWrt:/tmp# ./ubnt_erx_migrate.sh
WARNING: This script will migrate your OpenWrt system to a new layout as
required for the linux 6.6 kernel. This process will erase all your current settings.
It is recommended to back up your system before proceeding.

Do you want to proceed with the migration? (y/n)y
Downloading https://downloads.openwrt.org/releases/24.10.0-rc2/targets/ramips/mt7621//openwrt-24.10.0-rc2-ramips-mt7621-ubnt_edgerouter-x-squashfs-sysupgrade.bin
Fri Dec 13 09:20:29 UTC 2024 upgrade: Commencing upgrade. Closing all shell sessions and rebooting.
Command failed: Connection failed
root@OpenWrt:/tmp# Connection to 192.168.1.1 closed by remote host.
Connection to 192.168.1.1 closed.

SSH shell is lost when sysupgrade pivots into ram disk for flashing. But its flashing in the background, device should reboot in a couple of minutes and come up on the original default IPs.

It should not have bricked, it will only proceed to flash is the sha256 sums match, so wont flash a corrupted image. Not sure why you are getting a certificate error, I've not seen that in my testing.

Hi:
I recover the bricked device and try again but still get the same result. I will try to find a cable and attach the serial console to see what happened.

the certificate error maybe caused by different country/location.

If you can get logs via serial console from stage2 that would be good.

I'm not @tbsky, but I've also tried the migration and wasn't successful at it. I was able to unbrick with TFTP recovery then install 23.05 as usual, so I don't think there's a hardware failure.

I tried again the second time, this time using a serial console.[1] Here's the output right after executing ./ubnt_erx_migrate.sh:

Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
Sun Nov 13 17:16:19 UTC 2022 upgrade: Sending TERM to remaining processes ...
Sun Nov 13 17:16:23 UTC 2022 upgrade: Sending KILL to remaining processes ...
Sun Nov 13 17:16:29 UTC 2022 upgrade: Switching to ramdisk...
Sun Nov 13 17:16:31 UTC 2022 upgrade: Flashing kernel...
1+0 records in
1+0 records out
Unlocking kernel1 ...

Writing from <stdin> to kernel1 ...
34+1 records in
34+1 records out
Unlocking kernel2 ...

Writing from <stdin> to kernel2 ...
Sun Nov 13 17:16:33 UTC 2022 upgrade: Flashing rootfs...
ubimkvol: error!: UBI device does not have free logical eraseblocks
cannot create rootfs volume
Sun Nov 13 17:16:34 UTC 2022 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy

===================================================================
                MT7621   stage1 code 10:33:11 (ASIC)
                CPU=50000000 HZ BUS=16666666 HZ
==================================================================

(rest of stage 1 log omitted for brevity)

OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 6.6.63 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r28161-ea17e958b9) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 SMP Tue Dec  3 11:41:08 2024
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Ubiquiti EdgeRouter X
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] percpu: Embedded 12 pages/cpu s19136 r8192 d21824 u49152
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Writing ErrCtl register=00005370
[    0.000000] Readback ErrCtl register=00005370
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 247820K/262144K available (8362K kernel code, 654K rwdata, 1016K rodata, 1284K init, 229K bss, 14324K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000004] sched_clock: 64 bits at 880MHz, resolution 1ns, wraps every 4398046511103ns
[    0.016054] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.088326] pid_max: default: 32768 minimum: 301
[    0.106347] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.120768] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.145063] RCU Tasks Trace: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=4.
[    0.163980] rcu: Hierarchical SRCU implementation.
[    0.173400] rcu:     Max phase no-delay instances is 1000.
[    0.184590] smp: Bringing up secondary CPUs ...
[    0.194497] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.194528] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.194543] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.194592] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.254064] Synchronize counters for CPU 1: done.
[    0.316368] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.316389] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.316401] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.316433] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.375344] Synchronize counters for CPU 2: done.
[    0.435788] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.435811] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.435824] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.435858] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.494937] Synchronize counters for CPU 3: done.
[    0.554543] smp: Brought up 1 node, 4 CPUs
[    0.569411] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.588917] futex hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.606499] pinctrl core: initialized pinctrl subsystem
[    0.620106] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.632602] thermal_sys: Registered thermal governor 'step_wise'
[    0.659952] clocksource: Switched to clocksource GIC
[    0.679650] NET: Registered PF_INET protocol family
[    0.689507] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.705523] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.722056] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.737428] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.752636] TCP bind hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.766941] TCP: Hash tables configured (established 2048 bind 2048)
[    0.780523] MPTCP token hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.795120] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.808009] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.822805] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.834000] PCI: CLS 0 bytes, default 32
[    0.845455] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.859353] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.870842] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.896298] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.914584] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.926123] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.937627] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.949709] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.972115] printk: console [ttyS0] disabled
[    0.981330] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 18, base_baud = 3125000) is a 16550A
[    0.999324] printk: console [ttyS0] enabled
[    0.999324] printk: console [ttyS0] enabled
[    1.015853] printk: bootconsole [early0] disabled
[    1.015853] printk: bootconsole [early0] disabled
[    1.038174] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xda
[    1.050893] nand: Macronix MX30LF2G18AC
[    1.058517] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.073599] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[    1.087010] 5 fixed-partitions partitions found on MTD device mt7621-nand
[    1.100564] Creating 5 MTD partitions on "mt7621-nand":
[    1.110997] 0x000000000000-0x000000080000 : "u-boot"
[    1.126199] 0x000000080000-0x0000000e0000 : "u-boot-env"
[    1.140824] 0x0000000e0000-0x000000140000 : "factory"
[    1.155301] 0x000000140000-0x000000740000 : "kernel"
[    1.209576] 0x000000740000-0x00000ff00000 : "ubi"
[    3.143747] mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module
[    3.164814] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 19
[    3.184511] mtk_soc_eth 1e100000.ethernet eth1: mediatek frame engine at 0xbe100000, irq 19
[    3.202808] i2c_dev: i2c /dev entries driver
[    3.215407] NET: Registered PF_INET6 protocol family
[    3.228428] Segment Routing with IPv6
[    3.235858] In-situ OAM (IOAM) with IPv6
[    3.243813] NET: Registered PF_PACKET protocol family
[    3.254043] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    3.280640] 8021q: 802.1Q VLAN Support v1.8
[    3.319603] mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module
[    3.360623] mt7530-mdio mdio-bus:1f: configuring for fixed/rgmii link mode
[    3.376084] mt7530-mdio mdio-bus:1f (unnamed net_device) (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7530 PHY] (irq=21)
[    3.401237] mt7530-mdio mdio-bus:1f: Link is Up - 1Gbps/Full - flow control rx/tx
[    3.402824] mt7530-mdio mdio-bus:1f (unnamed net_device) (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7530 PHY] (irq=22)
[    3.442446] mt7530-mdio mdio-bus:1f (unnamed net_device) (uninitialized): PHY [mt7530-0:03] driver [MediaTek MT7530 PHY] (irq=23)
[    3.468566] mt7530-mdio mdio-bus:1f (unnamed net_device) (uninitialized): PHY [mt7530-0:04] driver [MediaTek MT7530 PHY] (irq=24)
[    3.494076] mtk_soc_eth 1e100000.ethernet eth0: entered promiscuous mode
[    3.507615] DSA: tree 0 setup
[    3.515560] UBI: auto-attach mtd4
[    3.522281] ubi0: attaching mtd4
[    7.103673] ubi0: scanning is finished
[    7.126432] ubi0: attached mtd4 (name "ubi", size 247 MiB)
[    7.137453] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    7.151159] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    7.164681] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    7.178585] ubi0: good PEBs: 1981, bad PEBs: 1, corrupted PEBs: 0
[    7.190734] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    7.205124] ubi0: max/mean erase counter: 7/3, WL threshold: 4096, image sequence number: 432810793
[    7.223148] ubi0: available PEBs: 0, total reserved PEBs: 1981, PEBs reserved for bad PEB handling: 39
[    7.241748] ubi0: background thread "ubi_bgt0d" started, PID 418
[    7.242148] clk: Disabling unused clocks
[    7.262270] MTD: Couldn't look up '': -22
[    7.271133] /dev/root: Can't open blockdev
[    7.279324] VFS: Cannot open root device "" or unknown-block(0,0): error -6
[    7.293212] Please append a correct "root=" boot option; here are the available partitions:
[    7.309860] 1f00             512 mtdblock0
[    7.309874]  (driver?)
[    7.322900] 1f01             384 mtdblock1
[    7.322912]  (driver?)
[    7.335916] 1f02             384 mtdblock2
[    7.335928]  (driver?)
[    7.348931] 1f03            6144 mtdblock3
[    7.348942]  (driver?)
[    7.361976] 1f04          253696 mtdblock4
[    7.361988]  (driver?)
[    7.374995] List of all bdev filesystems:
[    7.382983]  squashfs
[    7.382991]
[    7.390461] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    7.406912] Rebooting in 1 seconds..

The device then repeatedly boot loops, with the kernel always crashing when attempting to mount the root filesystem. It appears that the script didn't write to kernel2, for whatever reason. Maybe @tbsky is experiencing the same problem.


  1. which runs at 57600 baud instead of the usual 115200 for some reason ↩ī¸Ž