You are not logged in.

#1 2022-11-29 00:04:11

vixalien
Member
Registered: 2022-06-19
Posts: 10

[SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

It's the second time that this happened after an update. Now I don't know what to do. All the solutions online didnt work for me.

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=C.utf8
LC_CTYPE="C.utf8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="C.utf8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="C.utf8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
de_DE.utf8
en_DK.utf8
en_GB.utf8
en_IE.utf8
en_US.utf8
fr_FR.utf8
nl_NL.utf8
rw_RW
rw_RW.utf8
sw_KE
sw_KE.utf8
sw_TZ
sw_TZ.utf8
$ cat /etc/locale.conf
LANG=en_US.UTF-8

Last edited by vixalien (2022-11-30 07:43:02)

Offline

#2 2022-11-29 00:10:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,956

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

Using Plasma? GNOME?

Offline

#3 2022-11-29 00:16:01

vixalien
Member
Registered: 2022-06-19
Posts: 10

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

I'm using GNOME. I changed the "Language" setting however to different values.

Offline

#4 2022-11-29 03:02:40

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,144

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

vixalien wrote:

I'm using GNOME. I changed the "Language" setting however to different values.

Different from what?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2022-11-29 06:43:30

vixalien
Member
Registered: 2022-06-19
Posts: 10

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

I changed it from what it was set to originally, which is "English (United Kingdom)" to other locales available such as "English (United States)" and "Francais (France)". It still won't work

Offline

#6 2022-11-29 07:52:45

seth
Member
Registered: 2012-09-03
Posts: 57,078

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

Something™ sets

LANG=C.utf8

But should be "C.UTF-8", inspect your shell rc.

Offline

#7 2022-11-29 11:07:46

solskogen
Member
From: Norway
Registered: 2005-03-06
Posts: 128

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

Remember to run

locale-gen

Offline

#8 2022-11-30 07:11:35

vixalien
Member
Registered: 2022-06-19
Posts: 10

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

I did run locale-gen:

$ sudo locale-gen
Generating locales...
  en_GB.UTF-8... done
  en_IE.UTF-8... done
  en_US.UTF-8... done
Generation complete

my rc files are fine I think.

$ cat ~/.bashrc | tee   
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export SCRIPT_DIR="$HOME/.config/i3blocks/scripts"

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

eval "$(register-python-argcomplete pmbootstrap)"

export OPENCV_LOG_LEVEL=ERROR

alias cat='bat --paging=never'
alias pn='pnpm'
alias px='pnpx'

# pnpm
export PNPM_HOME="/home/alien/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
# pnpm end
$ cat ~/.profile  | tee
#!/bin/bash
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi
export GTK_USE_PORTAL=0

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

# deno
export DENO_INSTALL="/home/alien/.deno"
append_path $DENO_INSTALL/bin
append_path "/opt/android-sdk/platform-tools"
export PATH="$DENO_INSTALL/bin:$PATH"
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
    export MOZ_ENABLE_WAYLAND=1
fi

# source /etc/profile.d/vte.sh

export BUN_INSTALL="/home/alien/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
export OPENCV_LOG_LEVEL=ERROR

AFAIK nothing changes the LANG variable.

But there is a problem, when I try to change the language with gnome-control-center, it doesn't change and stays on "English (United Kingdom)". what does gnome-control-center changes so that I can manually change it.

Offline

#9 2022-11-30 07:28:35

solskogen
Member
From: Norway
Registered: 2005-03-06
Posts: 128

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

What's the output of

localectl

Offline

#10 2022-11-30 07:31:34

vixalien
Member
Registered: 2022-06-19
Posts: 10

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

Guys and gals. I fixed it. The error was that "C.UTF-8" was not commented out in `/etc/locale.gen`. Now locale-gen returns this and everything works as normal (no reboot required).

$ sudo locale-gen
Generating locales...
  C.UTF-8... done
  en_GB.UTF-8... done
  en_IE.UTF-8... done
  en_US.UTF-8... done
Generation complete.

Offline

#11 2022-11-30 10:40:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,844

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

That's still somewhat of a band aid. Why are you using a C locale in the first place? Is this intentional? These are normally fallbacks if no other real locale is present

Offline

#12 2022-11-30 13:09:16

seth
Member
Registered: 2012-09-03
Posts: 57,078

Re: [SOLVED] can't set the locale; make sure $LC_* and $LANG are correct

grep -r 'C.utf8' /etc

If that doesn't show anything, next run

grep -r 'C.utf8' ~

Offline

Board footer

Powered by FluxBB