#1 Build as non-root user

1.0
closed
Ingo
None
2018-03-09
2017-11-04
Anonymous
No

Originally created by: labi

Originally owned by: labi

Allow building as non-root user. Currently we need root, as we are using chroot.
After switching to fakechroot, we have the problem of non-native target systems. Then we are using qemu through binfmt, which simply doesn't work in combination with chroot.

The way how fakechroot works is preloading a wrapper library through LD_PRELOAD. So the following scenerio sounds valid:

fakechroot chroot rootfs/ /bin/bash

/bin/bash is a target binary, executed through binfmt.
chroot itself is still a host binary.

fakechroot will fixly preload it's wrapper.

We would need a few things:

  • When building a base system with debootstrap, we always need to corresponding libfakechroot.so fo the target.
  • In my opinion this library can be stored globally in a similar manner as debian_version.mk
  • When issuing the chroot, we need to switch LD_PRELOAD to the new folder

Note: We need to check if the permissions on the files will remain the same after we switched from the host to the target library. Because the command is in fact a bit more complex:

fakechroot bash -c "cd ...; tar -xf ...; chroot . ./.trg.sh; ..."

So we have the files created with the host version of libchfakeroot.so and then we execute the target binaries with the target version. Not sure if we can guarantee, that they are seeing the same file permissions, as I don't know where this information is stored.

Discussion

  • Ingo

    Ingo - 2018-03-09
    • Description has changed:

    Diff:

    
    
    • status: open --> closed
    • assigned_to: Ingo
     
  • Ingo

    Ingo - 2018-03-09

    Finally I now used Qemu.
    As everything else seemed to make the build more complicated, and therefore more error prone.
    I now had already problems with host dependencies. They would have become even more with another non-root solution, like fakechroot.

    Additionally: This solution can even run on Windows!!! ;)

     

Log in to post a comment.