2

I am trying to run buildroot with root user. Even after setting FORCE_UNSAFE_CONFIGURE=1 as export FORCE_UNSAFE_CONFIGURE=1 I still get configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check).

When I try to run buildroot without root user I get some error related to fakeroot

Can some please guide me if running as root why even after running command export FORCE_UNSAFE_CONFIGURE=1 I still getting configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check) See config.log' for more details`

How to fix it with root user so I can run buildroot

the error message also says look at the config.log file.What I like to know I ran export FORCE_UNSAFE_CONFIGURE=1 command but I could not find FORCE_UNSAFE_CONFIGURE=1 in cache variables of config.log

This is also printed in config.log

#define GNULIB_TEST_MKFIFOAT 1
| #define GNULIB_TEST_MKNODAT 1
| /* end confdefs.h.  */
| #include <sys/stat.h>
|              #include <unistd.h>
| 
|              /* Copied from root-uid.h.  FIXME: Just use root-uid.h.  */
|              #ifdef __TANDEM
|              # define ROOT_UID 65535
|              #else
|              # define ROOT_UID 0
|              #endif
| 
| int
| main ()
| {
| /* Indeterminate for super-user, assume no.  Why are you running
|          configure as root, anyway?  */
|       if (geteuid () == ROOT_UID) return 99;
|       if (mknod ("conftest.fifo", S_IFIFO | 0600, 0)) return 2;
|   ;
|   return 0;
| }
configure:25690: error: in `/home/ubuntu/qemuD/build/output/build/host-tar-1.29':
configure:25692: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details

##

Can I remove check root varification and allow root running buildroot in some buildroot code like in some python file or something.

Also please tell what is fakeroot. if I dont run as root user then it cause some error about fakeroot. Is it an additional thing that I need to install in ubuntu where I am running and executing buildroot. Or is it part of buildroot. So for that just few words

Update

If I do not run as root and run commands

make host-tar-dirclean
make

I get following error. I like to know how to debug or troubleshoot this error. I mean if following error u would have faced what would u do. And any explanation. Tnanks

In file included from libfakeroot.c:60:
communicate.h:209:44: note: expected ‘struct stat64 *’ but argument is of type ‘struct stat *’
  209 | extern void send_get_stat64(struct stat64 *buf);
      |                             ~~~~~~~~~~~~~~~^~~
libtool: link: /usr/bin/gcc -O2 -I/home/ubuntu/abc/buildroot-2020.02.3/output/host/include -Wl,-rpath -Wl,/home/ubuntu/abc/buildroot-2020.02.3/output/host/lib -o simple simple.o  -L/home/ubuntu/abc/buildroot-2020.02.3/output/host/lib -ldl
make[4]: *** [Makefile:652: libfakeroot.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
libtool: link: /usr/bin/ar cru .libs/libmacosx.a .libs/libfakeroot_inode64.o .libs/libfakeroot_unix2003.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: /usr/bin/ranlib .libs/libmacosx.a
libtool: link: ( cd ".libs" && rm -f "libmacosx.la" && ln -s "../libmacosx.la" "libmacosx.la" )
make[3]: *** [Makefile:670: all-recursive] Error 1
make[2]: *** [Makefile:445: all] Error 2
make[1]: *** [package/pkg-generic.mk:269: /home/ubuntu/abc/buildroot-2020.02.3/output/build/host-fakeroot-1.20.2/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
ubuntu@this:~/abc/buildroot-2020.02.3$ 
user786
  • 3,902
  • 4
  • 40
  • 72

1 Answers1

4

First of all: don't build as root. It's just a bad idea.

The error doesn't come from Buildroot, it comes from the tar package.

FORCE_UNSAFE_CONFIG is not a cache variable so it doesn't appear in config.log.

It should work with that environment variable set. Have you tried:

export FORCE_UNSAFE_CONFIGURE=1
make host-tar-dirclean
make

fakeroot is a tool do be able to fake a few things that normally only root can do: set file ownership, create device nodes, etc. The faked files can then be added to a tar archive or to a generated filesystem.

fakeroot had a "bug" that it was using the glibc-internal macro _STAT_VER. This macro was removed in glibc-2.33. Ubuntu 21.04 (hirsute) is using glibc-2.33. A patch to fix this is included in the maintained Buildroot branches. Update to a supported Buildroot release to fix this problem (or downgrade your build environment to an Ubuntu version that was current in 2020).

Arnout
  • 2,927
  • 16
  • 24
  • please see the update to my question. now I am getting kind of unknown compile time error when buildroot includes `communicate.h:209:44: note: expected ‘struct stat64 *’ but argument is of type ‘struct stat *’ 209 | extern void send_get_stat64(struct stat64 *buf); | ~~~~~~~~~~~~~~~^~~` – user786 Sep 02 '21 at 10:42
  • this is obviously difficult error to understand since I really dont have the C code of Buildroot. There is something is done in Builtroot code that is causing error – user786 Sep 02 '21 at 10:44
  • Edited answer to explain the fakeroot issue. – Arnout Sep 02 '21 at 14:17
  • Thanks for the answer. I ran again. It worked. It was tar package error. Now running without root. Can u please tell can I share small program to embedded linux running with qemu. What is the way of doing it? I have compiled the program with qemu_linux_versatile_gcc. Now I like to run it in embedded linux running in qemu – user786 Sep 02 '21 at 14:57
  • @Arnout You said, "don't build as root. It's just a bad idea." if I am running in a docker image which is ephemeral and I will delete as soon as the build is done. Does it really matter if I am root? Many CICD systems will run these things in docker as root. – 24HourPhysicist Apr 07 '23 at 20:27
  • Inside a docker container it's still not a great idea to run as root, because there are various ways that a container can be escaped from. It's not as bad though. That said, as stated above: it's not Buildroot itself that enforces to build as not-root, it's GNU tar. – Arnout Apr 09 '23 at 12:46