Can't upgrade FW on gl.inet mt3000

I'm using image builder to build my own images.
I was able to upgrade the default gl.inet to openwrt no problem with my image.
Now I wanted to update that image but nothing works.

I've tried sysupgrade and mtd but nothing works.

I tried 'sysupgrade myimage.bin but it boots me out and comes back with the previous image.

It seems this device is using UBI so I tried but this doesn't work.
sysupgrade -v -n -F -p /tmp/myimage.bin

I also tried mtd -r write myfile.bin firmware

Could not open mtd device: firmware
Can't open device for writing!

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "BL2"
mtd1: 00080000 00020000 "u-boot-env"
mtd2: 00200000 00020000 "Factory"
mtd3: 00200000 00020000 "FIP"
mtd4: 00040000 00020000 "log"
mtd5: 0f640000 00020000 "ubi"

# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:127
Present UBI devices:            ubi0

ubi0
Volumes count:                           3
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1970 (250142720 bytes, 238.5 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  40
Current maximum erase counter value:     7
Minimum input/output unit size:          2048 bytes
Character device major/minor:            249:0
Present volumes:                         0, 1, 2

Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        30 LEBs (3809280 bytes, 3.6 MiB)
State:       OK
Name:        kernel
Character device major/minor: 249:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        129 LEBs (16379904 bytes, 15.6 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 249:2
-----------------------------------
Volume ID:   2 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        1765 LEBs (224112640 bytes, 213.7 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 249:3

I'd like to do it from the command line as usual.

Usually I just upload the image to the router then ssh into it and use sysupgrade.
Am I missing a package or doing this the wrong way?

Try using the standard OpenWrt sysupgrade image (not customized) first... when I upgraded mine, I did it directly from the GL-Inet firmware's GUI upgrade page using the sysupgrade image (and I did not keep settings):

https://firmware-selector.openwrt.org/?version=23.05.4&target=mediatek%2Ffilogic&id=glinet_gl-mt3000

It worked immediately and flawlessly.

1 Like

Yes, my image worked fine when I did it from the gl.inet GUI but that's gone now. My images never use anything GUI.

Oh... sorry, I misunderstood.

So what image are you using and how are you generating it? It should be a sysupgrade image -- the image builder should always produce a sysupgrade image.

Right, I'm using image builder. I made an image and flashed the device using the gl.inet GUI. My images don't have GUI though as I don't need any GUI stuff.

Today, I updated my image using image builder, used scp to put it on the device then logged into it using ssh. But, I am not able to upgrade it using sysupgrade or mtd.

Ok... what was the exact complete filename of the the file that you scp'd to the device?

2024-09-16.bin

And now, I seem to recall I had a problem with .bin once. It had to be compressed to .gz or something?

That doesn't seem right at all...

What are you using to generate the files? What is custom about your image? Can you share the recipe (added/removed packages)?

1 Like

Sounds ok, sysupgrade does automatic detection of compression, as you can see here:

$ cd /tmp
$ owut download
...
Downloaded https://sysupgrade.openwrt.org/store/.../openwrt-78a4d320d982-x86-64-generic-squashfs-combined-efi.img.gz to /tmp/firmware.bin (26617174B at 50.768 Mbps)
...

$ sysupgrade --test firmware.bin
Mon Sep 16 16:34:47 PDT 2024 upgrade: Image metadata not present
Mon Sep 16 16:34:47 PDT 2024 upgrade: Reading partition table from bootdisk...
Mon Sep 16 16:34:47 PDT 2024 upgrade: Extract boot sector from the image
Mon Sep 16 16:34:47 PDT 2024 upgrade: Reading partition table from image...

$ mv firmware.bin firmware.bin.gz
$ gunzip firmware.bin.gz
$ sysupgrade --test firmware.bin
Mon Sep 16 16:35:09 PDT 2024 upgrade: Image metadata not present
Mon Sep 16 16:35:09 PDT 2024 upgrade: Reading partition table from bootdisk...
Mon Sep 16 16:35:09 PDT 2024 upgrade: Extract boot sector from the image
Mon Sep 16 16:35:09 PDT 2024 upgrade: Reading partition table from image...

sysupgrade does want the image in /tmp and will copy it over, if it's not already there. The --test option should always give output, so that's a preliminary diagnostic that you can apply.

1 Like

I'll find the files list but it's remote to me so will take a bit.

-rw-r--r-- 1 root root 20061034 Sep 17 01:31 2024-09-16.bin

$ sysupgrade --test 2024-09-16.bin
verifying sysupgrade tar file integrity

It would be almost the same as the original I flashed the device with from gl.inet to openwrt but from the GUI initially.

The only changes I make are usually just adding some files to bake them into the image using the files/ option.

How did you generate the image? What was the filename that came out of the image creation process?

1 Like

I'm not sure what you mean how did I build it? As mentioned, using image builder. the file is simply copied to a shorter name from;

$ ls -la bin/targets/mediatek/filogic/
total 19608
drwxr-xr-x 2 root root      192 Sep 14 13:31 .
drwxr-xr-x 3 root root       21 Sep 14 13:29 ..
-rw-r--r-- 1 root root     6012 Sep 14 13:31 openwrt-23.05.3-mediatek-filogic-glinet_gl-mt3000.manifest
-rw-r--r-- 1 root root 20061034 Sep 14 13:31 openwrt-23.05.3-mediatek-filogic-glinet_gl-mt3000-squashfs-sysupgrade.bin
-rw-r--r-- 1 root root     1264 Sep 14 13:31 profiles.json
-rw-r--r-- 1 root root      345 Sep 14 13:31 sha256sums

Did you do this with the openwrt image builder downloaded onto your computer, or the online version that is part of the firmware selector?

Can you share with us the specific recipe or details so we can replicate the process?

This file looks right in terms of the filename and such. Did you verify that this was the file that got copied over?

1 Like

Yes, image builder on Centos or Rocky, can't recall which, not the online method.
I believe it was this recipe.

make image PROFILE="glinet_gl-mt3000" PACKAGES="
bash bc busybox -ca-certificates chrony coreutils-base64 coreutils-date coreutils-timeout curl -dnsmasq -firewall -firewall4 \
iptables-nft -iw -iw-full kmod-cfg80211 kmod-ipt-nat kmod-ipt-nat-extra -kmod-ipv6 kmod-leds-gpio \
-kmod-ledtrig-timer -kmod-ledtrig-usbdev kmod-mac80211 -kmod-ppp -kmod-pppoe kmod-usb2 -kmod-usb-core -kmod-usb-hid \
-kmod-usb-ohci kmod-usb-serial kmod-usb-serial-ftdi kmod-usb-uhci -libiwinfo \
-libiwinfo-lua libwolfssl libpthread libstdcpp libustream-wolfssl -libustream-openssl -luci-app-firewall -luci-base \
-luci-mod-admin-full -luci-proto-ipv6 -luci-theme-bootstrap  -odhcp6c -odhcpd openssl-util -ppp \
-ppp-mod-pppoe -uboot-envtools -uhttpd -usbreset usbutils vnstat wget -wireless-regdb -wireless-tools \
-wpad-basic wpad-mini -wpa-supplicant -wpad-basic-wolfssl -libustream-mbedtls -wpad-basic-mbedtls"

There may be some packages mixed in from other builds. Basically, I ended up with this because I was wanting to remove some things while adding some others but god knows what they were at this point.

Pretty sure, sysupgrade depends on that.

2 Likes

Are you able to flash anything right now? Can you successfully flash the standard release build?

1 Like

I can try but I'm guessing it still won't work. My image is not all that unique, other than also having dhcp client for the interfaces instead of the 192.168.1.1 IP.

I'll use this;
https://firmware-selector.openwrt.org/?version=23.05.4&target=mediatek%2Ffilogic&id=glinet_gl-mt3000

So here is what happened. I didn't use -n.
Interestingly, it obviously did get flashed but has no open ports now which means I'll have to use recovery mode.

$ ssh 192.168.192.7
root@192.168.192.7's password: 

BusyBox v1.36.1 (2024-09-11 15:47:11 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 23.05.3, r23809-234f1a2efa
 -----------------------------------------------------
root@mt3000:~# cd /tmp
root@mt3000:/tmp# sysupgrade openwrt-23.05.4-mediatek-filogic-glinet_gl-mt3000-squashfs-sysupgrade.bin 
verifying sysupgrade tar file integrity
Tue Sep 17 17:39:37 UTC 2024 upgrade: Saving config files...
Tue Sep 17 17:39:37 UTC 2024 upgrade: Commencing upgrade. Closing all shell sessions.
Command failed: Connection failed
root@mt3000:/tmp# Connection to 192.168.192.7 closed by remote host.
Connection to 192.168.192.7 closed.
[root@dev50 23.05.3-mt3000]# ssh 192.168.192.7
ssh: connect to host 192.168.192.7 port 22: Connection refused
[root@dev50 23.05.3-mt3000]# nmap 192.168.192.7
Starting Nmap 7.95SVN ( https://nmap.org ) at 2024-09-17 10:40 MST
ipToPtr: 192.168.192.7 => 7.192.168.192.in-addr.arpa
Nmap scan report for 192.168.192.7
Host is up (0.00045s latency).
All 1000 scanned ports on 192.168.192.7 are in ignored states.
Not shown: 1000 closed tcp ports (reset)
MAC Address: 90:83:C4:4A:E9:DB (GL Technologies (Hong Kong) Limited)

Nmap done: 1 IP address (1 host up) scanned in 39.31 seconds
[root@dev50 23.05.3-mt3000]# nmap 192.168.192.7
Starting Nmap 7.95SVN ( https://nmap.org ) at 2024-09-17 10:44 MST
ipToPtr: 192.168.192.7 => 7.192.168.192.in-addr.arpa
Nmap scan report for 192.168.192.7
Host is up (0.00045s latency).
All 1000 scanned ports on 192.168.192.7 are in ignored states.
Not shown: 1000 closed tcp ports (reset)
MAC Address: 94:83:C4:4A:E9:DB (GL Technologies (Hong Kong) Limited)

Nmap done: 1 IP address (1 host up) scanned in 39.05 seconds

Please try... my thinking is this:

If your currently installed image drops the ubut-envtools package, and if it is required to run sysupgrade, then you've basically backed yourself into a corner with no upgrade option within the context of the OpenWrt system. You'd have to resort to a lower level method like tftp or whatever the device has available for recovery (I haven't looked to see what the method is, though).

So does this mean that the image flashed?

If you didn't use -n, that means that your previous configuration is still there. So, from failsafe mode, just run firstboot -y && reboot.

I think it did flash because while my IP settings were saved, ssh is no longer open. There are no open ports so I can't ssh into it to run any commands.

My only option at this point would be to try recovery mode.

Use failsafe mode and then reset to defaults.

https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset