OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Base system
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version lede-17.01
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by anonymous - 05.02.2017
Last edited by Ted Hess - 07.02.2017

FS#468 - Firstboot does not work on ZyXEL P-2812HNU-F1 (17.01.0-rc1)

After installing lede-17.01.0-rc1-r3042-ec095b5-lantiq-xrx200-P2812HNUF1-squashfs-sysupgrade.bin on top of Chaos-Calmer on my P-2812HNU-F1, it kept it’s old config, although I didn’t specify that

sysupgrade /tmp/lede.bin

After activating fail-safe I tried to use firstboot to drop the config, but it failed:

root@(none):~# firstboot
This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
/dev/ubi0_1 is not mounted
/dev/ubi0_1 will be erased on next mount
writing /dev/ubi0_1 failed: Operation not permitted

After rebooting it had kept it’s config.

Worked around it with

root@(none):~# mount_root 
switching to ubifs overlay
root@(none):/rom/root# firstboot 
This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
/dev/ubi0_1 is mounted as /overlay, only erasing files
John commented on 22.04.2018 19:36

Same issue, a few differences:

Fully functional Chaos Calmer 15.05.1 on a Linksys 1900v2. Update to lede-17.01.4-mvebu-linksys-wrt1900acv2-squashfs-factory.img

Unable to run firstboot as above.
Work around as noted worked.

Jeff Kletsky commented on 09.04.2019 20:16

This appears to impact multiple devices – the overlay is NOT erased on next mount, as indicated

Seen on IPQ4019-based Linksys EA8300 (WIP) – master, Linux 4.19

root@(none):/# firstboot 
[   11.768586] jffs2reset: This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
[   17.092800] jffs2reset: /dev/ubi0_1 is not mounted
[   17.092904] jffs2reset: /dev/ubi0_1 will be erased on next mount
[   17.096545] jffs2reset: writing /dev/ubi0_1 failed: Operation not permitted

as well as being reported at

https://forum.openwrt.org/t/solved-in-recovery-mode-firstboot-fails-jffs2reset-writing-dev-ubi0-1-failed-operation-not-permitted/28097

Mir3G

root@(none):/# firstboot
[   32.530266] jffs2reset: This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
[   34.958257] jffs2reset: /dev/ubi0_1 is not mounted
[   34.963187] jffs2reset: /dev/ubi0_1 will be erased on next mount
[   34.969244] jffs2reset: writing /dev/ubi0_1 failed: Operation not permitted
Jeff Kletsky commented on 11.04.2019 00:05

jffs2reset.c:

static int jffs2_mark(struct volume *v)
{
        __u32 deadc0de = __cpu_to_be32(0xdeadc0de);
        size_t sz;
        int fd;

        fd = open(v->blk, O_WRONLY);
        ULOG_INFO("%s will be erased on next mount\n", v->blk);
        if (!fd) {
                ULOG_ERR("opening %s failed\n", v->blk);
                return -1;
        }

        sz = write(fd, &deadc0de, sizeof(deadc0de));
        close(fd);

        if (sz != 4) {
                ULOG_ERR("writing %s failed: %m\n", v->blk);
                return -1;
        }

        return 0;
}
@@ -0,0 +1,10 @@
+--- a/jffs2reset.c
++++ b/jffs2reset.c
+@@ -80,6 +80,7 @@ static int jffs2_mark(struct volume *v)
+       }
+ 
+       sz = write(fd, &deadc0de, sizeof(deadc0de));
++      ULOG_INFO("write(fd, &deadc0de, sizeof(deadc0de)) returned '%u'\n", sz);
+       close(fd);
+ 
+       if (sz != 4) {
root@(none):/# firstboot 
[   11.939860] jffs2reset: This will erase all settings and remove any installed packages. Are you sure? [N/y]
y
[   15.513207] jffs2reset: /dev/ubi0_1 is not mounted
[   15.513308] jffs2reset: /dev/ubi0_1 will be erased on next mount
[   15.516941] jffs2reset: write(fd, &deadc0de, sizeof(deadc0de)) returned '4294967295'
[   15.523153] jffs2reset: writing /dev/ubi0_1 failed: Operation not permitted

"-1" return value (32 bits)

Mirko Parthey commented on 11.04.2019 16:42

I can confirm the problem with firstboot for the BT Home Hub 5A and a current OpenWrt snapshot (r9851-d1739c6c9a).

jffs2reset was made for a different filesystem. Please try this instead:

ubiupdatevol /dev/ubi0_2 -t

To find the right ubi volume to wipe out:

grep rootfs_data /sys/devices/virtual/ubi/ubi0/*/name
Jeff Kletsky commented on 11.06.2019 22:53

The core of the problem here is that writing a JFFS2 mark to a UBIFS volume doesn't make any sense.

Jeff Kletsky commented on 12.06.2019 00:32

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing