I'm trying to launch a MineCraft server at startup of an AWS EC2 instance running Amazon Linux.

For convenience, I used tmux to start a detached session, so I could ssh in to the box and connect to the running session, then detach again and close my terminal without shutting down the server. I'm using the EC2 instance "user data" to run the startup script which uses this command:

tmux new-session -d -s server ./start-server.sh

Now, while I can run this command interactively, when the server starts up non-interactively without a tty attached, the minecraft server .jar is successfully run, but apparently some startup code checks the tty properties because the server stops after pushing the following error to the log:

java.io.IOError: java.io.IOException: Error executing 'stty -a': stty: standard input: Input/output error
      at org.jline.terminal.impl.AbstractPosixTerminal.setAttributes(AbstractPosixTerminal.java:54)

I've not been able to find any meaningful help from searches for this error in the context of Minecraft servers, and while more research on the "right" way to launch a server might be in order, I'm hoping for a quick shortcut.

Is there some way to allow stty -a to be run without error, even though the session technically has no TTY attached at that moment (because later, it can have a TTY when I use tmux to attach to the session)? Can I give tmux some switch, or fake out the shell (bash) to make it think a tty is attached, or replace stty with a script that runs stty with additional switches, or something else?

Am I thinking incorrectly about the best way to enable SSH-ing into the box to gain command-line interaction with the running Minecraft process? Is using tmux a bad approach?


You must log in to answer this question.

Browse other questions tagged .