# NanoPi Neo2 Porting Mender to Openwrt

**URL:** <https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300>\
**Category:** General Discussions\
**Tags:** yocto, thud\
**Created:** [March 5, 2019, 7:35pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300 "2019-03-05T19:35:27Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 1:51pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/122 "2019-03-27T13:51:35Z")

</div>

Aah yeah, the silly `distro_bootcmd` will do that.

You could add a `printenv` command before `run uenvcmd; run mender_try_to_recover`, that should at least print it before it proceed.

But you could also just copy the lines that are in `boot.scr` manually one by one if you halt boot

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 27, 2019, 2:01pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/123 "2019-03-27T14:01:52Z")

</div>

env after running boot script (minus run boot)

```auto
=> run mender_setup
=> setenv loadkernel load \${mender_uboot_root} \${kernel_addr_r} /boot/uImage

=> setenv loaddtb load \${mender_uboot_root} \${fdt_addr_r} /boot/dtb
=> setenv bootargs console=ttyS0,115200 earlyprintk root=${mender_kernel_root_na
me} rootwait earlycon=uart,mmio32,0x01c28000
=> setenv uenvcmd run loadkernel \&\& run loaddtb \&\& booti \${kernel_addr_r} -
 \${fdt_addr_r}
=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=sunxi
board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefi
x}${script}; source ${scriptaddr}
boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};el
se bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootp
art} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then boo
tefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontrolad
dr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr}
${prefix}extlinux/extlinux.conf
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel mmc0 usb0 pxe dhcp
bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait earlycon=
uart,mmio32,0x01c28000
bootcmd=run distro_bootcmd
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp};
then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci
${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:0
0011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot $
{fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel
_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;se
tenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfi
le;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo '(F
EL boot)'; source ${fel_scriptaddr}; fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootcount=1
bootdelay=2
bootfstype=fat
bootlimit=1
bootm_size=0xa000000
console=ttyS0,115200
cpu=armv8
devnum=0
devplist=1
devtype=mmc
dfu_alt_info_ram=kernel ram 0x40080000 0x1000000;fdt ram 0x4FA00000 0x100000;ram
disk ram 0x4FE00000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethaddr=02:01:65:f3:03:89
fdt_addr_r=0x4FA00000
fdtcontroladdr=59f4b920
fdtfile=allwinner/sun50i-h5-nanopi-neo2.dtb
fileaddr=4fc00000
filesize=1ea
kernel_addr_r=0x40080000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix
}${efi_fdtfile}
loaddtb=load ${mender_uboot_root} ${fdt_addr_r} /boot/dtb
loadkernel=load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part
3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; setenv mender_
boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootm
mender_boot_part=2
mender_boot_part_hex=2
mender_boot_part_name=/dev/mmcblk0p2
mender_check_saveenv_canary=1
mender_dtb_name=dtb
mender_kernel_name=uImage
mender_kernel_root=/dev/mmcblk02
mender_kernel_root_name=/dev/mmcblk0p2
mender_linux_test=1
mender_saveenv_canary=1
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_savee
nv_canary 1; saveenv; fi; if test "${mender_pre_setup_commands}" != ""; then run
 mender_pre_setup_commands; fi; setenv mender_kernel_root /dev/mmcblk0${mender_b
oot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /d
ev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mende
r_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 0:${me
nder_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; set
env expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; se
tenv expand_bootargs; if test "${mender_post_setup_commands}" != ""; then run me
nder_post_setup_commands; fi
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mender_uboot_root=mmc 0:2
mender_uboot_root_name=/dev/mmcblk0p2
mender_uboot_test=1
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_pa
rt; fi
mmc_bootdev=0
partitions=name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};name=loader2,
size=984k,uuid=${uuid_gpt_loader2};name=esp,size=128M,bootable,uuid=${uuid_gpt_e
sp};name=system,size=-,uuid=${uuid_gpt_system};
preboot=usb start
pxefile_addr_r=0x4FD00000
ramdisk_addr_r=0x4FE00000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for
prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scrip
ts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env ex
ists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fs
type ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_b
oot; fi; done
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes
}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}
; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpa
rt} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/b
ootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; seten
v efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefi
x}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run b
oot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${d
evnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${pr
efix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x4FC00000
serial#=8280000165f30389
soc=sunxi
stderr=serial,vidconsole
stdin=serial,usbkbd
stdout=serial,vidconsole
uenvcmd=run loadkernel && run loaddtb && booti ${kernel_addr_r} - ${fdt_addr_r}
upgrade_available=0
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_
for_boot_part; fi
uuid_gpt_esp=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
uuid_gpt_system=b921b045-1df0-41c3-af44-4c6f280d3fae

Environment size: 6196/16379 bytes

```

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 2:05pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/124 "2019-03-27T14:05:59Z")

</div>

All looks in order,

Can you also run

```auto
setenv mender_boot_part 3
setenv mender_boot_part_hex 3

```

and then repeat the sequence in `boot.scr`. Keep in mind to reset the board once to clear out any modifications done in previous attempt.

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 27, 2019, 2:09pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/125 "2019-03-27T14:09:40Z")

</div>

```auto
Hit any key to stop autoboot: 0
=> setenv mender_boot_part 3
=> setenv mender_boot_part_hex 3
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=> run mender_setup
=> setenv loadkernel load \${mender_uboot_root} \${kernel_addr_r} /boot/uImage

=> setenv loaddtb load \${mender_uboot_root} \${fdt_addr_r} /boot/dtb
=> setenv bootargs console=ttyS0,115200 earlyprintk root=${mender_kernel_root_na
me} rootwait earlycon=uart,mmio32,0x01c28000
=> setenv uenvcmd run loadkernel \&\& run loaddtb \&\& booti \${kernel_addr_r} -
 \${fdt_addr_r}
=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=sunxi
board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefi
x}${script}; source ${scriptaddr}
boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};el
se bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootp
art} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then boo
tefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontrolad
dr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr}
${prefix}extlinux/extlinux.conf
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel mmc0 usb0 pxe dhcp
bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p3 rootwait earlycon=
uart,mmio32,0x01c28000
bootcmd=run distro_bootcmd
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp};
then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci
${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:0
0011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot $
{fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel
_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;se
tenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfi
le;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo '(F
EL boot)'; source ${fel_scriptaddr}; fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootcount=1
bootdelay=2
bootfstype=fat
bootlimit=1
bootm_size=0xa000000
console=ttyS0,115200
cpu=armv8
devnum=0
devplist=1
devtype=mmc
dfu_alt_info_ram=kernel ram 0x40080000 0x1000000;fdt ram 0x4FA00000 0x100000;ram
disk ram 0x4FE00000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethaddr=02:01:65:f3:03:89
fdt_addr_r=0x4FA00000
fdtcontroladdr=59f4b920
fdtfile=allwinner/sun50i-h5-nanopi-neo2.dtb
fileaddr=4fc00000
filesize=1ea
kernel_addr_r=0x40080000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix
}${efi_fdtfile}
loaddtb=load ${mender_uboot_root} ${fdt_addr_r} /boot/dtb
loadkernel=load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part
3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; setenv mender_
boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootm
mender_boot_part=3
mender_boot_part_hex=3
mender_boot_part_name=/dev/mmcblk0p3
mender_check_saveenv_canary=1
mender_dtb_name=dtb
mender_kernel_name=uImage
mender_kernel_root=/dev/mmcblk03
mender_kernel_root_name=/dev/mmcblk0p3
mender_linux_test=1
mender_saveenv_canary=1
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_savee
nv_canary 1; saveenv; fi; if test "${mender_pre_setup_commands}" != ""; then run
 mender_pre_setup_commands; fi; setenv mender_kernel_root /dev/mmcblk0${mender_b
oot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /d
ev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mende
r_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 0:${me
nder_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; set
env expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; se
tenv expand_bootargs; if test "${mender_post_setup_commands}" != ""; then run me
nder_post_setup_commands; fi
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mender_uboot_root=mmc 0:3
mender_uboot_root_name=/dev/mmcblk0p3
mender_uboot_test=1
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_pa
rt; fi
mmc_bootdev=0
partitions=name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};name=loader2,
size=984k,uuid=${uuid_gpt_loader2};name=esp,size=128M,bootable,uuid=${uuid_gpt_e
sp};name=system,size=-,uuid=${uuid_gpt_system};
preboot=usb start
pxefile_addr_r=0x4FD00000
ramdisk_addr_r=0x4FE00000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for
prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scrip
ts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env ex
ists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fs
type ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_b
oot; fi; done
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes
}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}
; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpa
rt} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/b
ootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; seten
v efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefi
x}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run b
oot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${d
evnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${pr
efix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x4FC00000
serial#=8280000165f30389
soc=sunxi
stderr=serial,vidconsole
stdin=serial,usbkbd
stdout=serial,vidconsole
uenvcmd=run loadkernel && run loaddtb && booti ${kernel_addr_r} - ${fdt_addr_r}
upgrade_available=0
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_
for_boot_part; fi
uuid_gpt_esp=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
uuid_gpt_system=b921b045-1df0-41c3-af44-4c6f280d3fae

Environment size: 6196/16379 bytes

```

Let me know when to proceed with boot, to see if P3 active…

BTW; mender\_kernel\_root\_name and mender\_kernel\_root identical

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 2:16pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/126 "2019-03-27T14:16:55Z")

</div>

> BTW; mender\_kernel\_root\_name and mender\_kernel\_root identical

Yep, see that as well.

And it all looks ok to me.

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 27, 2019, 2:17pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/127 "2019-03-27T14:17:45Z")

</div>

Have to duck out for 4 hours; Chores

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 27, 2019, 6:52pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/128 "2019-03-27T18:52:01Z")

</div>

back, any other tests?

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 27, 2019, 6:56pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/129 "2019-03-27T18:56:12Z")

</div>

ran: run uenvcmd; run mender\_try\_to\_recover  
…booted into new partition, only diff:  
manual:

```auto
setenv mender_boot_part 3
setenv mender_boot_part_hex 3

```

…which mender update apparently missed?

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 7:22pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/130 "2019-03-27T19:22:01Z")

</div>

Could you elaborate the last message, not sure I followed.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 7:23pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/131 "2019-03-27T19:23:28Z")

</div>

You could also try the standalone deployments,

[https://docs.mender.io/1.7/architecture/standalone-deployments](https://docs.mender.io/1.7/architecture/standalone-deployments)

and check the status during each step manually to try to isolate

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 27, 2019, 8:11pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/132 "2019-03-27T20:11:04Z")

</div>

> [@mirzak](#):
>
> 08:55:33 +0000 UTC error: got invalid entrypoint into the state machine: state: reboot

Came to think of it, above can also mean that U-boot roll-backed the update for some reason (e.g due to failing to load Linux kernel or something like that). So if you can capture the console output for a complete update cycle which fails it might provide additional insights.

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 12:40pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/133 "2019-03-28T12:40:32Z")

</div>

Console O/P follows, notes:

- uboot now prints env B4 kernel load
- log starts with rootfs to be updated running and fully booted (third boot)
- firstboot does this: basic N/W config, create dirs…, reboot
- secondboot does this: install + config packages, including mender (which is started), reboot
- third and subsequent boots, fully configured, mender started
- for some reason, altboot run, which may be the smoking gun (bootcount, bootlimit=1).

Log too big for post:

[https://www.rossco.org/Downloads/OpenWrt/PHero\_Boot.txt](https://www.rossco.org/Downloads/OpenWrt/PHero_Boot.txt)

Regards;  
Bill

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 28, 2019, 12:44pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/134 "2019-03-28T12:44:36Z")

</div>

Thanks for the log, this seems to be your problem.

```auto
mount: mounting /dev/mmcblk0p2 on /mnt failed: Invalid argument[5.362199] urandom-seed: Seed file not found (/etc/urandom.seed)

[5.398464] procd: - early -
[5.401499] procd: - watchdog -
[6.157500] procd: - watchdog -
[6.160881] procd: - ubus -
[6.170299] random: ubusd: uninitialized urandom read (4 bytes read)
[6.214400] random: ubusd: uninitialized urandom read (4 bytes read)
[6.220940] random: ubusd: uninitialized urandom read (4 bytes read)
[6.227694] procd: - init -
Please press Enter to activate this console.
[6.341702] kmodloader: loading kernel modules from /etc/modules.d/*
[6.353275] ip6_tables: (C) 2000-2006 Netfilter Core Team
[6.363485] cryptodev: driver 1.10 loaded.
[6.376411] ip_tables: (C) 2000-2006 Netfilter Core Team
[6.385853] nf_conntrack version 0.5.0 (4096 buckets, 16384 max)
[6.416158] xt_time: kernel timezone is -0000
[6.425738] PPP generic driver version 2.4.2
[6.431014] NET: Registered protocol family 24
[6.437570] kmodloader: done loading kernel modules from /etc/modules.d/*
[9.242858] RTL8211E Gigabit Ethernet 0.2:07: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=0.2:07, irq=POLL)
[9.255952] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[9.263715] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[9.281997] br-lan: port 1(eth0) entered blocking state
[9.289123] br-lan: port 1(eth0) entered disabled state
[9.294644] device eth0 entered promiscuous mode
[9.301480] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[9.929268] EXT4-fs (mmcblk0p3): re-mounted. Opts: (null)
[11.389498] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[11.398062] br-lan: port 1(eth0) entered blocking state
[11.403299] br-lan: port 1(eth0) entered forwarding state
[11.409185] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[15.506039] br-lan: port 1(eth0) entered disabled state
[15.511953] device eth0 left promiscuous mode
[15.516344] br-lan: port 1(eth0) entered disabled state
[19.812383] kvm: exiting hardware virtualization
[19.821931] reboot: Restarting system

U-Boot SPL 2018.11 (Feb 14 2019 - 20:43:07 +0000)
DRAM: 512 MiB
Trying to boot from MMC1
NOTICE: BL31: v2.0(release):reboot-9355-g94993a7-dirty
NOTICE: BL31: Built : 20:43:07, Feb 14 2019
NOTICE: BL31: Detected Allwinner H5 SoC (1718)
NOTICE: BL31: STUB PMIC setup code called

U-Boot 2018.11 (Feb 14 2019 - 20:43:07 +0000) Allwinner Technology

CPU: Allwinner H5 (SUN50I)
Model: FriendlyARM NanoPi NEO 2
DRAM: 512 MiB
MMC: SUNXI SD/MMC: 0
Loading Environment from MMC... OK
In: serial
Out: serial
Err: serial
Net: phy interface7
eth0: ethernet@1c30000
starting USB...
USB0: USB EHCI 1.00
USB1: USB OHCI 1.0
USB2: USB EHCI 1.00
USB3: USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Saving Environment to MMC... Writing to MMC(0)... OK
Warning: Bootlimit (1) exceeded. Using altbootcmd.

```

When booting the “new image” you get,

```auto
mount: mounting /dev/mmcblk0p2 on /mnt failed: Invalid argument[ 

```

Which triggers a reboot and then you can see in U-boot that it rolled back because it was not succesful in booting the boot candidate,

```auto
Saving Environment to MMC... Writing to MMC(0)... OK
Warning: Bootlimit (1) exceeded. Using altbootcmd.
Hit any key to stop autoboot: 2 1 0 
Saving Environment to MMC... Writing to redundant MMC(0)... OK
switch to partitions #0, OK

```

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 12:50pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/135 "2019-03-28T12:50:19Z")

</div>

But; /dev/mmcblk0p2 is the pre-update rootfs and, at end is mounted. Whatever happens to /dev/mmcblk0p3 (previous) is the problem…

will scrutinize logfile in more detail…

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 28, 2019, 12:53pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/136 "2019-03-28T12:53:16Z")

</div>

`mmcblk0p3` was mounted just fine,

```auto
[1.652215] EXT4-fs (mmcblk0p3): mounted filesystem without journal. Opts: (null)
[5.252577] mount_root: mounting /dev/root
[5.259469] EXT4-fs (mmcblk0p3): re-mounted. Opts: (null)

```

This means that you have something (automount service?) that is trying to mount `mmcblk0p2` to `/mnt` which is failing and causing a reboot and hence the failed update.

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 12:54pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/137 "2019-03-28T12:54:39Z")

</div>

agreed, leave it with me. Problem starts with invalid fstab, which should disable that automount…

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 1:06pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/138 "2019-03-28T13:06:06Z")

</div>

Need some thought to sort this out:  
In rc.local (@ firstboot - create proper fstab)  
openwrt @ firstboot (before hitting my rc.local, creates fstab (which is incorrect for mender, causing err)  
Need to create proper fstab @openwrt firstboot without disrupting openwrt infrastructure too much…

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 7:06pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/139 "2019-03-28T19:06:28Z")

</div>

stuck here:

do update (p2-\>p3), boot into p3, mount it /root (success)  
…  
mount: mounting /dev/mmcblk0p2 on /mnt failed: Invalid argument

using automount in fstab, since without it, other errs causing reboot  
unmount /mnt/mmcblk0p\* in rc.local (otherwise mender update croaks if mounted)

going take a bit to sort this out - suggestions?

Regards;  
Bill

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 28, 2019, 7:19pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/140 "2019-03-28T19:19:22Z")

</div>

Can you share the content of fstab and rc.local

---

<div class="post-metadata">

**Author:** ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)\
**Post date:** [March 28, 2019, 7:43pm UTC](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300/141 "2019-03-28T19:43:21Z")

</div>

/etc/config/fstab:

```auto
config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 0

config mount
        option target '/data'
        option options 'rw'
        option device '/dev/mmcblk0p4'

```

```auto
/etc/rc.local:
...
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

umount /mnt/mmcblk0p*
exit 0

```

[Previous page](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300.md?page=6)

[Next page](https://hub.mender.io/t/nanopi-neo2-porting-mender-to-openwrt/300.md?page=8)
