Skip to content

tailscaled-entrypoint: use sh compatible syntax for redirecting output #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

rhettg
Copy link

@rhettg rhettg commented Jul 22, 2023

When running as a non-root user the command is run under sh and so should use less fancy methods of redirecting output.

This results in codespaces running as non-root users failing to start tailscaled at startup:

@rhettg ➜ /workspaces/mcc (rhettg-configure-tailscale) $ sudo tailscale up --accept-routes
failed to connect to local tailscaled; it doesn't appear to be running (sudo systemctl start tailscaled ?)
@rhettg ➜ /workspaces/mcc (rhettg-configure-tailscale) $ ps aux | grep tailscaled
codespa+       1  0.0  0.0   1136     4 ?        Ss   17:53   0:00 /sbin/docker-init -- /bin/sh -c echo Container started trap "exit 0" 15 /usr/local/share/ssh-init.sh /usr/local/share/docker-init.sh /usr/local/sbin/tailscaled-entrypoint exec "$@" while sleep 1 & wait $!; do :; done - /usr/local/share/docker-init.sh /usr/local/share/ssh-init.sh sleep infinity
codespa+   20252  0.0  0.0   8172  2508 pts/3    S+   18:04   0:00 grep --color=auto tailscaled
@rhettg ➜ /workspaces/mcc (rhettg-configure-tailscale) $ /usr/local/sbin/tailscaled-entrypoint
++ id -u
+ [[ 1000 -eq 0 ]]
+ command -v sudo
+ exec
+ sudo --non-interactive sh -c 'mkdir -p /workspaces/.tailscale ; /usr/local/sbin/tailscaled \
    --statedir=/workspaces/.tailscale/ \
    --socket=/var/run/tailscale/tailscaled.sock \
    --port=41641 >& /dev/null'
sh: 4: Syntax error: Bad fd number

This is a minimal/less complete version of #22 which solved my immediate problem of the feature not running tailscaled at startup.

I will not be offended by closing this in preference to #22 or any other approach that solves this in upstream without my name on it.

When running as non-root user the command is run under `sh` and so should use less fancy methods of redirecting output.
raggi added a commit that referenced this pull request Mar 6, 2024
raggi added a commit that referenced this pull request Mar 6, 2024
@raggi raggi closed this in #32 Mar 6, 2024
raggi added a commit that referenced this pull request Mar 6, 2024
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.

1 participant