Mailing List Archive

cross building into custom SYSROOT with non root user ?
I am trying to get this old dream to fly again:
Building a root fs in my own sysroot (other that /usr/CHOST ) as a normal
user because the
good old /usr/CHOST as root doesn't really fly in a multi developer
project where people expect to
be able build stuff as a normal user and being able to have multiple
versions of root fs installed.

I could not even build glibc:
> SYSROOT=/usr/local/src/X-5000/root
PKGDIR=/usr/local/src/X-5000/overlay/packages
DISTDIR=/usr/local/src/X-5000/overlay/distfiles
ROOT=/usr/local/src/X-5000/root emerge-x86_64-tm-linux-gnu -a --nodeps
sys-libs/glibc
....
/usr/bin/install: cannot change ownership of
'/usr/x86_64-tm-linux-gnu/tmp/portage/sys-libs/glibc-2.17/image//usr/lib/misc/glibc/pt_chown':
Operation not permitted

I got fakeroot installed but seems like emerge ignores that somehow.
Is this just a futile dream still?

Jocke
Re: cross building into custom SYSROOT with non root user ? [ In reply to ]
Joakim Tjernlund wrote:
> I am trying to get this old dream to fly again:
> Building a root fs in my own sysroot (other that /usr/CHOST ) as a normal user

Yay, that would be very nice.


> I could not even build glibc:
> > SYSROOT=/usr/local/src/X-5000/root
> PKGDIR=/usr/local/src/X-5000/overlay/packages
> DISTDIR=/usr/local/src/X-5000/overlay/distfiles
> ROOT=/usr/local/src/X-5000/root emerge-x86_64-tm-linux-gnu -a --nodeps
> sys-libs/glibc
> ....
> /usr/bin/install: cannot change ownership of
> '/usr/x86_64-tm-linux-gnu/tmp/portage/sys-libs/glibc-2.17/image//usr/lib/misc/glibc/pt_chown': Operation not permitted

pt_chown is a bit of a special case and it does come with an --enable
switch in configure. Did you try using --disable-pt_chown ? I guess
the program isn't really needed in an embedded system and besides
"It is not built by default because systems using the Linux kernel
are commonly built with the `devpts' filesystem enabled and mounted
at `/dev/pts', which manages pseudo-terminal ownership automatically."

glibc.git/login/Makefile hardcodes the -m 4755 parameter to install.
I can imagine that a few system packages would take such liberties,
but hopefully it isn't strictly neccessary if we can specify
carefully what we actually want to build.


> I got fakeroot installed but seems like emerge ignores that somehow.
> Is this just a futile dream still?

Dunno - since you have the setup maybe you can try disabling pt_chown
and see how far that takes you? I'm very interested in your results.


Thanks

//Peter
Re: cross building into custom SYSROOT with non root user ? [ In reply to ]
Peter Stuge <peter@stuge.se> wrote on 2013/10/22 04:35:52:
>
> Joakim Tjernlund wrote:
> > I am trying to get this old dream to fly again:
> > Building a root fs in my own sysroot (other that /usr/CHOST ) as a
normal user
>
> Yay, that would be very nice.
>
>
> > I could not even build glibc:
> > > SYSROOT=/usr/local/src/X-5000/root
> > PKGDIR=/usr/local/src/X-5000/overlay/packages
> > DISTDIR=/usr/local/src/X-5000/overlay/distfiles
> > ROOT=/usr/local/src/X-5000/root emerge-x86_64-tm-linux-gnu -a --nodeps

> > sys-libs/glibc
> > ....
> > /usr/bin/install: cannot change ownership of
> >
'/usr/x86_64-tm-linux-gnu/tmp/portage/sys-libs/glibc-2.17/image//usr/lib/misc/glibc/pt_chown':
Operation not permitted
>
> pt_chown is a bit of a special case and it does come with an --enable
> switch in configure. Did you try using --disable-pt_chown ? I guess
> the program isn't really needed in an embedded system and besides
> "It is not built by default because systems using the Linux kernel
> are commonly built with the `devpts' filesystem enabled and mounted
> at `/dev/pts', which manages pseudo-terminal ownership automatically."
>
> glibc.git/login/Makefile hardcodes the -m 4755 parameter to install.
> I can imagine that a few system packages would take such liberties,
> but hopefully it isn't strictly neccessary if we can specify
> carefully what we actually want to build.
>
>
> > I got fakeroot installed but seems like emerge ignores that somehow.
> > Is this just a futile dream still?
>
> Dunno - since you have the setup maybe you can try disabling pt_chown
> and see how far that takes you? I'm very interested in your results.

FEATURES=fakeroot seems broken (or some profile data is missing)
However I got a bit further, doing just:
./sysroot-ebuild /usr/portage/sys-apps/busybox/busybox-1.21.1.ebuild
--debug install
fails too until one add
PORTAGE_INST_UID=$(id -u)
PORTAGE_INST_GID=$(id -g)
somehow these are unset doing cross builds so install thinks it should
change owner to root.
Add this to cross-emerge? How about adding an explicit cross-ebuild too?

BTW, cat sysroot-ebuild:
: ${CROSS_CMD:=ebuild}
CHOST=x86_64-tm-linux-gnu
PORTAGE_INST_UID=$(id -u)
PORTAGE_INST_GID=$(id -g)
export PORTAGE_INST_UID PORTAGE_INST_GID
#SYSROOT=/usr/local/src/X-5000/root
#PORTAGE_CONFIGROOT=/usr/local/src/X-5000/configroot
#export SYSROOT PORTAGE_CONFIGROOT

export CROSS_CMD CHOST
cross-emerge "$@"

Jocke
Re: cross building into custom SYSROOT with non root user ? [ In reply to ]
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote on 2013/10/22
20:37:52:

> From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> To: gentoo-embedded@lists.gentoo.org,
> Date: 2013/10/22 20:38
> Subject: Re: [gentoo-embedded] cross building into custom SYSROOT with
non root user ?
>
> Peter Stuge <peter@stuge.se> wrote on 2013/10/22 04:35:52:
> >
> > Joakim Tjernlund wrote:
> > > I am trying to get this old dream to fly again:
> > > Building a root fs in my own sysroot (other that /usr/CHOST ) as a
> normal user
> >
> > Yay, that would be very nice.
> >
> >
> > > I could not even build glibc:
> > > > SYSROOT=/usr/local/src/X-5000/root
> > > PKGDIR=/usr/local/src/X-5000/overlay/packages
> > > DISTDIR=/usr/local/src/X-5000/overlay/distfiles
> > > ROOT=/usr/local/src/X-5000/root emerge-x86_64-tm-linux-gnu -a
--nodeps
>
> > > sys-libs/glibc
> > > ....
> > > /usr/bin/install: cannot change ownership of
> > >
>
'/usr/x86_64-tm-linux-gnu/tmp/portage/sys-libs/glibc-2.17/image//usr/lib/misc/glibc/pt_chown':

> Operation not permitted
> >
> > pt_chown is a bit of a special case and it does come with an --enable
> > switch in configure. Did you try using --disable-pt_chown ? I guess
> > the program isn't really needed in an embedded system and besides
> > "It is not built by default because systems using the Linux kernel
> > are commonly built with the `devpts' filesystem enabled and mounted
> > at `/dev/pts', which manages pseudo-terminal ownership automatically."
> >
> > glibc.git/login/Makefile hardcodes the -m 4755 parameter to install.
> > I can imagine that a few system packages would take such liberties,
> > but hopefully it isn't strictly neccessary if we can specify
> > carefully what we actually want to build.
> >
> >
> > > I got fakeroot installed but seems like emerge ignores that somehow.
> > > Is this just a futile dream still?
> >
> > Dunno - since you have the setup maybe you can try disabling pt_chown
> > and see how far that takes you? I'm very interested in your results.
>
> FEATURES=fakeroot seems broken (or some profile data is missing)
> However I got a bit further, doing just:
> ./sysroot-ebuild /usr/portage/sys-apps/busybox/busybox-1.21.1.ebuild
> --debug install
> fails too until one add
> PORTAGE_INST_UID=$(id -u)
> PORTAGE_INST_GID=$(id -g)
> somehow these are unset doing cross builds so install thinks it should
> change owner to root.
> Add this to cross-emerge? How about adding an explicit cross-ebuild too?
>
> BTW, cat sysroot-ebuild:
> : ${CROSS_CMD:=ebuild}
> CHOST=x86_64-tm-linux-gnu
> PORTAGE_INST_UID=$(id -u)
> PORTAGE_INST_GID=$(id -g)
> export PORTAGE_INST_UID PORTAGE_INST_GID
> #SYSROOT=/usr/local/src/X-5000/root
> #PORTAGE_CONFIGROOT=/usr/local/src/X-5000/configroot
> #export SYSROOT PORTAGE_CONFIGROOT
>
> export CROSS_CMD CHOST
> cross-emerge "$@"
>
> Jocke

See also bug:
https://bugs.gentoo.org/show_bug.cgi?id=489016
hopefully someone can solve the fakeroot problem too