piston icon indicating copy to clipboard operation
piston copied to clipboard

Error when running code: Must be ran as root

Open TheLostProgrammer opened this issue 11 months ago • 0 comments

System Information • Fedora Server 41 • Hosted on Raspberry Pi

Every time I go to run code, it just errors out. I check the logs for the piston container and I get the following:

2025-04-02T08:46:01.888Z [INFO]  job/e67e4393-d5a8-4483-bd65-f84a7bdd1340: Cleaning up job
2025-04-02T08:46:02.067Z [ERROR] job/e67e4393-d5a8-4483-bd65-f84a7bdd1340: Failed to remove the metadata directory of box #1. Error: ENOENT: no such file or directory, stat '/tmp/1-metadata.txt'
2025-04-02T08:46:02.211Z [ERROR] job/e67e4393-d5a8-4483-bd65-f84a7bdd1340: Failed to run isolate --cleanup: Command failed: isolate --cleanup --cg -b1
Must be started as root
 on box #1
stdout:
stderr: Must be started as root

This is the docker-compose for the API:

  api:
    image: ghcr.io/engineer-man/piston
    container_name: piston_api
    restart: always
    privileged: true
    user: root
    ports:
      - "2000:2000"
    volumes:
      - ./data/piston/packages:/piston/packages
    tmpfs:
      - /piston/jobs:exec,uid=1000,gid=1000,mode=711
      - /tmp:exec

Adding command: whoami to the docker-compose, I get the following output:

user@hostname ❯ sudo docker logs fbbf34a5a629
root
root
root
root
root
root

This shows that it is running as root which makes no sense to why it has Must be started as root.

Entering the isolate command within the container doesn't have any problem:

user@hostname ❯ sudo docker exec -it 46413f33d176 bash
root@46413f33d176:/piston_api# isolate --init
/var/local/lib/isolate/0
root@46413f33d176:/piston_api# isolate --cleanup
root@46413f33d176:/piston_api#

TheLostProgrammer avatar Apr 03 '25 06:04 TheLostProgrammer