OpenWrt Forum Archive

Topic: ubiquiti EdgeRouter X (ER-X)

The content of this topic has been archived on 29 Mar 2018. Unfortunately there are posts – most likely complete pages – missing.

I've been testing the trunk version on the SFP version of the router and the main thing that's missing is the ability to enable the poe on the ports. Has anyone worked out how to enable this? I've tried all the GPIO info in the wiki but nothing so far.

rstanford wrote:

Does anyone know if an updated version of this has been released.?

I have just purchased one and am getting garbage over the serial port. I'm assuming it's a baud problem and have tried all rates from 9600 to 230400. I have had success with a Edgerouter lite so I know my serial hardware is ok.

The board on mine also look different from the photo on the page.

I agree, just opened up a new one I got last week and it is similar to yours with a single screw on each side.
https://lh3.googleusercontent.com/zxVs0 … 83-h962-no

HI, I am trying to setup OpenWrt on Edgerouter X but need some help.

I am following the instructions at the TOH wiki page (sorry, I am not allowed links). I got the serial console to work, but something must have changed in the build system. In menuconfig after choosing

Target system: Ralink RT288x/RT3xxx
Subtarget: MT7621 based boards

there is no way to choose

Target profile: Ubiquiti EdgeRouter X

In fact there are no profiles to choose from other than "default profile". Digging through git history I found that they they were all deleted in this commit (again, can't link...):

"ramips: convert a bunch of targets to new image building code"
Commit 15458e85bc42672eb06dee5fb45597298b4a7162

So how/where do I choose the new equivalent of a target profile?

Thanks

OK, I figured out how to build the initramfs image (had to enable it in menuconfig) and I now have working OpenWrt.

However, switching back to stock firmware does not work. I can flash it using serial console and TFTP and it starts booting, but then it fails with UBI error and kernel panic.

Someone here in this thread (post #21) mentioned that you have to

restore rootfs mounting its UBIFS volume

. But I don't know what that means or how to do it?

Below is the error that I am getting. Can anyone help?

Thanks

## Booting image at bfd40000 ...
   Image Name:   Linux Kernel Image
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1702204 Bytes =  1.6 MB
   Load Address: 80001000
   Entry Point:  803766f0
..........................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 803766f0) ...
## Giving linux memsize in MB, 256

Starting kernel ...


LINUX started...

 THIS IS ASIC
Linux version 3.10.14-UBNT (root@edgeos-builder2) (gcc version 4.6.3 (Buildroot 2012.11.1) ) #1 SMP Fri Jul 29 16:53:39 PDT 2016

 The CPU feqenuce set to 880 MHz
GCMP present
CPU0 revision is: 0001992f (MIPS 1004Kc)
Software DMA cache coherency
Determined physical RAM map:
 memory: 10000000 @ 00000000 (usable)
Zone ranges:
  Normal   [mem 0x00000000-0x0fffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x00000000-0x0fffffff]
Detected 3 available secondary CPU(s)
Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
PERCPU: Embedded 7 pages/cpu @81203000 s6720 r8192 d13760 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyS1,57600n8 ubi.mtd=7 root=ubi0_0 rootfstype=ubifs rootsqimg=squashfs.img rootsqwdir=w rw
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Writing ErrCtl register=00022467
Readback ErrCtl register=00022467
Memory: 254796k/262144k available (3575k kernel code, 7348k reserved, 1031k data, 188k init, 0k highmem)
Hierarchical RCU implementation.
NR_IRQS:128
console [ttyS1] enabled
Calibrating delay loop... 577.53 BogoMIPS (lpj=1155072)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
launch: starting cpu1
launch: cpu1 gone!
CPU1 revision is: 0001992f (MIPS 1004Kc)
Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
Synchronize counters for CPU 1: done.
launch: starting cpu2
launch: cpu2 gone!
CPU2 revision is: 0001992f (MIPS 1004Kc)
Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
Synchronize counters for CPU 2: done.
launch: starting cpu3
launch: cpu3 gone!
CPU3 revision is: 0001992f (MIPS 1004Kc)
Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
Synchronize counters for CPU 3: done.
Brought up 4 CPUs
devtmpfs: initialized
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
Switching to clocksource MIPS
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
4 CPUs re-calibrate udelay(lpj = 1167360)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Registering unionfs 2.5.13 (for 3.10.34)
aufs 3.10.x-20140915
msgmni has been set to 497
io scheduler noop registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x1e000d00 (irq = 27) is a 16550A
serial8250: ttyS1 at MMIO 0x1e000c00 (irq = 26) is a 16550A
Ralink gpio driver initialized
i2cdrv_major = 218
loop: module loaded
flash manufacture id: 1c, device id 70 15
EN25QH16(1c 70151c70) (2048 Kbytes)
mtd .name = raspi, .size = 0x00200000 (2M) .erasesize = 0x00010000 (64K) .numeraseregions = 0
Creating 1 MTD partitions on "raspi":
0x000000000000-0x000000080000 : "SPI_FLASH"
MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
Allocate 16 byte aligned buffer: 804c0430
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [01 DA 90 95 46, 00909546]
Device found in MTK table, ID: 1da, EXT_ID: 909546
Support this Device in MTK table! 1da
NAND device: Manufacturer ID: 0x01, Chip ID: 0xda (AMD/Spansion NAND 256MiB 3,3V 8-bit), 256MiB, page size: 2048, OOB size: 112
[NAND]select ecc bit:12, sparesize :112 spare_per_sector=28
Scanning device for bad blocks
Signature matched and data read!
load_fact_bbt success 2047
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Creating 7 MTD partitions on "MT7621-NAND":
0x000000000000-0x00000ff80000 : "ALL"
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x0000000e0000 : "Config"
0x0000000e0000-0x000000140000 : "eeprom"
0x000000140000-0x000000440000 : "Kernel"
0x000000440000-0x000000740000 : "Kernel2"
0x000000740000-0x00000ff00000 : "RootFS"
[mtk_nand] probe successfully!
UBNT BD mac 802aa85f532f kidx 1 mrev 18 serial 802AA85F532F type e50
rdm_major = 253
GMAC1_MAC_ADRH -- : 0x0000802a
GMAC1_MAC_ADRL -- : 0xa85f532f
Ralink APSoC Ethernet Driver Initilization. v3.1  512 rx/tx descriptors allocated, mtu = 1500!
GMAC1_MAC_ADRH -- : 0x0000802a
GMAC1_MAC_ADRL -- : 0xa85f532f
PROC INIT OK!
Ralink I2C Init
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
UBI: attaching mtd7 to ubi0
UBI: scanning is finished
UBI error: ubi_read_volume_table: the layout volume was not found
UBI error: ubi_attach_mtd_dev: failed to attach mtd7, error -22
UBI error: ubi_init: cannot attach mtd7
UBIFS error (pid 1): ubifs_mount: cannot open "ubi0_0", error -19
VFS: Cannot open root device "ubi0_0" or unknown-block(0,0): error -19
Please append a correct "root=" boot option; here are the available partitions:
1f00             512 mtdblock0  (driver?)
1f01          261632 mtdblock1  (driver?)
1f02             512 mtdblock2  (driver?)
1f03             384 mtdblock3  (driver?)
1f04             384 mtdblock4  (driver?)
1f05            3072 mtdblock5  (driver?)
1f06            3072 mtdblock6  (driver?)
1f07          253696 mtdblock7  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Hello all

Because of it's low price and seemingly good hardware, I am interested in this model. I would like to know the state of openwrt support for this model. Are you guys running the trunk versions without issues? in particular, i am interested in running openvpn on it and use it as a openvpn server. have any of you guys tried that and successfully established a vpn connection?

I would appreciate your input very much.
thanks

@combolek
How did you exactly flash it? From what i've read so far, it appears to me that the safest way to flash back to the stock firmware via uboot enviroment is to locate the kernel part and the ubifs part (which includes the squashfs file) in the firmware, then figure out which kernel is the active one, and then separately flash back kernel and ubifs partition.

Edit: well, what do you know. they're already separated in the stock fimeware .tar file

(Last edited by Hamy on 13 Sep 2016, 12:07)

I tried different methods of flashing but the results are pretty much the same. First I tried using the bootloader option 2 to flash from TFTP (concatenated kernel+rootfs). I also tried flashing separately kernel and rootfs as you say, using mtd while booted the initramfs openwrt image.

I do not know how to flash directly from uboot command line. What are the commands?

AFAICT, openwrt is working fine, though I am only using it as a basic router/firewall. I have not tried openvpn.

Unfortunately i do not know much about UBI yet but i'm pretty sure the issue relies on squashfs that needs to be inside a UBIFS partitions. according to the guy who added openwrt support for this device:

Stock firmware uses custom kernel patch to mount squashfs from a file that is located on UBIFS volume.

This should possibly involve creating UBI/UBIFS then copying the squashfs file to that partition and potentially renaming it. base on how the custom kernel patch works, extra steps might be needed.

I suggest you directly try contacting the author of the openwrt patch (his email address is in the patch file). he should be able to solve this mystery.

for flashing in u-boot environment, you could use this as a reference:
https://wiki.openwrt.org/doc/howto/gene … ing.serial
Though i do not think this would be necessary for reverting back to the stock firmware.

Oh, thanks, will try this.

Actually, given that OpenWrt works fine and that's what I intend to use, I don't really need to go back to stock firmware. I just don't like the one way street on principle :-)

One more hack that might be worth trying is making a custom sysupgrade image actually containing stock firmware and use openwrt sysupgrade to flash it to the device(don't forget to add -n flag) . making such image is pretty simple, just extract both stock and sysupgrade tar files and you could figure it out.

just make sure that you're ready to recover from it in case things go wrong

Edit: Actually, scratch that. it likely wouldn't work.

(Last edited by Hamy on 15 Sep 2016, 09:23)

OK, success. Someone else has figured it out :-). I used this post:
https://community.ubnt.com/t5/EdgeMAX/W … 85#M128414
Once I followed the steps to recreate the ubifs volume I was able to get back to stock firmware no problem.

So, now I can reflash OpenWrt again and keep using it with a piece of mind :-).

Great. please also consider adding the necessary steps the wiki so others could benefit as well.

combolek wrote:

Heh, I spoke too soon. I now get the dreaded A12 error:
https://community.ubnt.com/t5/EdgeMAX/E … -p/1304245

But you can still run OpenWrt without problems, right?

Are there any issues with OpenWrt on ER-X devices or is everything working perfectly?

Just a side note for users wishing to switch to third party firmwares (like openwrt):
Always try to backup all original mtd partitions. sooner or later, you might need them. in case of this device, it likely just need a slight adjustment of ubf/ubfs settings/partitions. but aside from the fact that you could have restored the original mtds to revert back to the stock firmware and be done with it, they could have helped to uncover whats wrong what needs to be adjusted.

@Hamy can you write up a short how to on wiki. It would be really helpful to have steps needed to backup and restore mtd partitions. For some who does this for first time it is a daunting task.

valentt wrote:
combolek wrote:

Heh, I spoke too soon. I now get the dreaded A12 error:
https://community.ubnt.com/t5/EdgeMAX/E … -p/1304245

But you can still run OpenWrt without problems, right?

Are there any issues with OpenWrt on ER-X devices or is everything working perfectly?

Yes, as far as I can tell OpenWrt works fine. I don't know of any problems but I am probably using only a small subset of the features.

Was anyone successful in getting POE enabled on ports?

(Last edited by valentt on 20 Nov 2016, 18:25)

it works!
thx a lot

Hello,
I am having issues upgrading a UBNT ERX from the factory openwrt image as follows.
Thank you very much in advance for your expert advice.

The problem is I am getting a system crash and reset when performing sysupgrade.
The factory image installed fine with the add command after compiling.
       DESIGNATED DRIVER (Bleeding Edge, r49395)

I have tried upgrading with the latest download from
     openwrt-ramips-mt7621-ubnt-erx-squashfs-sysupgrade.tar
as well as the tar file that make menuconfig created.

These are the commands that I wrote on a VirtualBox session of Ubuntu running on a Windows 7 host to build the compiled tar files:
git clone ... openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

These are the options I selected:
Ralink RT288x/RT3xxx
MT7621 based boards
Ubiquity Edge Router X
ramdisk
squashfs

this is the console view after running sysupgrade:
john@john-VirtualBox:/tmp$ ssh root@192.168.1.1


BusyBox v1.24.2 () built-in shell (ash)

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
-----------------------------------------------------
DESIGNATED DRIVER (Bleeding Edge, 50140)
-----------------------------------------------------
  * 2 oz. Orange Juice         Combine all juices in a
  * 2 oz. Pineapple Juice      tall glass filled with
  * 2 oz. Grapefruit Juice     ice, stir well.
  * 2 oz. Cranberry Juice
-----------------------------------------------------
root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# sysupgrade -v openwrt-ramips-mt7621-ubnt-erx-squashfs-sysupgr
ade.tar
Saving config files...
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/network
etc/config/system
etc/dropbear/dropbear_rsa_host_key
etc/group
etc/hosts
etc/inittab
etc/opkg/keys/af22f7a88858c8e9
etc/opkg/keys/ce8180f5ff8d2a38
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
etc/sysctl.d/local.conf
killall: watchdog: no process killed
Connection to 192.168.1.1 closed by remote host.
Connection to 192.168.1.1 closed.
john@john-VirtualBox:/tmp$

Regards,
John

Try using the -n switch when doing the sysupgrade to wipe the current config

sysupgrade -n openwrt-ramips-mt7621-ubnt-erx-squashfs-sysupgr
ade.tar

Webtron,
I tried the -n switch, and the same thing happens. It crashes and reboots.
One thing to tell you is that I followed the procedure on the openwrt site for clearing up memory for sysupgrades, in case the problem was lack of sufficient memory. This entailed deleting the cache and two directories.
Before I performed this step, I would receive a command failed error, and then sysupgrade exited, but the box did not reboot.
I did attempt the sysupgrade with the -n switch also.
Now that the directories are removed, it doesn't get as far and then it crashes. So apparently releasing memory created another problem.
Can you advise what the procedure is to recover, or to reinstall the factory image from an existing factory image? Do I need to recover back to the UBNT OS, and start again, or is there a simpler method if I already have the factory image on board?
Thank you for your assistance.
Regards,
John

I've managed to make it work but hit a couple snags following the instructions on the wiki.

* First, there is no "Target Profile" for the EdgeRouter X.  Only the default profile is available.

However, in order to build the "factory" image, the entire system must fit into 3 MB.  So if you just use the default settings, the build will fail.

So you will need to go through the menuconfig and manually remove some unnecessary packages, such as WiFi and USB packages, in order to get the build to succeed.

I used the following:

 Target System: Ralink RT288x/RT3xxx
 Subtarget: MT7621 based boards
 Target Profile: Default Profile
 Target Images > ramdisk: Y
 Kernel Modules > Wireless Drivers > kmod-mt76: N
 Kernel Modules > Wireless Drivers > kmod-mac80211: N
 Kernel Modules > Wireless Drivers > kmod-cfg80211: N
 Kernel Modules > USB Support > kmod-usb3: N
 Kernel Modules > USB Support > kmod-usb-core: N
 Utilities > iwinfo: N
 Network > iw: N
 Network > wpad-mini: N
 Network > hostapd-common: N
 Libraries > libiwinfo: N

* Second, failsafe mode is BADLY broken: the device does not respond to any network activity on any port.  This is apparently because the switch is configured to use VLANs by default, but failsafe mode doesn't understand that.  The script /lib/preinit/07_set_preinit_iface_ramips works around the same issue for certain other models.

It seems to me that this workaround is a security risk; unless I'm missing something, this script is invoked at every startup (failsafe or not), which would mean that the router is, if only briefly, acting as a dumb switch.  If an attacker were able to exploit some other bug that would cause the router to reboot, this would give them a short window during which they could send packets that bypass the firewall.

At any rate, here's how to enable the workaround for ERX.  (I have no idea whether this is appropriate/necessary for *all* MT7621 devices or not.)

--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -6,7 +6,7 @@
 . /lib/ramips.sh
 
 ramips_set_preinit_iface() {
-    RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688|MT7620)"`
+    RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)"`
 
     if [ -n "${RT3X5X}" ]; then
         # The ethernet switch driver enables VLAN by default, but
@@ -17,6 +17,9 @@ ramips_set_preinit_iface() {
         *MT7620*)
             ralink_switchdev=mt7620
             ;;
+        *MT7621*)
+            ralink_switchdev=mt7530
+            ;;
         esac
         swconfig dev $ralink_switchdev set reset 1
         swconfig dev $ralink_switchdev set enable_vlan 0

The discussion might have continued from here.