Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to correctly set the locale on Fedora-based distributions. #11605

Closed
1 of 2 tasks
peter-777 opened this issue May 22, 2024 · 11 comments
Closed
1 of 2 tasks

Unable to correctly set the locale on Fedora-based distributions. #11605

peter-777 opened this issue May 22, 2024 · 11 comments
Assignees

Comments

@peter-777
Copy link

peter-777 commented May 22, 2024

Windows Version

Microsoft Windows [Version 10.0.22631.3593]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Fedora 40 and Oracle Linux 9.1

Other Software

No response

Repro Steps

  1. Set up a Fedora-based distribution such as Oracle Linux.
  2. Enable systemd.
  3. Execute the following commands:
sudo dnf install -y langpacks-ja
sudo localectl set-locale ja_JP.utf8
  1. Log in again and execute a non-existent command.

Expected Behavior

$ aaa
-bash: aaa: コマンドが見つかりません

Actual Behavior

$ aaa
-bash: aaa: command not found

Diagnostic Logs

Here are the findings from the experiment:

  1. By adding printenv LANG to the beginning of /etc/profile to check the variable, it shows en_US.UTF-8.

  2. Strangely, when setting LANG in /etc/default/locale, the content is correctly reflected. If the file does not exist, it defaults to en_US.UTF-8.

Workaround:
Creating a symbolic link from /etc/locale.conf to /etc/default/locale resolves the issue.

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

@peter-777
Copy link
Author

Copy link

Diagnostic information
.wslconfig found
	Custom kernel command line found: 'sysctl.net.ipv4.ping_group_range="0 2000" cgroup_no_v1=all'
Detected appx version: 2.1.5.0

@OneBlue
Copy link
Collaborator

OneBlue commented Jul 22, 2024

@peter-777: What's the locale setting in Windows ?

WSL inherits that settings by default

@peter-777
Copy link
Author

@OneBlue The locale setting for Windows is set to Japanese.

@OneBlue
Copy link
Collaborator

OneBlue commented Jul 23, 2024

Interesting. Is systemd enabled in your distribution ? Can you share the output of cat /etc/wsl.conf ?

@peter-777
Copy link
Author

Yes, systemd is enabled in my distribution. Here is the output of cat /etc/wsl.conf:

[boot]
systemd = True
command = "mount --make-rshared /"
[user]
default = myuser

@OneBlue
Copy link
Collaborator

OneBlue commented Jul 26, 2024

Ok thank you @peter-777. Also, can you share how you installed that distribution ?

@peter-777
Copy link
Author

@OneBlue
I have installed two distributions. Fedora is set as the default in WSL.
One of them is extracted from a Fedora container image and imported into WSL as a rootfs.

wsl --import fedora-40 .\fedora-40\ .\fedora-40-rootfs.tar.gz

The second one was to verify if the same issue occurs with a commonly available Fedora-based distribution. To do this, I installed Oracle Linux using the following command:

wsl --install OracleLinux_9_1

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 23, 2024

Ok I see. Can you share the output of cat /etc/locale inside that distribution ?

Copy link
Contributor

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-file it as a new issue.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants