← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1751051] [NEW] UnicodeEncodeError when creating user with non-ascii chars

 

Public bug reported:

I was testing subiquity, and at the user creation prompt typed in "André
D'Silva" for the username, and just "andre" for the login.

The installer finished fine, but upon first login I couldn't login.
Booting into rescue mode showed me that the user had not been created.

Checking cloud-init logs, I find the UnicodeEncodeError.
2018-02-22 12:44:01,386 - __init__.py[DEBUG]: Adding user andre
2018-02-22 12:44:01,387 - util.py[WARNING]: Failed to create user andre
2018-02-22 12:44:01,387 - util.py[DEBUG]: Failed to create user andre
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 463, in add_user
    util.subp(adduser_cmd, logstring=log_adduser_cmd)
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1871, in subp
    env=env, shell=shell)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1275, in _execute_child
    restore_signals, start_new_session, preexec_fn)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 4: ordinal not in range(128)

user-data contains this:
#cloud-config
hostname: sbqt
users:
- gecos: "Andr\xE9 D'Silva"
  groups: [adm, cdrom, dip, lpadmin, plugdev, sambashare, debian-tor, libvirtd, lxd,
    sudo]
  lock-passwd: false
  name: andre
  passwd: $6$UaxxahbQam4Ko1g7$WB5tNuCR84DvWwI7ovxDiofIdLP47pG2USPel2iIQV/qzzT3pAb1VtlbelCR2iCNRxCoJgsVafcNtqdfz1/IL1
  shell: /bin/bash
  ssh_import_id: ['lp:ahasenack']

cloud-init is 17.2-34-g644048e3-0ubuntu1 from bionic/main.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1751051

Title:
  UnicodeEncodeError when creating user with non-ascii chars

Status in cloud-init:
  New

Bug description:
  I was testing subiquity, and at the user creation prompt typed in
  "André D'Silva" for the username, and just "andre" for the login.

  The installer finished fine, but upon first login I couldn't login.
  Booting into rescue mode showed me that the user had not been created.

  Checking cloud-init logs, I find the UnicodeEncodeError.
  2018-02-22 12:44:01,386 - __init__.py[DEBUG]: Adding user andre
  2018-02-22 12:44:01,387 - util.py[WARNING]: Failed to create user andre
  2018-02-22 12:44:01,387 - util.py[DEBUG]: Failed to create user andre
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 463, in add_user
      util.subp(adduser_cmd, logstring=log_adduser_cmd)
    File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1871, in subp
      env=env, shell=shell)
    File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
      restore_signals, start_new_session)
    File "/usr/lib/python3.6/subprocess.py", line 1275, in _execute_child
      restore_signals, start_new_session, preexec_fn)
  UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 4: ordinal not in range(128)

  user-data contains this:
  #cloud-config
  hostname: sbqt
  users:
  - gecos: "Andr\xE9 D'Silva"
    groups: [adm, cdrom, dip, lpadmin, plugdev, sambashare, debian-tor, libvirtd, lxd,
      sudo]
    lock-passwd: false
    name: andre
    passwd: $6$UaxxahbQam4Ko1g7$WB5tNuCR84DvWwI7ovxDiofIdLP47pG2USPel2iIQV/qzzT3pAb1VtlbelCR2iCNRxCoJgsVafcNtqdfz1/IL1
    shell: /bin/bash
    ssh_import_id: ['lp:ahasenack']

  cloud-init is 17.2-34-g644048e3-0ubuntu1 from bionic/main.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1751051/+subscriptions


Follow ups