Skip to content

[BUG] Unable to setup the persistent firewall rules: 'ascii' codec can't encode character #2265

Description

@taoyama

This issue is similar to #2228

If system locale is other than English (ex. Japanese), ascii encoding fails because command result of journalctl contains multibyte characters.

ex: ascii codec can't encode character '水'

[root@rhel76vm ~]# LANG=ja_JP.UTF8 journalctl -u waagent-network-setup.service
-- Logs begin at 水 2021-06-02 00:46:26 UTC, end at 水 2021-06-02 00:50:01 UTC. --
 6月 02 00:48:07 rhel76vm systemd[1]: Starting Setup network rules for WALinuxAgent...
 6月 02 00:48:07 rhel76vm python[11877]: Setting up firewall for the WALinux Agent with args: {'dst_ip': '168.63.129.16', 'uid': '0', 'wait': '-w'}
 6月 02 00:48:07 rhel76vm python[11877]: Successfully set the firewall rules
 6月 02 00:48:07 rhel76vm systemd[1]: Started Setup network rules for WALinuxAgent.

repro steps

  1. Create VM
$ az group create -g myResourceGroup -l japaneast
$ az vm create -g myResourceGroup -n rhel7 --image RedHat:RHEL:7.6:7.6.2021051101
  1. SSH to the VM
  2. Stop firewall and enable waagent-network-setup.service
# systemctl stop firewalld
# systemctl disable firewalld
# iptables -F -t security
# localectl set-locale LANG=ja_JP.UTF8
# systemctl restart waagent
# systemctl start waagent-network-setup.service
# systemctl restart waagent
  1. encoding error is logged
# grep ascii /var/log/waagent.log
2021-06-02T00:48:13.879608Z ERROR ExtHandler ExtHandler Unable to setup the persistent firewall rules: 'ascii' codec can't encode character u'\u6c34' in position 81: ordinal not in range(128)

Distro and WALinuxAgent details (please complete the following information):

waagent -version

WALinuxAgent-2.2.46 running on redhat 7.6
Python: 2.7.5
Goal state agent: 2.3.0.2

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions