Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
openwrt-bot opened this issue Feb 5, 2017 · 6 comments
Closed
Labels

Comments

@openwrt-bot
Copy link

Mijzelf:

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

@openwrt-bot
Copy link
Author

techsolx:

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.

@openwrt-bot
Copy link
Author

jeffsf:

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

@openwrt-bot
Copy link
Author

jeffsf:

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) {</code>
    
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)

@openwrt-bot
Copy link
Author

mpa:

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

@openwrt-bot
Copy link
Author

jeffsf:

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

@openwrt-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant