The snapcore/snapcraft docker image fails because it's not setting UTF-8

Bug #1699218 reported by Leo Arias
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Critical
Leo Arias

Bug Description

With snapcraft 2.31, our CLI now requires to have UTF-8 set. So the travis jobs out there configured with this image will fail with:

snapcraft clean

Traceback (most recent call last):

  File "/usr/bin/snapcraft", line 32, in <module>

    obj=dict(project=snapcraft.ProjectOptions()))

  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__

    return self.main(*args, **kwargs)

  File "/usr/lib/python3/dist-packages/click/core.py", line 675, in main

    _verify_python3_env()

  File "/usr/lib/python3/dist-packages/click/_unicodefun.py", line 119, in _verify_python3_env

    'mitigation steps.' + extra)

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either run this under Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.

You might be able to resolve your issue by exporting the

following environment variables:

    export LC_ALL=C.UTF-8

    export LANG=C.UTF-8

Revision history for this message
Leo Arias (elopio) wrote :
Revision history for this message
Federico Gimenez (fgimenez) wrote :
Download full text (3.4 KiB)

I'm getting the same error while trying to build the core snap, in my case setting LC_ALL doesn't help:

ubuntu@autopkgtest:~/core$ sudo snapcraft
Preparing to pull livebuild
Pulling livebuild
Preparing to pull hooks
Pulling hooks
Preparing to build livebuild
Building livebuild
make -j2
# exlucde "useless cat" from checks, while useless also makes
# some things more readable
shellcheck -e SC2002 hooks/* live-build/hooks/*
python3 -m unittest
.....
----------------------------------------------------------------------
Ran 5 tests in 0.221s

OK
mkdir -p auto
for f in config build clean; \
    do ln -s /usr/share/livecd-rootfs/live-build/auto/$f auto/; \
done
PROJECT=ubuntu-core SUBPROJECT=system-image EXTRA_PPAS='snappy-dev/image fgimenez/ubuntu-core:1000' IMAGEFORMAT=plain SUITE=xenial ARCH=amd64 lb clean
[2017-06-22 15:48:18] lb_clean
P: Executing auto/clean script.
[2017-06-22 15:48:18] lb_clean noauto
P: Cleaning chroot
PROJECT=ubuntu-core SUBPROJECT=system-image EXTRA_PPAS='snappy-dev/image fgimenez/ubuntu-core:1000' IMAGEFORMAT=plain SUITE=xenial ARCH=amd64 lb config
[2017-06-22 15:48:18] lb_config
P: Executing auto/config script.
Building on autopkgtest.localdomain

[..............]

[2017-06-22 15:25:00] lb_chroot_devpts remove
[2017-06-22 15:25:00] lb_testroot
P: Begin unmounting /dev/pts...
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists...
Building dependency tree...
Reading state information...
Reading package lists... Done
Building dependency tree
Reading state information... Done
snapcraft is already the newest version (2.31).
The following packages were automatically installed and are no longer required:
  dctrl-tools debootstrap germinate live-build livecd-rootfs python3-germinate shellcheck
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 32, in <module>
    obj=dict(project=snapcraft.ProjectOptions()))
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 675, in main
    _verify_python3_env()
  File "/usr/lib/python3/dist-packages/click/_unicodefun.py", line 119, in _verify_python3_env
    'mitigation steps.' + extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either run this under Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 1
Command '['/bin/sh', '/tmp/tmpauio1k16', 'make', '-j2']' returned non-zero exit status 2

ubuntu@autopkgtest:~/core$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 201606...

Read more...

Revision history for this message
Federico Gimenez (fgimenez) wrote :

Also:

ubuntu@autopkgtest:~$ sudo python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> print(locale.getpreferredencoding())
UTF-8
>>>
ubuntu@autopkgtest:~$ sudo locale -a
C
C.UTF-8
en_US.utf8
POSIX
ubuntu@autopkgtest:~$ sudo env | grep LC_
LC_ALL=en_US.UTF-8

Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: In Progress → Fix Committed
Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.