mschnitzer / ark-survival-ascended-linux-container-image

A docker/podman container that is able to run an ARK: Survival Ascended on a Linux host.
93 stars 18 forks source link

Missing Locale Settings in Docker Compose Causing Encoding Issues #72

Closed Zerschranzer closed 3 months ago

Zerschranzer commented 6 months ago

Hello mschnitzer,

I've encountered an issue with the current version of the docker-compose.yml for the asa-server-1 container where the absence of locale settings leads to encoding problems. Specifically, an error occurs when attempting to execute commands with special characters via asa-ctrl rcon.

Problem: The container defaults to the POSIX locale, which results in the following error when executing commands with special characters:

/usr/lib64/ruby/gems/3.3.0/gems/iniparse-1.5.0/lib/iniparse.rb:39:in `gsub’: invalid byte sequence in US-ASCII (ArgumentError)

Solution: I resolved the issue by setting the LANG and LC_ALL environment variables to C.UTF-8 to use UTF-8 encoding. Here is the section I modified:

environment:
  - LANG=C.UTF-8
  - LC_ALL=C.UTF-8

Suggestion: It would be beneficial if these changes could be incorporated into the official repository to prevent future encoding issues for other users.

Best regards, Zerschranzer

mschnitzer commented 6 months ago

What command did you execute?

Zerschranzer commented 6 months ago

Hello mschnitzer,

I executed the command docker exec -t asa-server-1 asa-ctrl rcon --exec 'saveworld'. After further testing, I’ve discovered that the encoding issue only occurs when Docker is installed via Snap. With a non-Snap installation, directly through the package manager, this issue does not arise.

It appears that the Snap version of Docker is configured differently regarding localization settings, leading to the error I described. Therefore, explicitly setting the environment variables LANG=C.UTF-8 and LC_ALL=C.UTF-8 in the docker-compose.yml is necessary to resolve the issue in the Snap version.

mschnitzer commented 5 months ago

Can you change image: mschnitzer/asa-linux-server:latest to image: mschnitzer/asa-linux-server:locale-test and restart the server by running docker-compose up -d again?

It will pull a test image that I have created for this purpose with a modified environment that has the following environment variables set:

LANG=C.UTF-8
LC_ALL=C.UTF-8

Once the server is up again, please test it again. Make sure that you reverse the changes in docker-compose.yml that you did before to set the environment variables.

Zerschranzer commented 5 months ago

I have applied the test image mschnitzer/asa-linux-server:locale-test as you suggested and restarted the server using docker-compose up -d. Unfortunately, the issue with the Snap version of Docker persists. Here is the exact output I receive:

myname@myserver:~/asa-server$ docker exec asa-server-1 asa-ctrl rcon --exec 'saveworld'
/usr/lib64/ruby/gems/3.3.0/gems/iniparse-1.5.0/lib/iniparse.rb:39:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)

    IniParse::Parser.new(source.gsub(/(?<!\\)\\\n/, '')).parse
                                     ^^^^^^^^^^^^^^^^^
        from /usr/lib64/ruby/gems/3.3.0/gems/iniparse-1.5.0/lib/iniparse.rb:39:in `parse'
        from /usr/share/asa-ctrl/helpers/ini_config_helper.rb:14:in `parse'
        from /usr/share/asa-ctrl/helpers/ini_config_helper.rb:4:in `game_user_settings_ini'
        from /usr/share/asa-ctrl/rcon/rcon.rb:53:in `identify_password'
        from /usr/share/asa-ctrl/cli/interfaces/rcon_interface.rb:20:in `run_command!'
        from /usr/share/asa-ctrl/cli/interfaces/rcon_interface.rb:12:in `execute!'
        from /usr/share/asa-ctrl/cli/interfaces/rcon_interface.rb:7:in `initialize'
        from /usr/bin/asa-ctrl:28:in `new'
        from /usr/bin/asa-ctrl:28:in `block (2 levels) in <main>'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/option.rb:66:in `ensure_call'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:117:in `process'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:124:in `try_process'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:59:in `block in parse'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:49:in `each'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:49:in `each_with_index'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/parser.rb:49:in `parse'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop/options.rb:76:in `parse'
        from /usr/lib64/ruby/gems/3.3.0/gems/slop-4.10.1/lib/slop.rb:23:in `parse'
        from /usr/bin/asa-ctrl:21:in `<main>'

I redownloaded the docker-compose.yml using wget to ensure a clean test environment. However, when I add the environment variables LANG=C.UTF-8 and LC_ALL=C.UTF-8 back to the docker-compose.yml, the encoding issues disappear.

If you require specific logs or additional information, I will to provide them.

Is it possible that the Snap environment isolation is causing this problem?

mschnitzer commented 5 months ago

Yea, my changes won't have any effect as the bash profile is not sourced automatically. Didn't know about that.

I adjusted the asa-ctrl script to set these environment variables now, could you please do a docker pull mschnitzer/asa-linux-server:locale-test again to fetch the latest version and restart your containers with docker-compose up -d ? Then try running the command again.

Zerschranzer commented 5 months ago

no, still the same error :-/

mschnitzer commented 5 months ago

I will look into this over the weekend, for now just use your workaround. Could you share the ini content that triggers the issue? Feel free to send it via mail (see on my GitHub profile).

mschnitzer commented 5 months ago

I haven't received the ini yet, is this still an issue?

mschnitzer commented 3 months ago

Closing for now, no response.