Must not run with sudo while trying to create a runner using github-actions

Solution 1:

The env variable to use is RUNNER_ALLOW_RUNASROOT="1" You can :

  • Export it before running config.sh using export RUNNER_ALLOW_RUNASROOT="1"
  • Start config.sh like this : RUNNER_ALLOW_RUNASROOT="1" ./config.sh --url...

At the beginning of config.sh you can see the following test :

user_id=`id -u`
if [ $user_id -eq 0 -a -z "$RUNNER_ALLOW_RUNASROOT" ]; then
    echo "Must not run with sudo"
    exit 1
fi

user_id=`id -u` : Gets the uid of the current user and store it to user_id.
$user_id -eq 0 : Compare it with 0 (0 is the uid of root).
-a -z "$RUNNER_ALLOW_RUNASROOT" : -a -z Tests if the variable exists and is not empty.

So in our case we could do RUNNER_ALLOW_RUNASROOT="0" or even RUNNER_ALLOW_RUNASROOT="cool" and it would work but RUNNER_ALLOW_RUNASROOT="" would not work.

I'm curious what was your issue when you tryed to run it as a non-root user ?