Fail to do syspupgrade on my own developing device, why?

Hi @tomn,

Error number is 2. Let me dig in. Thanks.

error: 2
Failed to exec upgraded.
Command failed: Unknown error
2.ENOENT : No such file or directory

Hi @tomn @anon50098793

I can reproduce this issue by following code.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char *argv[])
{
    chroot("/tmp/root");
    char *args[] = { "/sbin/upgraded", "/tmp/openwrt-sysupgrade.img", "/lib/upgrade/do_stage2", NULL};
    execvp(args[0], args);
    fprintf(stderr, "errno %d\n", errno);
    return 0;
}

At /tmp/root folder, we only have /sbin/upgraded. Does it depend on libc.so?

# ls -al /tmp/root/
drwxr-xr-x    5 root     root           100 Feb 15 15:55 .
drwxrwxrwt   18 root     root           520 Feb 15 15:43 ..
drwxr-xr-x    2 root     root            60 Feb 15 15:32 sbin

Do you guys have experiences on debug working flow after calling chroot?

By the way, do you know what components must have in /tmp/root?
Thanks.

Looks like my device did not have ldd tool and did not support LD_TRACE_LOADED_OBJECTS form toolchain.
Is it possible to build from OpenWrt package? Thanks.

this is not a 'device' related feature... its part of standard base files...

Great, this feels like progress.

It might be helpful to know a bit more about how the image that you are upgrading from was generated. Specifically: which version of openwrt, and if you've compiled your own kernel, which version and what configuration options did you use?

1 Like

Yes, you are right. It is base files from toolchain.
Our platform is based on uclibc, maybe it is the problem.

Hi @tomn,

We base on branch 19.07.7 and kernel version is 4.9.
Please check the kernel config.
Thanks.

mentioning this at the start in addition to the uClib stuff would have saved us all alot of time...

custom stuff = custom solutions...

good luck with that...

out of interest...

  • are you getting paid for what you are doing?
  • are you planning on upstreaming any of that?
1 Like

Please compare your enabled options with those in target/linux/generic/config-xxx

There are a few which seem suspicious, maybe:

CONFIG_USER_NS
CONFIG_UNIX_SCM
CONFIG_TMPFS_POSIX_ACL
CONFIG_FS_POSIX_ACL
CONFIG_POSIX_TIMERS
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW
CONFIG_NAMESPACES
CONFIG_FHANDLE

1 Like

Hi @tomn,

Thanks. I will double check it later. ^^

Hi @anon50098793

I'm sorry about that. For my understanding, OpenWrt support both glibc and uclibc standard library.
I don't understand why if I mentioned early would have saved us a lot of time?
Could you please kindly explain to me? Let would be great and thanks.

Honestly, what we are doing is a startup project in our company. We only have two guys in this team. We would like to delivery rich open source building system(OpenWrt+Jenkins+Pytest+Slack) into our company, if possible, integrate all products we have(Router, Switch, Camera, xDSL). Of course, in the future, we would like to share our results to upstreaming, but you should know, we need our boss say yes. I hope this is clear for you. Thanks. Have a good weekend.^^

1 Like

transparency is good... i appreciate it... (as i'm sure do others)

i'm as much at fault here assuming that your are working with a recent development branch (which is the normal way of developing for new devices) and typical codebase...

when you work with non-typical stuff... you need non-typical answers... (or need to find your own)

1 Like

Hi @anon50098793 and @tomn

Finally, we have final solution. Vendor provide us new toolchain with correct LD_TRACE_LOADED_OBJECTS function. Sysupgrade looks good for now.
Thanks a lot, many appreciate.

I see. I didn't spot that at the top of upgrade/common.sh. Thanks for letting us know how it worked out.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.