Closed Erik1000 closed 2 years ago
Is your issue with ops or whitelist (IP addresses)? I'm confused by your analysis.
Well,
not sure what you mean with "IP addresses", but I mean both the whitelist - which allows/denies players to join the server - and the operators - which give the player special administrative permission (like /gamemode
) in game. The issue happens then passing the -e OPS=xxx
or -e WHITELIST=xxx
to the container.
Do you understand?
You can reproduce this bug by doing the following (for the ops):
Create and start a new container: docker run -d -p 25565:25565 --name paper-server -e EULA=TRUE -e TYPE=PAPER -e OPS=YourName itzg/minecraft-server:latest
Connect to your server (on localhost) and type some administrative command (e.g. /gamemode creative
or /stop
whatever).
--> This won't work. The server will tell you that you have no permission to execute this command.
Restart the container with docker restart paper-server
.
Try the same again ..
--> This time it will work.
To reproduce the bug with the whitelist:
Create and start a new container: docker run -d -p 25565:25565 --name paper-server -e EULA=TRUE -e TYPE=PAPER -e WHITELIST=YourName itzg/minecraft-server:latest
Try to connect to the server ..
--> You won't be able to join. The server will tell you, "You are not whitelisted on this server!".
Restart the container with docker restart paper-server
.
Try to connect to the server
--> This time you will be able to join the server.
This might be an issue with Paper itself since the startup script is doing all it can to prep the ops. Using your command I can see during early startup of the server:
docker exec paper-server cat ops.txt
YourName
and then after the server processes that into the ops.json:
docker exec paper-server cat ops.txt.converted
YourName
docker exec paper-server cat ops.json
[
{
"uuid": "3b3164e9-ec33-4023-a842-1ff24ac45732",
"name": "YourName",
"level": 4,
"bypassesPlayerLimit": false
}
]
To better debug this, can you tell me where in your scripts these json files are generated? @itzg
I tested more server types:
Nearly all of them where this bug occurs are bukkit based. This indicates an issues with bukkit or the lib it's using. However, I'm not able to easily reproduce this bug by just running the server jar file normal on my host machine. It would be nice if you could check your scripts if there's anything. Could the volume driver have something to do with this bug?? If you can't find the reason for this bug on your side and you're able to reproduce this bug independently from your docker image, I'll report this to bukkit/spigot/paper.
To better debug this, can you tell me where in your scripts these json files are generated? @itzg
The JSON files are not generated by this image's scripts at all. It's done by the Minecraft server jar startup.
How do you set the values then? Do you wait until the server generates these files itself and you change them then?
The input files, ops.txt and whitelist.txt, are written here just before the java process is started:
https://github.com/itzg/docker-minecraft-server/blob/master/start-minecraftFinalSetup#L5-L15
I am also not able to use commands like gamemode creative
even though I added myself to OPS
. I don't use Bukkit/Spigot/Paper myself, so I'm never quite sure if permissions.yml
is the only file those server types use for op'ed user resolving. They should fall back to ops.txt/json
IMHO, but apparently don't.
The permission.yml file is some built-in permission system which nobody uses. If the file is empty, it will be ignored. The server use the ops.json file like the vanilla server.
I've added some echos and cats in the script before this line and built it myself (using docker build). The ops.json does not exist. Only a ops.txt file with the names exists.
...
[init] Setting/adding ops
I am in line 10 and the OPS variable is:
Erik0000
Cat /data/ops.json:
cat: can't open '/data/ops.json': No such file or directory
[init] Checking for JSON files.
[init] Setting initial memory to 1G and max to 1G
[init] Starting the Minecraft server...
Now in line 230... cat /data/ops.json
cat: can't open '/data/ops.json': No such file or directory
Cat /data/ops.txt
Erik0000
List dir before startup
total 45908
drwxrwxrwx 3 minecraf minecraf 4096 Aug 8 04:17 .
drwxr-xr-x 1 root root 4096 Aug 8 04:17 ..
drwxrwxr-x 2 minecraf minecraf 4096 Aug 8 04:17 config
-rw-rw-r-- 1 minecraf minecraf 66 Aug 8 04:17 eula.txt
-rw-rw-r-- 1 minecraf minecraf 10 Aug 8 04:17 ops.txt
-rw-rw-r-- 1 minecraf minecraf 46982121 Aug 8 04:17 paper_server-1.16.1-latest.jar
-rw-r--r-- 1 minecraf minecraf 1083 Aug 8 04:17 server.properties
now executing mc-server-runner
Downloading vanilla jar...
Patching vanilla jar...
System Info: Java 1.8 (OpenJDK 64-Bit Server VM 25.242-b08) Host: Linux 5.7.9-1-MANJARO (amd64)
Loading libraries, please wait...
...
Seems like the ops.json file won't created on the first startup. Logs after restart:
...
[init] Setting/adding ops
I am in line 10 and the OPS variable is:
Erik0000
Cat /data/ops.json:
[
{
"uuid": "9044bb07-c3cd-425e-bfcd-4d22b074f294",
"name": "Erik0000",
"level": 4,
"bypassesPlayerLimit": false
}
][init] Checking for JSON files.
[init] Setting initial memory to 1G and max to 1G
[init] Starting the Minecraft server...
Now in line 230... cat /data/ops.json
[
{
"uuid": "9044bb07-c3cd-425e-bfcd-4d22b074f294",
"name": "Erik0000",
"level": 4,
"bypassesPlayerLimit": false
}
]Cat /data/ops.txt
Erik0000
List dir before startup
total 45972
drwxrwxrwx 7 minecraf minecraf 4096 Aug 8 04:21 .
drwxr-xr-x 1 root root 4096 Aug 8 04:17 ..
-rw-rw-r-- 1 minecraf minecraf 2 Aug 8 04:18 banned-ips.json
-rw-rw-r-- 1 minecraf minecraf 2 Aug 8 04:18 banned-players.json
-rw-rw-r-- 1 minecraf minecraf 1137 Aug 8 04:18 bukkit.yml
drwxrwxr-x 2 minecraf minecraf 4096 Aug 8 04:17 cache
-rw-rw-r-- 1 minecraf minecraf 598 Aug 8 04:18 commands.yml
drwxrwxr-x 2 minecraf minecraf 4096 Aug 8 04:17 config
-rw-rw-r-- 1 minecraf minecraf 66 Aug 8 04:17 eula.txt
-rw-rw-r-- 1 minecraf minecraf 2576 Aug 8 04:18 help.yml
drwxrwxr-x 2 minecraf minecraf 4096 Aug 8 04:18 logs
-rw-rw-r-- 1 minecraf minecraf 136 Aug 8 04:18 ops.json
-rw-rw-r-- 1 minecraf minecraf 10 Aug 8 04:21 ops.txt
-rw-rw-r-- 1 minecraf minecraf 2394 Aug 8 04:18 paper.yml
-rw-rw-r-- 1 minecraf minecraf 46982121 Aug 8 04:21 paper_server-1.16.1-latest.jar
-rw-rw-r-- 1 minecraf minecraf 0 Aug 8 04:18 permissions.yml
drwxrwxr-x 3 minecraf minecraf 4096 Aug 8 04:18 plugins
-rw-r--r-- 1 minecraf minecraf 1105 Aug 8 04:18 server.properties
-rw-rw-r-- 1 minecraf minecraf 4304 Aug 8 04:18 spigot.yml
-rw-rw-r-- 1 minecraf minecraf 107 Aug 8 04:18 usercache.json
-rw-rw-r-- 1 minecraf minecraf 47 Aug 8 04:18 version_history.json
-rw-rw-r-- 1 minecraf minecraf 2 Aug 8 04:18 whitelist.json
drwxrwxr-x 4 minecraf minecraf 4096 Aug 8 04:18 world
now executing mc-server-runner
System Info: Java 1.8 (OpenJDK 64-Bit Server VM 25.242-b08) Host: Linux 5.7.9-1-MANJARO (amd64)
Loading libraries, please wait...
...
Just notice this is the same with vanilla and it's working there. Anyway this could be a workaround all through you have to write the file yourself in the script and in this case you have to interact with the mojang api to get the correct uuids for the file.
I finally know what's going on. You are right, this is an issue with bukkit/spigot/paper. If you create a ops.txt or a whitelist.txt with the player names, the server will fallback on these, read them and write the names with the uuids into the json file on shutdown. But the server won't load these players if they weren't in the json file. I'll report this to bukkit/spigot/paper but a workaround is needed anyway because this bug will still exist in future versions (of the many forks of spigot) and they won't update the old versions (like 1.8 for pvp).
I am seeing the ops.txt -> ops.json conversion during server startup. I started the container as above and ran this in another window:
while true; do
date
docker exec paper-server tail -v -n +1 ops.txt ops.json
sleep 1
done
I can see the files got switched over at the :34:53
- :34:56
time frame:
Sat Aug 8 09:34:53 CDT 2020
tail: can't open 'ops.json': No such file or directory
==> ops.txt <==
itzg
Sat Aug 8 09:34:55 CDT 2020
==> ops.txt <==
itzg
==> ops.json <==
[]Sat Aug 8 09:34:56 CDT 2020
==> ops.json <==
[
{
"uuid": "5cddfd26-fc86-4981-b52e-c42bb10bfdef",
"name": "itzg",
"level": 4,
"bypassesPlayerLimit": false
}
]tail: can't open 'ops.txt': No such file or directory
and the minecraft server logs around that time frame:
[14:34:51 INFO]: Loaded 7 recipes
[14:34:54 INFO]: Starting minecraft server version 1.16.1
[14:34:54 INFO]: Loading properties
[14:34:54 INFO]: This server is running Paper version git-Paper-133 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
[14:34:54 INFO]: Server Ping Player Sample Count: 12
[14:34:54 INFO]: Using 4 threads for Netty based IO
[14:34:54 INFO]: Debug logging is disabled
[14:34:55 INFO]: Default game type: SURVIVAL
[14:34:55 INFO]: Generating keypair
[14:34:55 INFO]: Starting Minecraft server on *:25565
[14:34:55 INFO]: Using epoll channel type
[14:34:56 INFO]: Preparing level "world"
[14:34:56 INFO]: -------- World Settings For [world] --------
[14:34:56 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[14:34:56 INFO]: View Distance: 10
[14:34:56 INFO]: Item Merge Radius: 2.5
[14:34:56 INFO]: Item Despawn Rate: 6000
[14:34:56 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[14:34:56 INFO]: Cactus Growth Modifier: 100%
[14:34:56 INFO]: Cane Growth Modifier: 100%
[14:34:56 INFO]: Melon Growth Modifier: 100%
[14:34:56 INFO]: Mushroom Growth Modifier: 100%
[14:34:56 INFO]: Pumpkin Growth Modifier: 100%
[14:34:56 INFO]: Sapling Growth Modifier: 100%
[14:34:56 INFO]: Beetroot Growth Modifier: 100%
[14:34:56 INFO]: Carrot Growth Modifier: 100%
[14:34:56 INFO]: Potato Growth Modifier: 100%
[14:34:56 INFO]: Wheat Growth Modifier: 100%
[14:34:56 INFO]: NetherWart Growth Modifier: 100%
[14:34:56 INFO]: Vine Growth Modifier: 100%
[14:34:56 INFO]: Cocoa Growth Modifier: 100%
[14:34:56 INFO]: Bamboo Growth Modifier: 100%
[14:34:56 INFO]: SweetBerry Growth Modifier: 100%
[14:34:56 INFO]: Kelp Growth Modifier: 100%
[14:34:56 INFO]: Nerfing mobs spawned from spawners: false
[14:34:56 INFO]: Zombie Aggressive Towards Villager: true
[14:34:56 INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
[14:34:56 INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[14:34:56 INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
[14:34:56 INFO]: Experience Merge Radius: 3.0
[14:34:56 INFO]: Mob Spawn Range: 8
[14:34:56 INFO]: Custom Map Seeds: Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[14:34:56 INFO]: Max TNT Explosions: 100
[14:34:56 INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[14:35:12 INFO]: -------- World Settings For [world_nether] --------
I was hoping to see a specific log statement that you could use for the bug report, but the best I can find is that range of logs.
A workaround will require an API provided for converting Minecraft/Mojang username to their uuid. I also would need an explanation of the "level" field.
Mojang provides an rest api for this (see this section in the wiki). Full documentation available at https://wiki.vg/Mojang_API. The level
field defines the operator level. This can't be modified in any way expect then editing the file anyway so you can just set it to 4. I have never seen anybody using this tho.
Please provide a link to the Paper/Bukkit issue when you create it. I would prefer to avoid the workaround, but can work on that if they don't move on the issue quickly.
I have reported this bug to papermc's github issue page. No reaction yet except an user telling me to write an issue at https://hub.spigotmc.org/jira/secure/Dashboard.jspa
My issue on the paper github page: https://github.com/PaperMC/Paper/issues/4081
A workaround is probably the best way because it will take a while for a fix and they won't provide a fix for older versions anyway (only 1.16.1+).
@Erik1000 Thanks for the detailed debugging here. I just hit this and you saved me some time!
I noticed recently, that I had been receiving issues with OPS
/ WHITELIST
not being populated on FORGE
.
I received:
cp: can't create '1.3.7)/ops.txt': No such file or directory cp: can't stat '/data/FeedTheBeast/Eternal': No such file or directory cp: can't stat '(ServerPack': No such file or directory cp: can't create '1.3.7)/white-list.txt': No such file or directory cp: can't stat '/data/FeedTheBeast/Eternal': No such file or directory cp: can't stat '(ServerPack': No such file or directory
The directory that was created was /data/FeedTheBeast/Eternal (ServerPack 1.3.7)
and I believe it's causing issues with spaces in the pathname. I have not tried using CF_BASE_DIR
or a different volume to work around this yet.
@AMTraxTGE I created a new issue for what you have observed since it is related, but needs to be fixed more directly.
This issue is stale because it has been open 30 days with no activity. Please add a comment describing the reason to keep this issue open.
This issue popped back up, but for Forge auto-generated run.sh. I've deleted ops.txt, ops.json, and white-list.[txt|json] as suggested by others. Nothing fixes it. I've created a new docker-compose based server with OPS and WHITELIST flags, and I get the same errors, new or old servers won't boot starting after midnight last night.
This was an issue with Paper. Try an older PAPERBUILD
to see where they broke and report an issue with them.
I just discovered a bug then using paper and the environmental options. If you run one of the following commands to create and start a paper server, the options are not recognized until you restart the server (e.g. you aren't an operator):
This won't happen if you use the vanilla server type. Note: The
white-list
variable in theserver.properties
is set totrue
. My guess is, that the server is started before the options are copied into the json files (e.g.whitelist.json
). I have only tested this two options on paper and vanilla. This bug could exist on other server types and/or options too.