Skip to content

Conversation

stkw0
Copy link
Collaborator

@stkw0 stkw0 commented Jul 29, 2025

No description provided.

stkw0 added 2 commits July 29, 2025 16:57
In batch mode we don't drop into a shell. Therefore, it's safe to mount
it as read-only as no modifications would happen.
@stkw0 stkw0 requested a review from nicolasbock as a code owner July 29, 2025 15:14
@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 29, 2025

@kuraga can you test if this changes helps with #237? I tried to test it with podman using a portage dir which had root:root and it worked for me.

It also mounts portage dir as RO if --batch is used.

Copy link
Owner

@nicolasbock nicolasbock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +164 to +167
if options.OPTIONS.batch:
portdir_opt = "ro"
else:
portdir_opt = "rw"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if options.OPTIONS.batch:
portdir_opt = "ro"
else:
portdir_opt = "rw"
portdir_opt = "ro" if options.OPTIONS.batch else "rw"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but seemed less readable

"--volume", "%s:/var/db/repos/gentoo" % local_portage,
"--volume", "%s:/var/cache/distfiles" % distdir,
"--volume", "%s:/var/cache/binpkgs" % pkgdir]
"--volume", f"{portdir}:/var/db/repos/gentoo:{portdir_opt}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note there are three types of string interpolation at the code of this patch.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @kuraga . Would be nice to streamline that and use one form throughout.

@kuraga
Copy link
Contributor

kuraga commented Jul 29, 2025

@kuraga can you test if this changes helps with #237? I tried to test it with podman using a portage dir which had root:root and it worked for me.

@stkw0 , no, it doesn't fix for me.

UPDATE: But it will work if the host user is root and the host's {portdir}/**/* are owned by portage:portage (what wasn't_ a workaround before this PR).

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 29, 2025

@kuraga can you test if this changes helps with #237? I tried to test it with podman using a portage dir which had root:root and it worked for me.

@stkw0 , no, it doesn't fix for me.

UPDATE: But it will work if the host user is root and the host's {portdir}/**/* are owned by portage:portage (what wasn't_ a workaround before this PR).

Can you share full logs? I was running it in a user which is not root and the host portdir was als not portage:portage and it worked fine. I would like to be able to reproduce your problem. Maybe can be interesting to know the version of podman you are using and if there is something special about your setup

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

@stkw0 ,

the host user is sasha.


  1. /home/sasha/gentoo/*/** are sasha:sasha: exactly /var/db/repos/gentoo's file permissions #237:
$ ebuildtester --portage-dir /home/sasha/gentoo --docker-command podman --docker-image docker.io/gentoo/stage3 --rm --atom app-editors/nano
<...>
2025-07-30 14:53:50,517 - creating docker container with: podman create --tty --cap-add CAP_SYS_ADMIN --cap-add CAP_MKNOD --cap-add CAP_NET_ADMIN --security-opt apparmor:unconfined --device /dev/fuse --workdir /root --volume /home/sasha/
gentoo:/var/db/repos/gentoo:rw --volume /home/sasha/.cache/ebuildtester/distfiles:/var/cache/distfiles --volume /home/sasha/.cache/ebuildtester/packages:/var/cache/binpkgs docker.io/gentoo/stage3                                          
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers                                                                                                                                     
<...>
2025-07-30 14:53:55,761 - 70613c (stdout): These are the packages that would be merged, in order:                     
2025-07-30 14:53:55,761 - 70613c (stdout):                                                                                                                                                                                                   
2025-07-30 14:53:55,896 - 70613c (stderr): /usr/lib/portage/python3.13/ebuild.sh: line 625: /var/db/repos/gentoo/app-alternatives/yacc/yacc-1-r2.ebuild: Permission denied                                                                   
2025-07-30 14:53:55,897 - 70613c (stderr):                                                                                                                                                                                                   
2025-07-30 14:53:55,897 - 70613c (stderr): Messages for package app-alternatives/yacc-1-r2::gentoo:                                                                                                                                          
2025-07-30 14:53:55,897 - 70613c (stderr):  * ERROR: app-alternatives/yacc-1-r2::gentoo failed (depend phase):                                                                                                                               
2025-07-30 14:53:55,899 - 70613c (stderr):  *   error sourcing ebuild                                                                                                                                                                        
2025-07-30 14:53:55,900 - 70613c (stderr):  *                                                                                                                                                                                                
2025-07-30 14:53:55,901 - 70613c (stderr):  * Call stack:                                                                                                                                                                                    
2025-07-30 14:53:55,905 - 70613c (stderr):  *   ebuild.sh, line 625:  Called die                                                                                                                                                             
2025-07-30 14:53:55,906 - 70613c (stderr):  * The specific snippet of code:                                                                                                                                                                  
2025-07-30 14:53:55,916 - 70613c (stderr):  *                           source "${EBUILD}" || die "error sourcing ebuild"                                                                                                                    
2025-07-30 14:53:55,918 - 70613c (stderr):  *                                                                                                                                                                                                
2025-07-30 14:53:55,919 - 70613c (stderr):  * If you need support, post the output of `emerge --info '=app-alternatives/yacc-1-r2::gentoo'`,                                                                                                 
2025-07-30 14:53:55,921 - 70613c (stderr):  * the complete build log and the output of `emerge -pqv '=app-alternatives/yacc-1-r2::gentoo'`.                                                                                                  
2025-07-30 14:53:55,924 - 70613c (stderr):  * Working directory: '/usr/lib/python3.13/site-packages'                                                                                                                                         
2025-07-30 14:53:55,925 - 70613c (stderr):  * S: '/var/tmp/portage/app-alternatives/yacc-1-r2/work/yacc-1'                                                                                                                                   

Inside the container:

70613c81d60b ~ # ls -al /var/db/repos/gentoo/app-alternatives/yacc/                
total 16
drwxr-x---  2 root root 4096 Jul 11 17:42 .
drwxr-x--- 13 root root 4096 Jul 11 17:42 ..
-rw-r-----  1 root root  610 Jul 11 17:42 metadata.xml
-rw-r-----  1 root root 1137 Jul 11 17:42 yacc-1-r2.ebuild

  1. As an addition, /home/sasha/gentoo/*/** are portage:portage (as the Handbook says):
$ ebuildtester --portage-dir /home/sasha/gentoo --docker-command podman --docker-image docker.io/gentoo/stage3 --rm --batch --atom app-editors/nano
2025-07-30 13:53:24,876 - logging at /tmp/ebuildtester-app-editors-nano.log
2025-07-30 13:53:24,876 - *** please note that all necessary licenses will be accepted ***
2025-07-30 13:53:24,876 - creating container
2025-07-30 13:53:24,876 - creating docker container with: podman create --tty --cap-add CAP_SYS_ADMIN --cap-add CAP_MKNOD --cap-add CAP_NET_ADMIN --security-opt apparmor:unconfined --device /dev/fuse --workdir /root --volume /home/sasha/gentoo:/var/db/repos/gentoo:ro --volume /home/sasha/.cache/ebuildtester/distfiles:/var/cache/distfiles --volume /home/sasha/.cache/ebuildtester/packages:/var/cache/binpkgs docker.io/gentoo/stage3
2025-07-30 13:53:24,965 - container id 48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:25,059 - setting Gentoo profile to default/linux/amd64/23.0
2025-07-30 13:53:25,059 - 48092a eselect profile set default/linux/amd64/23.0
2025-07-30 13:53:25,511 - 48092a (stderr): !!! Error: get_repo_path failed
2025-07-30 13:53:25,565 - running in container 48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:25,565 - failed command "eselect profile set default/linux/amd64/23.0"
2025-07-30 13:53:25,566 - no global USE flags given, skipping
2025-07-30 13:53:25,566 - tweaking portage settings
2025-07-30 13:53:25,566 - 48092a echo FEATURES=\"-sandbox -usersandbox userfetch\" >> /etc/portage/make.conf
2025-07-30 13:53:25,676 - 48092a echo MAKEOPTS=\"-j16\" >> /etc/portage/make.conf
2025-07-30 13:53:25,851 - 48092a echo "C.UTF-8 UTF-8" > /etc/locale.gen
2025-07-30 13:53:26,026 - enabling test feature for [Atom("app-editors/nano")]
2025-07-30 13:53:26,026 - 48092a mkdir -p /etc/portage/env
2025-07-30 13:53:26,190 - 48092a echo "app-editors/nano tester.conf" >> /etc/portage/package.env
2025-07-30 13:53:26,354 - 48092a echo "FEATURES=\"test splitdebug\"" > /etc/portage/env/tester.conf
2025-07-30 13:53:26,539 - unmasking [Atom("app-editors/nano")]
2025-07-30 13:53:26,539 - 48092a mkdir -p /etc/portage/package.accept_keywords
2025-07-30 13:53:26,675 - 48092a echo "app-editors/nano" ~amd64 >> /etc/portage/package.accept_keywords/testbuild
2025-07-30 13:53:26,780 - unmasking additional atoms
2025-07-30 13:53:26,780 - skipping update
2025-07-30 13:53:26,780 - skipping basic packages
2025-07-30 13:53:26,780 - setting gcc
2025-07-30 13:53:26,780 - summary
2025-07-30 13:53:26,780 - 48092a if [[ -d /etc/portage/package.accept_keywords ]]; then cat /etc/portage/package.accept_keywords/*; fi
2025-07-30 13:53:26,855 - 48092a (stdout): app-editors/nano ~amd64
2025-07-30 13:53:26,932 - 48092a if [[ -f /etc/portage/package.use/testbuild ]]; then cat /etc/portage/package.use/testbuild; fi
2025-07-30 13:53:27,058 - 48092a emerge --info
2025-07-30 13:53:27,411 - 48092a (stderr): Permission denied: '/var/db/repos/gentoo/eclass'
2025-07-30 13:53:27,493 - running in container 48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:27,493 - failed command "emerge --info"
2025-07-30 13:53:27,493 - 48092a qlop
2025-07-30 13:53:27,558 - 48092a (stderr): qlop: Could not open logfile '/var/log/emerge.log': No such file or directory
2025-07-30 13:53:27,600 - created container 48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:27,600 - 48092a echo emerge --verbose  --autounmask-write=y  --autounmask-license=y  --autounmask-continue=y  app-editors/nano --ask >> ~/.bash_history
2025-07-30 13:53:27,738 - emerge attempt 1 (of 5)
2025-07-30 13:53:27,738 - 48092a ['emerge', '--verbose ', '--autounmask-write=y ', '--autounmask-license=y ', '--autounmask-continue=y ', 'app-editors/nano']
2025-07-30 13:53:28,109 - 48092a (stderr): Permission denied: '/var/db/repos/gentoo/eclass'
2025-07-30 13:53:28,190 - running in container 48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:28,191 - failed command "['emerge', '--verbose ', '--autounmask-write=y ', '--autounmask-license=y ', '--autounmask-continue=y ', 'app-editors/nano']"
2025-07-30 13:53:28,191 - stopping container
48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411
2025-07-30 13:53:28,277 - deleting container
48092a2750f402df72d8d38c2b7bdb284b52d0e13d7f5bf5918327294ed0f411

Inside the container:

0cd52e4e8810 ~ # ls -al /var/db/repos/gentoo/eclass
ls: cannot access '/var/db/repos/gentoo/eclass': Permission denied
0cd52e4e8810 ~ # ls -al /var/db/repos/gentoo       
ls: cannot open directory '/var/db/repos/gentoo': Permission denied
0cd52e4e8810 ~ # ls -al /var/db/repos       
total 12
drwxr-xr-x   1 portage portage 4096 Jul 30 10:56 .
drwxr-xr-x   1 root    root    4096 Jul 27 17:31 ..
drwxr-x--- 182 nobody  nobody  4096 Jul 29 20:27 gentoo
0cd52e4e8810 ~ # ls -aln /var/db/repos       
total 12
drwxr-xr-x   1   250   250 4096 Jul 30 12:00 .
drwxr-xr-x   1     0     0 4096 Jul 27 17:31 ..
drwxr-x--- 182 65534 65534 4096 Jul 29 20:27 gentoo

Seems like it's expected: the host portage:portage (250:250) are mapped into the 65536, ... range.

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

I tried the same command as you, changing the repository path and it worked just fine. I have the permissions of my user.
Can you try to clone a fresh repository without touching the permissions? I will bet that playing with the permissions maybe some dirs don't have +x permissions or some files are not in the correct user/group.

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

@stkw0 , the same.

$ ls -aln gentoo/app-alternatives/yacc
total 16
drwxr-x---  2 1000 1000 4096 Jul 30 17:42 .
drwxr-x--- 13 1000 1000 4096 Jul 30 17:42 ..
-rw-r-----  1 1000 1000  610 Jul 30 17:42 metadata.xml
-rw-r-----  1 1000 1000 1137 Jul 30 17:42 yacc-1-r2.ebuild
$ id
uid=1000(sasha) gid=1000(sasha) groups=1000(sasha),10(wheel),27(video),100(users)
$ umask
0027
e0e843fe254a ~ # ls -aln /var/db/repos/gentoo/app-alternatives/yacc
total 16
drwxr-x---  2 0 0 4096 Jul 30 14:42 .
drwxr-x--- 13 0 0 4096 Jul 30 14:42 ..
-rw-r-----  1 0 0  610 Jul 30 14:42 metadata.xml
-rw-r-----  1 0 0 1137 Jul 30 14:42 yacc-1-r2.ebuild

Yours?

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

Also, did you run

usermod --add-subuids 10000-75535 sasha
usermod --add-subgids 10000-75535 sasha
podman system migrate 

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

@stkw0 , no. But:

# cat /etc/subuid
sasha:100000:65536
# cat /etc/subgid
sasha:100000:65536

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

$ umask
0027

This is the issue. And there is a fundamental problem I don't know yet how to solve. Basically, we could map the same UID and GID so the container has access to the same resources than the calling user. The problem then, is that emerge needs root to run and the options to map the same UID/GID are not present in docker, so even if we did it, then it would diverge between podman and docker, it would stop being a drop-in replacement.

If the same UID/GID are not used, then the container uses a different ones so they can not access to files that don't have +r

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

@stkw0 , What's your permission on an .ebuild-file?

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

@stkw0 , What's your permission on an .ebuild-file?

 ❱ /bin/ls -aln app-alternatives/yacc
total 8
drwxr-xr-x 1 1000 1000   56 jul 10 02:05 .
drwxr-xr-x 1 1000 1000  102 jul 10 02:05 ..
-rw-r--r-- 1 1000 1000  610 mar 22 13:09 metadata.xml
-rw-r--r-- 1 1000 1000 1137 jul 10 02:05 yacc-1-r2.ebuild

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

the options to map the same UID/GID are not present in docker

--userns, --uidmap/ --gidmap, --subuidname/--subgidname?

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

--userns=keep-id and --group-add keep-groups mainly, and the options to use a given UID/GID like --userns=keep-id:uid=0. I was playing with it, and could make it have access to the volume, but it was incompatible with docker.

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

Ok, thanks.

@kuraga
Copy link
Contributor

kuraga commented Jul 30, 2025

IMHO volumes/paths should be documented.
As such as :ro on --batch.

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 30, 2025

The ro on --batch should be transparent to the user. It's more an implementation detail. But I would agree it should go on the Changelog of the next release

The docker container creates the distfiles as "portage" user (UID 250)
in the host. This produces an error if then a container is launched as
podman. With this ugly hack we can get docker to fetch distfiles as the
calling user which avoids an error if then podman is used.
@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

@kuraga I just pushed an horrible hack which would help to make it compatible with podman.

Now, if you create a bash script like this

#!/bin/bash 

case "$1" in
        create) podman create  --userns=keep-id:uid=0 "${@:2}"
            ;;
	*) podman "$@"
	    ;;
esac

and use it instead of podman, it should work even if you have an umask of 0027.
I would doccument it later, but before I would be glad if you can play with it and see if it works or there is some other issue.

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

@stkw0 , I'm sure it works. Thanks very much for the investigation.

But I strictly vote to just add a requirement on permissions. Which would be up to the user.

But I don't know, which. Come back later.

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

Had an idea to add root to portage group in the container.
Doesn't work.

BTW, on the host:

$ ls -aln /var/db/repos/gentoo/app-alternatives/yacc
total 20
drwxr-xr-x  2 0 0 4096 июл  8 23:07 .
drwxr-xr-x 13 0 0 4096 июл 19 16:07 ..
-rw-r--r--  1 0 0  597 мар 20 15:38 Manifest
-rw-r--r--  1 0 0  610 мар 20 15:38 metadata.xml
-rw-r--r--  1 0 0 1137 мар 20 15:38 yacc-1-r2.ebuild

So, the owner is root!

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

@stkw0 , What's your permission on an .ebuild-file?

 ❱ /bin/ls -aln app-alternatives/yacc
total 8
drwxr-xr-x 1 1000 1000   56 jul 10 02:05 .
drwxr-xr-x 1 1000 1000  102 jul 10 02:05 ..
-rw-r--r-- 1 1000 1000  610 mar 22 13:09 metadata.xml
-rw-r--r-- 1 1000 1000 1137 jul 10 02:05 yacc-1-r2.ebuild

Another BTW:
it's not sufficient for me.
I need o+x permissions on .ebuilds, instead.

Which user does source at /usr/lib/portage/python3.13/ebuild.sh: line 625?!

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

Had an idea to add root to portage group in the container.
Doesn't work.

Yeah, if you don't use --userns=keep-id it would create a different UIDs which would mismatch

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

it's not sufficient for me.

did you create a podman wrapper script as I described above?

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

Had an idea to add root to portage group in the container.
Doesn't work.

Yeah, if you don't use --userns=keep-id it would create a different UIDs which would mismatch

It was instead about:

Which user does source at /usr/lib/portage/python3.13/ebuild.sh: line 625?!

(which groups does this user have?)
I thought about root, portage of the container, no matter which ids they have...

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

it's not sufficient for me.

did you create a podman wrapper script as I described above?

No, all my thoughts were without the new patch.

It works, I'm sure. But I wanna something cleaner :)

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

Instead of the wrapper, reading the manual I found you can use an env var. for userns This way you could configure it once and forget about it. While writing this I realized we could just export that env var before calling "docker" (or podman). As docker don't have it implemented, it will just be ignored, making it compatible with both :D

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

@stkw0 , What's your permission on an .ebuild-file?

 ❱ /bin/ls -aln app-alternatives/yacc
total 8
drwxr-xr-x 1 1000 1000   56 jul 10 02:05 .
drwxr-xr-x 1 1000 1000  102 jul 10 02:05 ..
-rw-r--r-- 1 1000 1000  610 mar 22 13:09 metadata.xml
-rw-r--r-- 1 1000 1000 1137 jul 10 02:05 yacc-1-r2.ebuild

Another BTW:
it's not sufficient for me.
I need o+x permissions on .ebuilds, instead.

Which user does source at /usr/lib/portage/python3.13/ebuild.sh: line 625?!

@stkw0 , can it be some "non-superuser" root in the container?

In the container, I need portage:portage ownership or o+x permissions.

On the host, under root, I don't need.

Why? Thanks.

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

No, a rootless podman container can not have an EUID=0 in the container, that would defear the purpose of a rootless container. It can have a root inside the container, but it's like a new user. I never used podman before, so I don't yet precisely how podman works under the hood

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

So yes, that's the case...

@stkw0 , does your patch require to start under root?

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

No, I tested it with normal rootless podman containers. The patch is just to trick docker into creating distfiles as the calling user instead of root, to make it compatible with podman. It doesn't helps with sourcing ebuilds from portdir. For that, the wrapper is needed.

@kuraga
Copy link
Contributor

kuraga commented Jul 31, 2025

Well, does wrapper need root?

@stkw0
Copy link
Collaborator Author

stkw0 commented Jul 31, 2025

No

@kuraga
Copy link
Contributor

kuraga commented Aug 1, 2025

--userns=keep-id and --group-add keep-groups mainly, and the options to use a given UID/GID like --userns=keep-id:uid=0. I was playing with it, and could make it have access to the volume, but it was incompatible with docker.

@stkw0 ,

  1. If on the host file is owned by the user starting the container, whom it is owned in the Docker container by?
  2. If on the host file is owned by root, whom it is owned in the Docker container by?
  3. If on the host file is owned by portage, whom it is owned in the Docker container by?

@stkw0
Copy link
Collaborator Author

stkw0 commented Aug 1, 2025

Assuming a rootless podman with --userns=keep-id:uid=0

  1. by root (the calling user is mapped to uid=0, root)
  2. nobody (is expected)
  3. nobody (I don't quite understand this)

Which is expected


# Avoid wasting time generating the whole set
self.execute('echo "C.UTF-8 UTF-8" > /etc/locale.gen')
self.execute(f'sed -i "s/250/{os.getuid()}/g" /etc/passwd')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolasbock can you check if this hack is acceptable? Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stkw0 Yes, that works. Nice hack 😄

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

Assuming a rootless podman with --userns=keep-id:uid=0

  1. by root (the calling user is mapped to uid=0, root)
  2. nobody (is expected)
  3. nobody (I don't quite understand this)

Which is expected

@stkw0 , I was asking about Docker. And without the hack.

But okay, I give up. The hack is required.

@stkw0
Copy link
Collaborator Author

stkw0 commented Aug 2, 2025

But okay, I give up. The hack is required.

in docker is more simple. It's just the same than in the host. A file owned by the user, in Docker is the UID of the user, a file owned by root is root and owned by portage would appear as owned by portage.

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

@stkw0 , @nicolasbock , I see four ways. three ways on Podman.
Don't know whether they work on Docker.

The first way.

The hack.

The second way.

2-A. We chown -R portage:portage inside.

2-B. Or the user does it by itself before start.

The third way.

The user have to

  1. Own the ${PORTAGE_DIR} contents.
  2. chmod -R o+rx ${PORTAGE_DIR} before the start.

The fourth way.

Different ways (from above) for Docker and Podman.

I'd like the third second, BTW ;)

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

But okay, I give up. The hack is required.

in docker is more simple. It's just the same than in the host. A file owned by the user, in Docker is the UID of the user, a file owned by root is root and owned by portage would appear as owned by portage.

@stkw0 , if so, the only sufficient item on Docker (without the hack!) is:

The user have to chown -R portage:portage ${PORTAGE_DIR} before start.

@stkw0
Copy link
Collaborator Author

stkw0 commented Aug 2, 2025

Docker doesn't need to chown or anything. It just works. It's rootless podman and the ability to reuse distfiles/pkgfiles created by Docker in a rootless podman what is troublesome.

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

Ha, yes. Even so.

@stkw0 , why not just chown -R portage:portage /var/db/repos/gentoo inside the container?
Without other hacks.

I thought we need rootFUL for this.
But seems like we don't.

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

@stkw0 wrote in IRC chat:

chown of the local portage dir would be a hassle if I then want to work in that repo as a user...

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

@stkw0 , I guess you mean "to work after ebuildtester finishes".

Well, yes. But we already pollute the repo directory.

Ok, on your choice.

@stkw0
Copy link
Collaborator Author

stkw0 commented Aug 2, 2025

Well, yes. But we already pollute the repo directory.

How so?

@kuraga
Copy link
Contributor

kuraga commented Aug 2, 2025

Well, yes. But we already pollute the repo directory.

How so?

In non---batch mode we mount in rw and modify the directory.

@stkw0
Copy link
Collaborator Author

stkw0 commented Aug 2, 2025 via email

@kuraga
Copy link
Contributor

kuraga commented Aug 8, 2025

BTW, I realize now that even for Podman --userns is global.
So we can't get portage:portage for one directory only in the container (just after the mount) until it would have owned by a separate user on the start.

#245 (comment) has been updated.

@kuraga
Copy link
Contributor

kuraga commented Sep 10, 2025

Any updates?

@stkw0
Copy link
Collaborator Author

stkw0 commented Sep 11, 2025

Any updates?

I wanted to improve it adding what I commented about the env var to have a cleaner solution, but I didn't had time and will probably not have time until the end of the month

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

Successfully merging this pull request may close these issues.

3 participants