Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
how to install chroot with debootstrap with a certain locale
-
- Posts: 431
- Joined: 2018-11-05 21:30
how to install chroot with debootstrap with a certain locale
sudo debootstrap stable /stable-chroot http://deb.debian.org/debian/
Every time I create a chroot, I need to manually set the locale or it says my locale is unknown.
Is there a way to do that without having a to search in the long list of locales when running dpkg-reconfigure locales?
Or is there a way to do it when creating the chroot?
export LANG="en_US.UTF-8"
apt-get install locales
dpkg-reconfigure locales
Every time I create a chroot, I need to manually set the locale or it says my locale is unknown.
Is there a way to do that without having a to search in the long list of locales when running dpkg-reconfigure locales?
Or is there a way to do it when creating the chroot?
export LANG="en_US.UTF-8"
apt-get install locales
dpkg-reconfigure locales
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: how to install chroot with debootstrap with a certain lo
To set en_GB.UTF-8:
Code: Select all
chroot /stable-chroot /usr/bin/apt install locales
sed -i '/en_GB.UTF-8/s/^# //;/en_US.UTF-8/s/^# //' /stable-chroot/etc/locale.gen
chroot /stable-chroot /usr/sbin/locale-gen
echo -e 'LANG=en_GB.UTF-8\nLANGUAGE=en_GB.UTF-8' > /stable-chroot/etc/default/locale
deadbang
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
Fantastic!
edited:
it does not work.
Even after rebooting, the environment is wrong:
printenv | grep LANG
edited:
it does not work.
Even after rebooting, the environment is wrong:
printenv | grep LANG
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: how to install chroot with debootstrap with a certain lo
From which environment are you running that command? The locale is set by the login so unless you log in to the chroot it won't be set.MagicPoulp wrote:it does not work.
Even after rebooting, the environment is wrong:
printenv | grep LANG
Try this:
Code: Select all
# chroot /stable-chroot /usr/bin/passwd root # set root password
# rm /stable-chroot/etc/securetty{,.bak} # allow root login
# apt install systemd-machined
# systemd-nspawn -bD /stable-chroot
And to go back to your OP:
*What* says your locale is unknown? What was the exact error message and which command(s) did you run to receive that output?MagicPoulp wrote:it says my locale is unknown
To repeat my request from your other thread: please explain exactly what it is you are trying to do here. What is your overall aim and why do you think that setting the locale in a chroot system will solve that?
deadbang
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
what I want to do is to get rid of the errors messages , just after creating the chroot, and adding the default locale, every apt command would start by saying the locale is unknown (I do not have easy access to the error now but my LANG is still not set properly). WHich makes sense since there is locale isnalled for the exported LANG=sv_SE.UTF-8. But I never wanted my chroot to have sv_SE.UTF-8.
printenv | grep LANG
is run from the chroot started with
sudo chroot /stable-chroot/ /bin/bash
and LANG is not set properly to my defualt locale.
printenv | grep LANG
is run from the chroot started with
sudo chroot /stable-chroot/ /bin/bash
and LANG is not set properly to my defualt locale.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: how to install chroot with debootstrap with a certain lo
TryMagicPoulp wrote:printenv | grep LANG
is run from the chroot started with
sudo chroot /stable-chroot/ /bin/bash
and LANG is not set properly to my defualt locale.
Code: Select all
LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 sudo chroot /stable-chroot/ /bin/bash
deadbang
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
I tried and I can certify that the variables are required. How can I configure the shell so that variables are not required?even without the variables being explicitly set ...
Code: Select all
LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 sudo chroot /stable-chroot/ /bin/bash
[sudo] password for thierry:
root@debian-thierry:/# cd downloads/repo/
root@debian-thierry:/downloads/repo# cd openjdk8/
root@debian-thierry:/downloads/repo/openjdk8# bzr status
modified:
debian/control
root@debian-thierry:/downloads/repo/openjdk8# exit
thierry@debian-thierry:~$ sudo chroot /stable-chroot/ /bin/bash
root@debian-thierry:/# cd downloads/repo/openjdk8
root@debian-thierry:/downloads/repo/openjdk8# bzr status
bzr: warning: unsupported locale setting
bzr could not set the application locale.
Although this should be no problem for bzr itself, it might
cause problems with some plugins. To investigate the issue,
look at the output of the locale(1p) tool.
modified:
debian/control
Last edited by MagicPoulp on 2020-06-17 06:06, edited 1 time in total.
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
and apt still returns this without the extra variables for the chroot command:
Code: Select all
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "sv_SE.UTF-8"
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: how to install chroot with debootstrap with a certain lo
Well you must have made a mistake when entering my suggested commands, did you see the locales being generated and does /etc/default/locale in the chroot contain the correct LANG & LANGUAGE variables?MagicPoulp wrote:I can certify that the variables are required
I did test before posting, this is from my Alpine system (which doesn't use locales):
Code: Select all
$ echo $LANG
C.UTF-8
~$ echo $LANGUAGE
~$ doas chroot /mnt/stable-chroot /bin/bash
root@alpine:/# echo $LANG
root@alpine:/# apt update
Hit:1 https://deb.debian.org/debian stable InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root@alpine:/#
Use an alias to launch the chroot with the variables set.MagicPoulp wrote:How can I configure the shell so that variables are not required?
deadbang
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
Here is the exact thing I did (exact copy paste from a file to the shell) and yet the local.gen has the content it should with en_US.
Edit:
My problem disappears with the following:
sudo bash -c "echo 'LANG=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo bash -c "echo 'LANGUAGE=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo bash -c "echo 'LC_ALL=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo chroot /stable-chroot/ /bin/bash --login
Code: Select all
sudo debootstrap stable /stable-chroot http://deb.debian.org/debian/
sudo chroot /stable-chroot /usr/bin/apt install locales
sudo sed -i '/en_US.UTF-8/s/^# //;/en_US.UTF-8/s/^# //' /stable-chroot/etc/locale.gen
sudo chroot /stable-chroot /usr/sbin/locale-gen
sudo bash -c "echo -e 'LANG=en_US.UTF-8\nLANGUAGE=en_US.UTF-8' > /stable-chroot/etc/default/locale"
cd /stable-chroot/
sudo mount -t proc proc proc/
sudo mount --rbind /sys sys/
sudo mount --rbind /dev dev/
sudo chroot /stable-chroot/ /bin/bash
LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 sudo chroot /stable-chroot/ /bin/bash
Edit:
My problem disappears with the following:
sudo bash -c "echo 'LANG=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo bash -c "echo 'LANGUAGE=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo bash -c "echo 'LC_ALL=en_US.UTF-8' >> /stable-chroot/etc/profile"
sudo chroot /stable-chroot/ /bin/bash --login
-
- Posts: 1939
- Joined: 2006-04-21 11:19
- Location: Sol Sector
- Has thanked: 1 time
- Been thanked: 2 times
Re: how to install chroot with debootstrap with a certain lo
You may want to take a look at this:
https://grml.org/grml-debootstrap/
It's a wrapper around debootstrap that allows you do a lot of things more easily.
Phil
https://grml.org/grml-debootstrap/
It's a wrapper around debootstrap that allows you do a lot of things more easily.
Phil
Freespoke is a new search engine that respects user privacy and does not engage in censorship.
- stevepusser
- Posts: 12930
- Joined: 2009-10-06 05:53
- Has thanked: 41 times
- Been thanked: 72 times
Re: how to install chroot with debootstrap with a certain lo
If you just want to use the chroots for building stuff, why not pbuilder or sbuild?
MX Linux packager and developer
-
- Posts: 431
- Joined: 2018-11-05 21:30
Re: how to install chroot with debootstrap with a certain lo
Because based on the docs around, it seems to require more knowledge and commands than a basic chroot.
See how long the page is:
https://wiki.debian.org/sbuild
or how long that command is:
BY the way the debuild options -us -uc -b seem to be hidden, etc
See how long the page is:
https://wiki.debian.org/sbuild
or how long that command is:
BY the way the debuild options -us -uc -b seem to be hidden, etc
Code: Select all
sbuild --arch=amd64 -d buster --debbuildopt=-J10 --force-orig-source -s -A \
--extra-repository="deb [trusted=yes] http://www.mirbsd.org/~tg/Debs/ buster wtf" \
--extra-repository="<some other repo you might want to tack onto Buster for the build>"