For issue 594, <@UQ7M19YHJ> has a potential fix
# geodesic
e
For issue 594, @Mike Crowe has a potential fix
🙏 1
m
@Erik Osterman (Cloud Posse) @Jeremy (UnderGrid Network Services) Originally, I was trying to add a docker argument as follows:
Copy code
if [ "${OS}" == 'Linux' ]; then
		DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
	fi
This works ok, but you can't sudo. I next have tested:
Copy code
if [ "${OS}" == 'Linux' ]; then
		DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
		DOCKER_ARGS+=(--volume="/etc/group:/etc/group" --volume="/etc/passwd:/etc/passwd" --volume="/etc/shadow:/etc/shadow")
	fi
which also works, but it borks your groups in the docker container. You can
sudo
properly, but the system isn't quite right. @rb may be onto a better method, which would look like the following: • Update the docker image to run as a user with sudo privileges for everybody. I know this is a process change, but I think it's actually a good idea:
Dockerfile:
Copy code
RUN \
  groupadd -g 1000 geouser && \
  useradd -d /conf -G sudo -g geouser -u 1000 geouser && \
  sed -i 's/sudo[[:space:]]ALL=(ALL:ALL) ALL/sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers

RUN chown -R 1000:1000 /conf /usr/local/bin /home /var/tmp
• Update for Linux (and Darwin, IMO -- please jump in if you disagree)
templates/wrapper:
Copy code
if [ "${OS}" == 'Linux' ]; then
		DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
	fi
• We would need to update the Documentation website to show the run line of:
Copy code
docker run -it --rm --user="$(id -u):$(id -g)" --volume $HOME:/localhost cloudposse/geodesic:latest-debian --login
I think this will be pretty universal, though we may need to add a notation to remove that for WSL? I haven't used WSL in ages, so I'm not sure if it supports
id -u
j
I don't know much about the original version of WSL as I had never really used it personally, with WSL2 it is for all intents a Hyper-V VM of whatever guest OS you're running (Ubuntu, Debian, etc) with a custom kernel so all your typical commands are going to execute.
id -u
and
id -g
work fine under WSL2. This is, from what I've gathered, much different with WSL2 than originally as WSL2 has an virtual hard drive image and the Windows drives are mounted under /mnt/<drive letter> by default though this mountpoint could be changed in the /etc/wsl.conf if it is created inside the WSL guest itself. The initial user that is created for inside WSL does use UID:GID 1000:1000.
I do have multiple WSL guests (Ubuntu and Debian) that are using WSL2 so I can't confirm if this works on WSLv1 or only WSL2 which could be a way to determine the different environments. But on both my WSL2 images there is the
WSL_DISTRO_NAME
env variable. The
HOME
env variable does point to the user home directory under WSL not Windows. The Windows mount points are all of type
9p
not
drvfs
as the
templates/wrapper
currently looks for. While
uname -r
will include
Microsoft
if you use case-insensitive matching (ie-
5.10.60.1-microsoft-standard-WSL2
) that
elif
block doesn't seem to be reached when running under WSL2. Nor does the
templates/wrapper
account for situations where the Windows User home directories are on a drive other than
C:\Users
as in my case where it is actually
H:\Users
.
j
@rb @Mike Crowe @Jeremy (UnderGrid Network Services) I published my BindFS proposed solution as a comment on issue #594 and I am eager to have someone try it and report back. I don't have access to appropriate platforms on which to test it myself.
@rb @Mike Crowe @Jeremy (UnderGrid Network Services) Please try Geodesic release candidate v0.152.0-rc1 and report back.
@rb @Mike Crowe @Jeremy (UnderGrid Network Services) OK, I have not been able to reproduce and fix the problem, so I need more information from you. This is not an issue with Docker v20 on Ubuntu (tested on 20.04 LTS) when running in [rootless mode](https://docs.docker.com/engine/security/rootless/). As with macOS, this configuration correctly translates file ownership between the root UID and GID inside the container to the user's UID and GID on the host. When running Docker as root, and launching Geodesic using
sudo geodesic
, the geodesic wrapper does not get the user's UID and GID or home directory, so BindFS does not help and we do not get the right home directory mapped to
/localhost
anyway. How are you launching Geodesic? Are you able to find the non-root user's UID, GID, and $HOME?