Merge lp:~yuningdodo/live-build/live-build.clear-locales-in-bootstrap into lp:~ce-infrastructure/live-build/lb-sg-2.x

Proposed by Yu Ning
Status: Needs review
Proposed branch: lp:~yuningdodo/live-build/live-build.clear-locales-in-bootstrap
Merge into: lp:~ce-infrastructure/live-build/lb-sg-2.x
Diff against target: 16 lines (+6/-0)
1 file modified
scripts/build/lb_binary_debian-installer (+6/-0)
To merge this branch: bzr merge lp:~yuningdodo/live-build/live-build.clear-locales-in-bootstrap
Reviewer Review Type Date Requested Status
Yu Ning (community) Disapprove
Timothy R. Chavez (community) Disapprove
Bruce.Ma (community) Approve
Review via email: mp+193039@code.launchpad.net

Commit message

Recent OEM ISO built on oem-ibs.canonical.com has keyboard layout incorrectly set to "uk".

An example ISO can be downloaded here:
https://oem-ibs.canonical.com/builds/sutton-precise-amd64/20131029-0/

Steps to check:

```
mkdir mnt1 mnt2
mount -o loop,ro sutton-precise-amd64-iso-20131029-0.iso mnt1
mount -o loop,ro mnt1/casper/filesystem.squashfs mnt2
grep XKBLAYOUT mnt2/etc/default/keyboard
```

Expected result:
Output is: XKBLAYOUT="us"

Actual result:
Output is: XKBLAYOUT="gb"

To post a comment you must log in.
Revision history for this message
Yu Ning (yuningdodo) wrote :

/etc/default/keyboard is generated by the package console-setup during bootstrap stage, it's contents is decided with the locale settings in ENV. A chroot system will inherit the ENV vars from host system. Our server uses en_GB.UTF-8 as locale, this is why the XKBLAYOUT is set to "gb".

We could fix this issue by clear the locale settings in the live build scripts.

Revision history for this message
Bruce.Ma (bruce.ma) wrote :

+1

review: Approve
Revision history for this message
Bin Li (binli) wrote :

What the meaning of C? :)

Revision history for this message
Yu Ning (yuningdodo) wrote :

Please refer to POSIX [1]:

> The POSIX locale can be specified by assigning to the appropriate environment variables the values "C" or "POSIX".

"C" can be treat as a fallback or always-safe locale.

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_02

Revision history for this message
Timothy R. Chavez (timrchavez) wrote :

Hey,

I'm not ignoring you. I'm looking into this. All of our build environments are configured with en_US.UTF8 locales, so I'm not sure where en_GB is coming from. I'd rather fix the builder, than patch live-build, to enforce using the fallback locale. I should know more by tomorrow. Hopefully we can get this situation corrected for you by EOD today (my day)

Revision history for this message
Timothy R. Chavez (timrchavez) wrote :

FWIW, I just downloaded the latest image (which was built on oregongrape) and did not see the problem:

root@crumpet:/home/tim# mkdir mnt1 mnt2
root@crumpet:/home/tim# mount -o loop,ro Downloads/sutton-precise-amd64-iso-20131031-0.iso mnt1/
root@crumpet:/home/tim# mount -o loop,ro mnt1/casper/filesystem.squashfs mnt2
root@crumpet:/home/tim# grep XKBLAYOUT mnt2/etc/default/keyboard
XKBLAYOUT="us"

I'll take a look at some images built on oilpalm to maybe narrow it down to that builder... (even though I confirmed its locale was en_US.UTF8 already)

Revision history for this message
Yu Ning (yuningdodo) wrote :

Thanks for your reply, if it can be fixed in the builder that would be better.

By the way, here is some discussion on IRC(#IS) made by Spads and me:

<yuning> Spads, ping, we have an bug may related to IBS server's locale settings. https://bugs.launchpad.net/sutton/+bug/1244057
<Spads> yuning: so sorry, what's the IBS server?
<yuning> Spads, please refer to the bug description, comment #8 and comment #11.
<yuning> Spads, oem-ibs.canonical.com
<yuning> Spads, https://oem-ibs.canonical.com
<Spads> okay
<Spads> so you need to clear the locale variables during build, is that it?
<yuning> Spads, yes.
<Spads> yuning: so I guess that's something the OEM team can work into their build system
<yuning> Spads, do you mean we can workaround it in bugsy-config?
<Spads> well I don't know
<Spads> but if you can't, that would be pretty striking
<yuning> Spads, if fact I had tried to workaround it in bugsy-config, but no luck. Should I open a ticket for the issue?
<Spads> let me look at something here
<Spads> okay so here's the thing
<Spads> LANG=en_GB.UTF-8
<Spads> is in lexbuilder's environment
<Spads> assuming that's not completely inherited from mine
<Spads> but the builds should probably isolate themselves from that environment, or allow for overriding them
<yuning> Is it OK to clear the setting? en_US.UTF-8 is also a good choice.
<Spads> so are all OEM devices using US keyboards, and will do so forever?
<Spads> This seems like a configuration choice
<yuning> The issue is the configs in the ISO (/etc/default/keyboard) is generated in a very early stage, before OEM settings taking effect.
<Spads> so maybe XKBLAYOUT could be overridden?
<Spads> can you figure out exactly which piece is making this choice?
<Spads> is this build system launched from cron?
<yuning> Spads, in the bootstrap stage when the package console-setup is installed it generate the /etc/default/keyboard based on the locale settings from ENV.
<Spads> perhaps that code needs to be updated then?
<yuning> Spads, I don't know the details of oem-ibs.canonical.com
<Spads> well neither do I, but I'm not sure that this is worth changing the keyboard settings on the server
<Spads> well, locale
<Spads> so if there's someplace we can identify that is the correct location for this explicit configuration choice, we should do that
<Spads> but I suspect it's in the IBS code
<yuning> Spads, we do not need to change the server's locale, just clear them in the beginning of a chroot is enough.
<Spads> if you can show me where to do that, I'll consider it
<Spads> but right now this strikes me as a bug in the IBS
<Spads> and not a server misconfiguration
<yuning> Spads, yes, maybe we can fix it in lp:~oem-solutions-releng/live-build/lb-sg-2.x , no need to touch the server.
<yuning> let me see where in the code to put the patch.
<Spads> ok

Revision history for this message
Yu Ning (yuningdodo) wrote :

You're right, the issue may relate to a specific builder, not every ISO has the issue.

Revision history for this message
Timothy R. Chavez (timrchavez) wrote :

This problem was due to a configuration issue on the builders themselves. It does not warrant a code change. Once we updated the locales to C.UTF-8 and restarted the build slaves projects began building with the correct defaults.

review: Disapprove
Revision history for this message
Yu Ning (yuningdodo) wrote :

Since the issue is already fixed on the builders, no need to apply the patch.

review: Disapprove

Unmerged revisions

1618. By Yu Ning

Clear locale settings in case console-setup generate /etc/default/keyboard with non-default values.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/build/lb_binary_debian-installer'
2--- scripts/build/lb_binary_debian-installer 2012-11-15 15:34:57 +0000
3+++ scripts/build/lb_binary_debian-installer 2013-10-29 11:25:57 +0000
4@@ -424,6 +424,12 @@
5 # Set apt command prefix
6 _LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only"
7
8+ # Clear locale settings in case console-setup generate
9+ # /etc/default/keyboard with non-default values.
10+ export LANG=C
11+ export LANGUAGE=C
12+ export LC_ALL=C
13+
14 if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
15 then
16 # We don't want to duplicate .debs of packages in binary/pool that are already

Subscribers

People subscribed via source and target branches