doctorray117 / minecraft-ondemand

Templates to deploy a serverless Minecraft Server on demand in AWS
Apache License 2.0
1.68k stars 115 forks source link

Getting open server.properties: permission denied #48

Closed prilldev closed 2 years ago

prilldev commented 2 years ago

When my Fargate Service runs, both containers deploy fine (after some wrangling), but now I'm stuck on the following error when the minecraft-server contain starts to Run: Failed to bulk-set properties in file: unable to access properties file server.properties: open server.properties: permission denied

Then the container immediately goes to STOPPED while the watchdog container keeps running for a while longer as it "waits"...

I've checked/doublechecked Security Groups/Subnets, etc for the EFS mounts, and am about to give up. I even had this working at one point before this error reared it's ugly head. Anything I can look for?

Thanks for the awesome project!

doctorray117 commented 2 years ago

I'd first look at the create mask for the efs access point. It's possible the files exist but you don't have permission for it now. When I'm back at my computer later I'll try to find the option. Do you see the file in efs via direct mount or by s3 datasync?

prilldev commented 2 years ago

So you just jogged my memory as I remember now it stopped working after I did Datasync to S3 and edited the server.properties file myself, reuploaded the changed file to S3 then Datasynced it back… That was yesterday so that’s why I had forgotten… but I’ve since wiped the drive clean and retried everything from scratch (recreated the Service and Task multiple times, tried every different combination is subnets in the service, checked security groups, etc), and I’m still getting that permissions error. So I definitely think the server.permissions file is there - just getting the access denied.

On Tue, Apr 12, 2022 at 6:28 PM Ray Gibson @.***> wrote:

I'd first look at the create mask for the efs access point. It's possible the files exist but you don't have permission for it now. When I'm back at my computer later I'll try to find the option. Do you see the file in efs via direct mount or by s3 datasync?

thekingdomofwool commented 2 years ago

Oddly enough, I'm having the same issue.... exactly the same. Did you find a fix? @prilldev

Ponjimon commented 2 years ago

I'm not sure how you edited the files in S3, but I noticed that when I edited the files, it stripped them of their metadata:

Before Type Key Value
System defined Content-Type application/octet-stream
User defined x-amz-meta-user-agent aws-datasync
User defined x-amz-meta-file-atime 1653926052462000000ns
User defined x-amz-meta-file-owner 1000
User defined x-amz-meta-file-permissions 100664
User defined x-amz-meta-file-group 1000
User defined x-amz-meta-file-mtime 1653926052462000000ns
After Type Key Value
System defined Content-Type application/octet-stream

I was using AWS Toolkit for VSCode (which, oddly enough, is an official extension by AWS lol)

doctorray117 commented 2 years ago

Wow, great catch @Ponjimon . I was able to replicate that, after downloading the file with s3browser, adding a line, and uploading it to s3, it lost the file owner/group/permissions tags. When syncing it back to efs with the datasync task, it changes the ownership to 65534:65534 and 755 permissions, which means that the minecraft task won't be able to read it.

The best fix appears to be to modify the s3->efs job and uncheck the "copy ownership" and "copy permissions" boxes in the advanced settings: image

I'll update the documentation to include this step. Sorry for the delay @prilldev