QHora-301w back to stock firmware

I would like to get back to stock firmware. I got QNAP QHora-301w, i connect serial cable and follow this guide "to go back to stock, stop u-boot autoboot, setenv current_entry 1, saveenv, bootipq", and stock frimware boot. But i made mistake and execute this commands env default -a , saveenv, reset... and now i only can boot openwrt.

Some details:

printenv

IPQ807x# printenv

baudrate=115200
boot_0=good
boot_1=bad
boot_2=good
bootargs=console=ttyMSM0,115200n8
bootcmd=bootipq
bootdelay=2
current_entry=0
eth1addr=
eth2addr=
eth3addr=
eth4addr=
eth5addr=
ethact=eth0
ethaddr=
fdt_high=0x4A400000
fdtcontroladdr=4a96c8d0
flash_type=8
fw_type=router
ipaddr=
machid=8010000
netmask=
serverip=
soc_version_major=2
soc_version_minor=0
stderr=serial@78B3000
stdin=serial@78B3000
stdout=serial@78B3000

Environment size: 616/131068 bytes

Boot from second partition
  • exec
  • mkdir -p /sys /proc
  • echo_dbg Making /sys...
  • echo -e \033[01;32mMaking /sys...\033[00m
    Making /sys...
  • mount -t sysfs -o nodev,noexec,nosuid none /sys
  • echo_db[ 5.167839] mmc0: MAN_BKOPS_EN bit is not set
    g Making /proc...
  • echo -e \033[01;32mMaking /proc...\033[00m
    Making /proc...
  • mount -t proc -o nodev,noexec,nosuid none /proc
  • wait_detect_emmc
  • local devname=/dev/mmcblk0p
  • local emmc_all_partition_exist=1
  • seq 6
  • emmc_all_par[ 5.194479] mmc0: new HS200 MMC card at address 0001
    [ 5.195123] mmcblk0: mmc0:0001 Q2J54A 3.64 GiB
    [ 5.200121] mmcblk0rpmb: mmc0:0001 Q2J54A partition 3 512 KiB
    [ 5.205741] GPT: device [179:4] (rootfs) set to be root filesystem
    [ 5.210211] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9
    tition_exist=1
  • [ ! -e /dev/mmcblk0p1 ]
  • emmc_all_partition_exist=0
  • break
  • [ 0 -eq 0 ]
  • sleep 1
  • echo_dbg sleep 1 wait for emmc device /dev/mmcblk0p1
  • echo -e \033[01;32msleep 1 wait for emmc device /dev/mmcblk0p1\033[00m
    sleep 1 wait for emmc device /dev/mmcblk0p1
  • seq 6
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p1 ]
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p2 ]
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p3 ]
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p4 ]
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p5 ]
  • emmc_all_partition_exist=1
  • [ ! -e /dev/mmcblk0p6 ]
  • [ 1 -eq 0 ]
  • break
  • [ 1 -eq 0 ]
  • auto_repair_fs
  • local devname=/dev/mmcblk0p
  • [ -e /dev/mmcblk0p4 ]
  • echo_dbg Auto repair /dev/mmcblk0p4
  • echo -e \033[01;32mAuto repair /dev/mmcblk0p4\033[00m
    Auto repair /dev/mmcblk0p4
  • fsck.ext4 -p /dev/mmcblk0p4
    fsck.ext4: Bad magic number in super-block while trying to open /dev/mmcblk0p4
    /dev/mmcblk0p4:
    The superblock could not be read or does not describe a valid ext2/ext3/ext4
    filesystem. If the device is valid and it really contains an ext2/ext3/ext4
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193
    or
    e2fsck -b 32768

/dev/mmcblk0p4 contains a squashfs file system

  • [ -e /dev/mmcblk0p5 ]

  • echo_dbg Auto repair /dev/mmcblk0p5

  • echo -e \033[01;32mAuto repair /dev/mmcblk0p5\033[00m
    Auto repair /dev/mmcblk0p5

  • fsck.ext4 -p /dev/mmcblk0p5
    /dev/mmcblk0p5: clean, 12/33120 files, 133761/524288 blocks

  • [ -e /dev/mmcblk0p6 ]

  • echo_dbg Auto repair /dev/mmcblk0p6

  • echo -e \033[01;32mAuto repair /dev/mmcblk0p6\033[00m
    Auto repair /dev/mmcblk0p6

  • fsck.ext4 -p /dev/mmcblk0p6
    fsck.ext4: Bad magic number in super-block while trying to open /dev/mmcblk0p6
    /dev/mmcblk0p6:
    The superblock could not be read or does not describe a valid ext2/ext3/ext4
    filesystem. If the device is valid and it really contains an ext2/ext3/ext4
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193
    or
    e2fsck -b 32768

  • [ -e /dev/mmcblk0p8 ]

  • echo_dbg Auto repair /dev/mmcblk0p8

  • echo -e \033[01;32mAuto repair /dev/mmcblk0p8\033[00m
    Auto repair /dev/mmcblk0p8

  • fsck.ext4 -p /dev/mmcblk0p8
    /dev/mmcblk0p8: clean, 13/4096 files, 1942/16384 blocks

  • [ -e /dev/mmcblk0p9 ]

  • echo_dbg Auto repair /dev/mmcblk0p9

  • echo -e \033[01;32mAuto repair /dev/mmcblk0p9\033[00m
    Auto repair /dev/mmcblk0p9

  • fsck.ext4 -p /dev/mmcblk0p9
    /dev/mmcblk0p9: recovering journal
    /dev/mmcblk0p9: clean, 870/134640 files, 33629/538368 blocks

  • mount_rootfs

  • get_current_fw_entry

  • fw_printenv

  • grep current_entry

  • awk -F= {print $2}

  • local current_entry=1
    ]1

  • echo 1
    ocal current_entry=1
    ocal dev_rootfs=

  • [ 1

  • [ 1

  • findfs PARTLABEL=rootfs_2

  • dev_rootfs=/dev/mmcblk0p6

  • echo_dbg rootfs boot from rootfs_2

  • echo -e \033[01;32mrootfs boot from rootfs_2\033[00m
    rootfs boot from rootfs_2

  • mkdir -p /mnt/rootfs

  • mount -o ro /dev/mmcblk0p6 /mnt/rootfs
    mount: mounting /dev/mmcblk0p6 on /mnt/rootfs failed: Invalid argument

  • mount_rootfs_data

  • findfs PARTLABEL=rootfs_data

  • local dev_rootfs_data=/dev/mmcblk0p9

  • echo_dbg rootfs data: /dev/mmcblk0p9

  • echo -e \033[01;32mr[ 7.053946] EXT4-fs (mmcblk0p9): couldn't mount as ext3 due to feature incompatibilities
    [ 7.061199] EXT4-fs (mmcblk0p9): mounted filesystem with ordered data mode. Opts: (null)
    ootfs data: /dev/mmcblk0p9\033[00m
    rootfs data: /dev/mmcblk0p9

  • [ x/dev/mmcblk0p9 != x ]

  • [ -e /dev/mmcblk0p9 ]

  • blkid /dev/mmcblk0p9

  • grep -q ext4

  • echo_dbg Mount rootfs data to /mnt/rootfs_data

  • echo -e \033[01;32mMount rootfs data to /mnt/rootfs_data\033[00m
    Mount rootfs data to /mnt/rootfs_data

  • mkdir -p /mnt/rootfs_data

  • mount /dev/mmcblk0p9 /mnt/rootfs_data

  • [ ! -d /mnt/rootfs_data/etc ]

  • [ -e /mnt/rootfs_data/etc/reset_to_default ]

  • add_keep_history

  • mntpnt_rootfs_squashfs=/mnt/rootfs_squashfs

  • mkdir -p /mnt/rootfs_squashfs

  • mount -t squashfs -o ro,loop /mnt/rootfs/rootfs.squashfs /mnt/rootfs_squashfs
    mount: mounting /mnt/rootfs/rootfs.squashfs on /mnt/rootfs_squashfs failed: No such file or directory

  • rescue_shell Mount rootfs.squashfs failed

  • echo_err Err: Mount rootfs.squashfs failed

  • echo -e \033[01;31mErr: Mount rootfs.squashfs failed\033[00m
    Err: Mount rootfs.squashfs failed

  • ls -A /dev

  • [ console
    coresight-stm
    coresight-tmc-etf
    coresight-tmc-etr
    cpu_dma_latency
    dcc_sram
    fb0
    full
    hora_gpio
    hwrng
    icesdcc
    iio:device0
    kmsg
    loop-control
    loop0
    loop1
    loop2
    loop3
    loop4
    loop5
    loop6
    loop7
    mapper
    mem
    memory_bandwidth
    mmcblk0
    mmcblk0p1
    mmcblk0p2
    mmcblk0p3
    mmcblk0p4
    mmcblk0p5
    mmcblk0p6
    mmcblk0p7
    mmcblk0p8
    mmcblk0p9
    mmcblk0rpmb
    msm_sps
    mtd0
    mtd0ro
    mtd1
    mtd10
    mtd10ro
    mtd11
    mtd11ro
    mtd1ro
    mtd2
    mtd2ro
    mtd3
    mtd3ro
    mtd4
    mtd4ro
    mtd5
    mtd5ro
    mtd6
    mtd6ro
    mtd7
    mtd7ro
    mtd8
    mtd8ro
    mtd9
    mtd9ro
    mtdblock0
    mtdblock1
    mtdblock10
    mtdblock11
    mtdblock2
    mtdblock3
    mtdblock4
    mtdblock5
    mtdblock6
    mtdblock7
    mtdblock8
    mtdblock9
    network_latency
    network_throughput
    null
    port
    ptmx
    ram0
    ram1
    ram10
    ram11
    ram12
    ram13
    ram14
    ram15
    ram2
    ram3
    ram4
    ram5
    ram6
    ram7
    ram8
    ram9
    random
    snd
    subsys_qcom_q6v5_wcss
    tty
    ttyMSM0
    ubi_ctrl
    urandom
    watchdog
    watchdog0
    zero ]

  • echo_dbg /dev is mounted!!!

  • echo -e \033[01;[ 7.238536] random: nonblocking pool is initialized
    32m/dev is mounted!!!\033[00m
    /dev is mounted!!!

  • get_current_fw_entry

  • fw_printenv

  • grep current_entry

  • awk -F= {print $2}

  • local current_entry=1
    ]1

  • echo 1
    urrent_fw_entry=1
    et_next_fw_entry

  • get_current_fw_entry

  • fw_printenv

  • grep current_entry

  • awk -F= {print $2}

  • local current_entry=1
    ]1

  • echo 1
    urrent_entry=1
    et_fw_type

  • fw_printenv

  • grep fw_type

  • awk -F= {print $2}

  • local fw_type=router

  • [ xrouter = x ]

  • echo router

  • fw_type=router

  • [ router = router ]

  • [ 1

  • next_entry=0

  • echo 0

  • next_fw_entry=0

  • echo_warn switch fw entry to 0

  • echo -e \033[01;33mswitch fw entry to 0\033[00m
    switch fw entry to 0

    • [ 1
    • [ 1
    • [ 1
    • fw_setenv current_entry 0
    • sleep 1
    • reboot -f

I am not a developer also dont know anything about this commands and environment... any advice if it still posible? or i can just throw router in the trash.

set it back to 1 again ?

if i set to 1 back again then it will try to boot and fail and go back to 0... just paste whole log "Boot from second partition". And loop goes on and on.

your log is unreadable, the formatting seems completely f-ed..