Skip to content
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

"Error Util.cpp:86: Operation not permitted" error when starting server on 1.1.107 #492

Open
TallonRain opened this issue May 14, 2024 · 12 comments

Comments

@TallonRain
Copy link

TallonRain commented May 14, 2024

After updating to 1.1.107, the server is persistently throwing the following message when it attempts to start up. Execution immediately halts once the operation not permitted error is given.

+ CONSOLE_LOG_LOCATION=
+ mkdir -p /factorio
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/config
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/scenarios
+ mkdir -p /factorio/script-output
+ [[ ! -f /factorio/config/rconpw ]]
+ [[ ! -f /factorio/config/server-settings.json ]]
+ [[ ! -f /factorio/config/map-gen-settings.json ]]
+ [[ ! -f /factorio/config/map-settings.json ]]
++ wc -l
++ find -L /factorio/saves -iname '*.tmp.zip' -mindepth 1
find: warning: you have specified the global option -mindepth after the argument -iname, but global options are not positional, i.e., -mindepth affects tests specified before it as well as those specified after it.  Please specify global options before other arguments.
+ NRTMPSAVES=0
+ [[ 0 -gt 0 ]]
+ [[ '' == \t\r\u\e ]]
+ EXEC=
++ id -u
+ [[ 0 = 0 ]]
+ usermod -o -u 845 factorio
usermod: no changes
+ groupmod -o -g 845 factorio
+ chown -R factorio:factorio /factorio
+ EXEC='runuser -u factorio -g factorio --'
+ [[ -f /bin/box64 ]]
+ sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
++ find -L /factorio/saves -iname '*.zip' -mindepth 1
++ wc -l
find: warning: you have specified the global option -mindepth after the argument -iname, but global options are not positional, i.e., -mindepth affects tests specified before it as well as those specified after it.  Please specify global options before other arguments.
+ NRSAVES=0
+ [[ false != true ]]
+ [[ 0 == 0 ]]
+ GENERATE_NEW_SAVE=true
+ SAVE_NAME=_autosave1
+ [[ true == true ]]
+ [[ -z _autosave1 ]]
+ [[ -f /factorio/saves/_autosave1.zip ]]
+ runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
   0.000 2024-05-14 02:57:09; Factorio 1.1.107 (build 62234, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json" 
   0.000 Config path: /opt/factorio/config/config.ini
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /factorio [774664/1156620MB]
   0.000 Binaries path: /opt/factorio/bin
   0.000 Error Util.cpp:86: Operation not permitted
+ FACTORIO_VOL=/factorio
+ LOAD_LATEST_SAVE=true
+ GENERATE_NEW_SAVE=false
+ SAVE_NAME=
+ BIND=
+ CONSOLE_LOG_LOCATION=
+ mkdir -p /factorio
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/config
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/scenarios
+ mkdir -p /factorio/script-output
+ [[ ! -f /factorio/config/rconpw ]]
+ [[ ! -f /factorio/config/server-settings.json ]]
+ [[ ! -f /factorio/config/map-gen-settings.json ]]
+ [[ ! -f /factorio/config/map-settings.json ]]
++ find -L /factorio/saves -iname '*.tmp.zip' -mindepth 1
++ wc -l
find: warning: you have specified the global option -mindepth after the argument -iname, but global options are not positional, i.e., -mindepth affects tests specified before it as well as those specified after it.  Please specify global options before other arguments.
+ NRTMPSAVES=0
+ [[ 0 -gt 0 ]]
+ [[ '' == \t\r\u\e ]]
+ EXEC=
++ id -u
+ [[ 0 = 0 ]]
+ usermod -o -u 845 factorio
usermod: no changes
+ groupmod -o -g 845 factorio
+ chown -R factorio:factorio /factorio
+ EXEC='runuser -u factorio -g factorio --'
+ [[ -f /bin/box64 ]]
+ sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
++ find -L /factorio/saves -iname '*.zip' -mindepth 1
++ wc -l
find: warning: you have specified the global option -mindepth after the argument -iname, but global options are not positional, i.e., -mindepth affects tests specified before it as well as those specified after it.  Please specify global options before other arguments.
+ NRSAVES=0
+ [[ false != true ]]
+ [[ 0 == 0 ]]
+ GENERATE_NEW_SAVE=true
+ SAVE_NAME=_autosave1
+ [[ true == true ]]
+ [[ -z _autosave1 ]]
+ [[ -f /factorio/saves/_autosave1.zip ]]
+ runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
   0.000 2024-05-14 02:58:01; Factorio 1.1.107 (build 62234, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json" 
   0.000 Config path: /opt/factorio/config/config.ini
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /factorio [774664/1156620MB]
   0.000 Binaries path: /opt/factorio/bin
   0.000 Error Util.cpp:86: Operation not permitted

I've completely deleted the entire container's data volume and attempted to start over from scratch, but the same issue arises. The same configuration previously worked for the past several years, I'm not sure what changed here after this update or what operation it's attempting to perform. As it is, I'm unable to run the server at this time.

@TallonRain TallonRain changed the title "Operation not permitted" error when starting server on 1.1.107 "Error Util.cpp:86: Operation not permitted" error when starting server on 1.1.107 May 14, 2024
@TOGoS
Copy link

TOGoS commented Oct 21, 2024

Sup from October, trying to run 2.0.7. I am also having this same problem (except that now it's line 81 of Util.cpp instead of 86).

I created a user and group on the host system, factorio:factorio, both with ID 845, created /opt/factorio, chown factorio:factorio /opt/factorio, then ran docker run --rm -p 34197:34197/udp -p 27015:27015/tcp -v /opt/factorio:/factorio --name factorio factoriotools/factorio. This ended with:

+ runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
   0.000 2024-10-21 18:32:41; Factorio 2.0.7 (build 79385, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json"
   0.000 Config path: /opt/factorio/config/config.ini
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /factorio [4174/95367MB]
   0.000 Binaries path: /opt/factorio/bin
   0.000 Error Util.cpp:81: Operation not permitted

Note that /opt/factorio on the host system is full of stuff, including log files, so it's clearly not having trouble reading/writing to that directory. I wonder if it's a network permission issue.

@JoshSnider
Copy link

I'm hitting this issue as well, setting up my docker container for the first time for space age.

I put my config on my NAS which is network mounted so I don't use the default /opt directory, that's the only thing I changed. I don't think it should matter I do this for all my docker containers.

  factorio:
    image: factoriotools/factorio
    container_name: factorio
    env_file: uidgid.env
    ports:
     - "34197:34197/udp"
     - "27015:27015/tcp"
    volumes:
     - /mnt/space/var/lib/factorio:/factorio

I have half a mind to fork this and get rid of the factorio user nonsense, it shouldn't be in this docker file. It should be injected using UID/GID like every other docker image does it...

@TOGoS
Copy link

TOGoS commented Oct 21, 2024

I also originally used different host directory. Same result.

I have half a mind to fork this and get rid of the factorio user nonsense, it shouldn't be in this docker file. It should be injected using UID/GID like every other docker image does it...

As did I, though I don't have time right now, so I would appreciate it. :)

I just want a barebones container that has the right libcs, really. I'm kind of surprised that factorio complained about mine, since I thought WheyBags fixed it back in the day to accept very old versions. Maybe that was never an official Factorio thing, though.

@JoshSnider
Copy link

After poking around a bit with the UID injection, and looking at the docker file, it looks like it actually should respect injected group and user ids. And after removing mine, I got different errors:

0.000 Error Util.cpp:81: Couldn't create lock file /factorio/.lock: Permission denied.

So it doesn't seem like it's user related.

Also just tried with a local drive (not on my NFS mounted drive, which has complications with chown and chmod) and still getting the same error... Seems there's something else going on here.

@saltypoison
Copy link

saltypoison commented Oct 21, 2024

Running into this on my server as well. This is a new install, no previous files. Permissions are correct on the directory.

docker run -d \
  --network=host \
  -p 34197:34197/udp \
  -p 27015:27015/tcp \
  -v /opt/docker/factorio:/factorio \
  --name factorio \
  --restart=unless-stopped \
  factoriotools/factorio:stable
+ FACTORIO_VOL=/factorio
+ LOAD_LATEST_SAVE=true
+ GENERATE_NEW_SAVE=false
+ PRESET=
+ SAVE_NAME=
+ BIND=
+ CONSOLE_LOG_LOCATION=
+ mkdir -p /factorio
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/config
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/scenarios
+ mkdir -p /factorio/script-output
+ [[ ! -f /factorio/config/rconpw ]]
+ [[ ! -f /factorio/config/server-settings.json ]]
+ [[ ! -f /factorio/config/map-gen-settings.json ]]
+ [[ ! -f /factorio/config/map-settings.json ]]
++ find -L /factorio/saves -iname '*.tmp.zip' -mindepth 1
++ wc -l
+ NRTMPSAVES=0
+ [[ 0 -gt 0 ]]
+ [[ '' == \t\r\u\e ]]
+ EXEC=
++ id -u
+ [[ 0 = 0 ]]
+ usermod -o -u 845 factorio
usermod: no changes
+ groupmod -o -g 845 factorio
+ chown -R factorio:factorio /factorio
+ EXEC='runuser -u factorio -g factorio --'
+ [[ -f /bin/box64 ]]
+ sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
++ find -L /factorio/saves -iname '*.zip' -mindepth 1
++ wc -l
+ NRSAVES=0
+ [[ false != true ]]
+ [[ 0 == 0 ]]
+ GENERATE_NEW_SAVE=true
+ SAVE_NAME=_autosave1
+ [[ true == true ]]
+ [[ -z _autosave1 ]]
+ [[ -f /factorio/saves/_autosave1.zip ]]
+ [[ ! -z '' ]]
+ runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
   0.000 2024-10-21 21:00:44; Factorio 2.0.7 (build 79385, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json" 
   0.000 Config path: /opt/factorio/config/config.ini
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /factorio [109532/217092MB]
   0.000 Binaries path: /opt/factorio/bin
   0.000 Error Util.cpp:81: Operation not permitted

@mhgamework
Copy link

I've got the same issue on Factorio 2.0.8.

I've:

  • Created a user factorio
  • usermod -u 845 factorio && groupmod -u 845 factorio
  • added factorio user to group docker
  • Ran docker-compose up as user factorio

I ran the same docker-compose on my local docker-desktop and that is running fine. Am i misunderstanding how to use the factorio user? The server i am trying to run the container on that is failing is Ubuntu 20.04.2

factorio_1  | ++ find -L /factorio/saves -iname '*.tmp.zip' -mindepth 1
factorio_1  | ++ wc -l
factorio_1  | + NRTMPSAVES=0
factorio_1  | + [[ 0 -gt 0 ]]
factorio_1  | + [[ '' == \t\r\u\e ]]
factorio_1  | + EXEC=
factorio_1  | ++ id -u
factorio_1  | + [[ 0 = 0 ]]
factorio_1  | + usermod -o -u 845 factorio
factorio_1  | usermod: no changes
factorio_1  | + groupmod -o -g 845 factorio
factorio_1  | + chown -R factorio:factorio /factorio
factorio_1  | + EXEC='runuser -u factorio -g factorio --'
factorio_1  | + [[ -f /bin/box64 ]]
factorio_1  | + sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
factorio_1  | ++ wc -l
factorio_1  | ++ find -L /factorio/saves -iname '*.zip' -mindepth 1
factorio_1  | + NRSAVES=0
factorio_1  | + [[ false != true ]]
factorio_1  | + [[ 0 == 0 ]]
factorio_1  | + GENERATE_NEW_SAVE=true
factorio_1  | + SAVE_NAME=_autosave1
factorio_1  | + [[ true == true ]]
factorio_1  | + [[ -z _autosave1 ]]
factorio_1  | + [[ -f /factorio/saves/_autosave1.zip ]]
factorio_1  | + [[ ! -z '' ]]
factorio_1  | + runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
factorio_1  |    0.001 2024-10-22 08:47:59; Factorio 2.0.8 (build 79416, linux64, headless)
factorio_1  |    0.002 Operating system: Linux
factorio_1  |    0.002 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json"
factorio_1  |    0.002 Config path: /opt/factorio/config/config.ini
factorio_1  |    0.002 Read data path: /opt/factorio/data
factorio_1  |    0.002 Write data path: /factorio [9893/24624MB]
factorio_1  |    0.002 Binaries path: /opt/factorio/bin
factorio_1  |    0.021 Error Util.cpp:81: Operation not permitted

@Fank
Copy link
Member

Fank commented Oct 22, 2024

I have half a mind to fork this and get rid of the factorio user nonsense, it shouldn't be in this docker file. It should be injected using UID/GID like every other docker image does it...

I would like to get rid of it too, it is causing a lot of issues for a long time.
Can you refer to images who does this?

@mhgamework
Copy link

I'm not sure whether this is a host vs container user issue, as i can easily reproduce it by running the image without a volume mount:
docker run --rm factoriotools/factorio

Output:

+ FACTORIO_VOL=/factorio
+ LOAD_LATEST_SAVE=true
+ GENERATE_NEW_SAVE=false
+ PRESET=
+ SAVE_NAME=
+ BIND=
+ CONSOLE_LOG_LOCATION=
+ mkdir -p /factorio
+ mkdir -p /factorio/saves
+ mkdir -p /factorio/config
+ mkdir -p /factorio/mods
+ mkdir -p /factorio/scenarios
+ mkdir -p /factorio/script-output
+ [[ ! -f /factorio/config/rconpw ]]
+ pwgen 15 1
+ [[ ! -f /factorio/config/server-settings.json ]]
+ cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json
+ [[ ! -f /factorio/config/map-gen-settings.json ]]
+ cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json
+ [[ ! -f /factorio/config/map-settings.json ]]
+ cp /opt/factorio/data/map-settings.example.json /factorio/config/map-settings.json
++ wc -l
++ find -L /factorio/saves -iname '*.tmp.zip' -mindepth 1
+ NRTMPSAVES=0
+ [[ 0 -gt 0 ]]
+ [[ '' == \t\r\u\e ]]
+ EXEC=
++ id -u
+ [[ 0 = 0 ]]
+ usermod -o -u 845 factorio
usermod: no changes
+ groupmod -o -g 845 factorio
+ chown -R factorio:factorio /factorio
+ EXEC='runuser -u factorio -g factorio --'
+ [[ -f /bin/box64 ]]
+ sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini
++ wc -l
++ find -L /factorio/saves -iname '*.zip' -mindepth 1
+ NRSAVES=0
+ [[ false != true ]]
+ [[ 0 == 0 ]]
+ GENERATE_NEW_SAVE=true
+ SAVE_NAME=_autosave1
+ [[ true == true ]]
+ [[ -z _autosave1 ]]
+ [[ -f /factorio/saves/_autosave1.zip ]]
+ [[ ! -z '' ]]
+ runuser -u factorio -g factorio -- /opt/factorio/bin/x64/factorio --create /factorio/saves/_autosave1.zip --map-gen-settings /factorio/config/map-gen-settings.json --map-settings /factorio/config/map-settings.json
   0.000 2024-10-23 11:21:47; Factorio 2.0.8 (build 79416, linux64, headless)
   0.001 Operating system: Linux
   0.001 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/_autosave1.zip" "--map-gen-settings" "/factorio/config/map-gen-settings.json" "--map-settings" "/factorio/config/map-settings.json"
   0.002 Config path: /opt/factorio/config/config.ini
   0.002 Read data path: /opt/factorio/data
   0.002 Write data path: /factorio [8833/24624MB]
   0.003 Binaries path: /opt/factorio/bin
   0.025 Error Util.cpp:81: Operation not permitted

I also tried running a different factorio docker image, which also has the same util.cpp error:
docker run --rm goofball222/factorio

Output:

[2024-10-23 11:21:05,731] <docker-entrypoint> INFO - Script version 1.4.1
[2024-10-23 11:21:05,735] <docker-entrypoint> INFO - Entrypoint functions version 1.1.0
[2024-10-23 11:21:05,746] <docker-entrypoint> INFO - Entrypoint running with UID 0 (root)
[2024-10-23 11:21:05,756] <docker-entrypoint> INFO - GID/UID for factorio are unchanged: GID=999, UID=999
[2024-10-23 11:21:05,760] <docker-entrypoint> INFO - Ensuring permissions are correct before continuing - 'chown -R factorio:factorio /opt/factorio'
[2024-10-23 11:21:05,764] <docker-entrypoint> INFO - Running recursive 'chown' on Docker overlay2 storage is **really** slow. This may take a bit.
[2024-10-23 11:21:11,176] <docker-entrypoint> INFO - Remove any incomplete *.tmp.zip from crash/forced exit in /opt/factorio/saves
[2024-10-23 11:21:11,195] <docker-entrypoint> INFO - No RCON.pwd found in /opt/factorio/config, generating random
[2024-10-23 11:21:11,211] <docker-entrypoint> INFO - RCON password is 'fa43ceabd2a8f642'
[2024-10-23 11:21:11,222] <docker-entrypoint> INFO - Copied latest server-settings.example.json to /opt/factorio/config
[2024-10-23 11:21:11,226] <docker-entrypoint> INFO - Copied latest map-gen-settings.example.json to /opt/factorio/config
[2024-10-23 11:21:11,229] <docker-entrypoint> WARN - No server-settings.json found in /opt/factorio/config, copying from example
[2024-10-23 11:21:11,234] <docker-entrypoint> WARN - No map-gen-settings.json found in /opt/factorio/config, copying from example
[2024-10-23 11:21:11,239] <docker-entrypoint> INFO - No server-banlist.json found in /opt/factorio/config, ignoring
[2024-10-23 11:21:11,242] <docker-entrypoint> INFO - No server-whitelist.json found in /opt/factorio/config, ignoring
[2024-10-23 11:21:11,245] <docker-entrypoint> INFO - No server-adminlist.json found in /opt/factorio/config, ignoring
[2024-10-23 11:21:11,251] <docker-entrypoint> WARN - No save.zip found in /opt/factorio/saves
[2024-10-23 11:21:11,254] <docker-entrypoint> INFO - Creating new map / save.zip in /opt/factorio/saves with settings from /opt/factorio/config/map-gen-settings.json
   0.000 2024-10-23 11:21:11; Factorio 2.0.8 (build 79416, linux64, headless)
   0.002 Operating system: Linux
   0.002 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/factorio/saves/save.zip" "--map-gen-settings" "/opt/factorio/config/map-gen-settings.json"
   0.003 Config path: /factorio/config/config.ini
   0.004 Read data path: /opt/factorio/data
   0.004 Write data path: /opt/factorio [8468/24624MB]
   0.004 Binaries path: /opt/factorio/bin
   0.016 Error Util.cpp:81: Operation not permitted

@mhgamework
Copy link

I managed to get it working!
After running apt-get dist-upgrade, the command "docker run --rm factoriotools/factorio" now no longer throws the util.cpp error. Server works now

@Cthanatos
Copy link

Cthanatos commented Nov 6, 2024

I'm getting this same error. I'm not terribly interested in running an "apt-get dist-upgrade" as this server runs a lot more than just my game servers.

Edit: For anybody else seeing this, running an "apt-get update" then an "apt-get upgrade" fixed this for me. It's been awhile since I ran those two.

@ostlerc
Copy link

ostlerc commented Nov 6, 2024

@Cthanatos FWIW it did not fix it for me. in fact, it caused a lot of troubles as you correctly guessed would happen.

@Cthanatos
Copy link

@Cthanatos FWIW it did not fix it for me. in fact, it caused a lot of troubles as you correctly guessed would happen.

Just to be clear on anybody else that reads this that doesn't already know - there's a huge difference between apt-get upgrade and apt-get dist-upgrade. Running apt-get update then apt-get upgrade is akin to getting standard updates on your Windows or Mac. Running apt-get dist-upgrade is like going from Windows 10 to Windows 11, or upgrading to the newest Mac OS. I did a regular upgrade, not dist-upgrade, and it fixed it for me.

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

No branches or pull requests

8 participants