LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Locales were not being generated by dpkg-reconfigure locales on Debian (https://www.linuxquestions.org/questions/linux-newbie-8/locales-were-not-being-generated-by-dpkg-reconfigure-locales-on-debian-4175710363/)

todovvox 04-03-2022 09:10 AM

Locales were not being generated by dpkg-reconfigure locales on Debian
 
Hey, it's my first post, but I've been lurking here for a while and found a lot of solutions for my previous questions. Now I've been having a question according to locales on Debian Buster, release 10.12.

According to this question that I've posted on SO's board: https://unix.stackexchange.com/quest...ting-on-debian

I have solved my problem by running sudo apt-get install locales. But one question - what is sudo dpkg-reconfigure locales actually doing? Somebody said (somewhere else on the internet), that it is generating chosen locales. But for me - it wasn't doing anything. The locales were nowhere to be found on the system, thus those lines were popping up:
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
After running the command once again (sudo dpkg-reconfigure locales) - after installing them by apt-get install of course, and by choosing en_US.UTF-8 in the dpkg-reconfigure locales GUI, a message popped up:
locales-all installed, skipping locales generation
Which is understandable. I have just downloaded a package with all of the locales. So why dpkg-reconfigure locales didn't generate it first? Is it doing the same thing as apt-get install locales-all? But just installing certain locales, not all of them?

NevemTeve 04-03-2022 09:34 AM

Very good question, but isn't really related to programming: it would fit better into some Debian-specific forum. Nonetheless, you can find out what scripts in some *.deb package do, if you unpack the package with `ar x <somepackagefile.deb>` (Midnight Commander is able to 'enter' into *.deb files, too.)

todovvox 04-03-2022 09:40 AM

Quote:

Originally Posted by NevemTeve (Post 6343627)
Very good question, but isn't really related to programming: it would fit better into some Debian-specific forum. Nonetheless, you can find out what scripts in some *.deb package do, if you unpack the package with `ar x <somepackagefile.deb>` (Midnight Commander is able to 'enter' into *.deb files, too.)

Holy. I'm so sorry. I've somehow posted in that section, but it was supposed to land in Linux - Newbie corner. Probably because I was lurking this section and somehow swapped cards with the correct one. Can I ask someone here for moving that thread?

NevemTeve 04-03-2022 10:29 AM

Check/edit your /etc/locale.gen file, make sure to add/uncomment the following lines:
Code:

# grep -v '^#' /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
pl_PL ISO-8859-2
pl_PL.ISO-8859-2 ISO-8859-2
pl_PL.IBM852 IBM852
pl_PL.CP1250 CP1250
pl_PL.UTF-8 UTF-8

When it is done, run `locale-gen`:
Code:

# locale-gen
Generating locales (this might take a while)...
  en_US.ISO-8859-1... done
  en_US.UTF-8... done
  pl_PL.ISO-8859-2... done
  pl_PL.CP1250... done
  pl_PL.IBM852... done
  pl_PL.ISO-8859-2... done
  pl_PL.UTF-8... done
Generation complete.

Then check your work:
Code:

LC_ALL=pl_PL.UTF-8 perl -v
LC_ALL=pl_PL.ISO-8859-2 perl -v


boughtonp 04-03-2022 10:52 AM

Quote:

Originally Posted by todovvox (Post 6343628)
Can I ask someone here for moving that thread?

The way to do that is to use the report button on the first post of the thread and ask a mod to move it to the more suitable forum.


todovvox 04-03-2022 11:35 AM

Quote:

Originally Posted by NevemTeve (Post 6343632)
Check/edit your /etc/locale.gen file, make sure to add/uncomment the following lines:
Code:

# grep -v '^#' /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
pl_PL ISO-8859-2
pl_PL.ISO-8859-2 ISO-8859-2
pl_PL.IBM852 IBM852
pl_PL.CP1250 CP1250
pl_PL.UTF-8 UTF-8

When it is done, run `locale-gen`:
Code:

# locale-gen
Generating locales (this might take a while)...
  en_US.ISO-8859-1... done
  en_US.UTF-8... done
  pl_PL.ISO-8859-2... done
  pl_PL.CP1250... done
  pl_PL.IBM852... done
  pl_PL.ISO-8859-2... done
  pl_PL.UTF-8... done
Generation complete.

Then check your work:
Code:

LC_ALL=pl_PL.UTF-8 perl -v
LC_ALL=pl_PL.ISO-8859-2 perl -v


You're right. I didn't ask for a solution since it works now, but after uncommenting some of these lines, it has generated required locales. So I could do that by editing locale.gen and using locale-gen command, or by using dpkg-reconfigure locales and previously uncommenting lines in locale.gen, OR by installing all of the locales by installing locales-all package, right?

todovvox 04-03-2022 11:35 AM

Quote:

Originally Posted by boughtonp (Post 6343636)
The way to do that is to use the report button on the first post of the thread and ask a mod to move it to the more suitable forum.


Thanks a lot. Just did that.

todovvox 04-03-2022 04:10 PM

Quote:

Originally Posted by NevemTeve (Post 6343632)
Check/edit your /etc/locale.gen file, make sure to add/uncomment the following lines:
Code:

# grep -v '^#' /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
pl_PL ISO-8859-2
pl_PL.ISO-8859-2 ISO-8859-2
pl_PL.IBM852 IBM852
pl_PL.CP1250 CP1250
pl_PL.UTF-8 UTF-8

When it is done, run `locale-gen`:
Code:

# locale-gen
Generating locales (this might take a while)...
  en_US.ISO-8859-1... done
  en_US.UTF-8... done
  pl_PL.ISO-8859-2... done
  pl_PL.CP1250... done
  pl_PL.IBM852... done
  pl_PL.ISO-8859-2... done
  pl_PL.UTF-8... done
Generation complete.

Then check your work:
Code:

LC_ALL=pl_PL.UTF-8 perl -v
LC_ALL=pl_PL.ISO-8859-2 perl -v


I guess this solves the problem. I have checked now dpkg-reconfigure locales, and after generating those - it has those previously generated with locale-gen marked with an asterisk. Thank you.


All times are GMT -5. The time now is 01:22 PM.