factoriotools / factorio-docker

Factorio headless server in a Docker container
https://hub.docker.com/r/factoriotools/factorio/
MIT License
926 stars 219 forks source link

couldn't create .lock file: permission denied #388

Open QuinveY opened 3 years ago

QuinveY commented 3 years ago

I have been using factorio server on windows for quite a while now, and I wanted to be able to automate the updating process of factorio. For this I am using a vm of ubuntu with docker. But I having problems with the initial install. I'm using this modified quick-start command:

sudo docker run -d -it \
  -p 3333:3333/udp \
  -v /mnt/Factorio/factorio:/factorio \
  -e "PORT=3333" \
  -e LOAD_LATEST_SAVE=false \
  -e SAVE_NAME=onlineServer \
  --name factorio \
  --restart=always \
  factoriotools/factorio

comments on this:

When I check the logs, there is an error report "0.000 Error Util.cpp:83: Couldn't create lock file /factorio/.lock: Permission denied." This causes factorio to endlessly restart, but never actually work.

I have set the permissions on the mount to the reccomended 845:845 and with the first run of this command posted above the folderstructure is being made.

does anybody have a clue what to do? hope so!

Kind regards, Q

bplein commented 3 years ago

did you chown 845:845 /mnt/Factorio/factorio followed by chmod 755 /mnt/Factorio/factorio ?

perobertson commented 3 years ago

You would need to run sudo chown -R 845:845 /mnt/Factorio/factorio on the host so that all files and directories are updated to the expected user and group.

Also some searching for Error Util.cpp:83: Couldn't create lock file shows that this happens on occasion. You could also try to fetch the latest image with docker pull factoriotools/factorio:latest to see if that fixed the issue for you.

You could also try deleting the entire /mnt/Factorio/factorio directory and starting again if you do not have any saves or other information in there that you want to keep.