Change encoding to use the system locale instead of ascii
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ec2-hibinit-agent (Ubuntu) |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Focal |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Jammy |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Kinetic |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Lunar |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Mantic |
Fix Released
|
Undecided
|
Mitchell Dzurick |
Bug Description
[Impact]
Some Locale will cause hibinit-agent to error out because the script tries to decode using ASCII. An example would be the russian locale ru_RU.UTF-8
[Fix]
One line fix from upstream - https:/
[Test Case]
1. Create an EC2 instance
AWS_REGION=
AWS_AMI=
AWS_KEY="your key name"
AWS_SECURITY_
aws ec2 run-instances \
--region ${AWS_REGION} \
--image-id ${AWS_AMI} \
--count 1 \
--instance-type t3.micro \
--key-name ${AWS_KEY} \
--metadata-options "HttpTokens=
--security-
--tag-
--block-
--hibernation-
2. SSH into instance
3. install russian language and set locale
$ sudo apt install -y language-pack-ru
$ export LC_ALL=ru_RU.UTF-8
4. Attempt to use hibinit-agent
$ sudo /usr/bin/
Traceback (most recent call last):
File "/usr/bin/
dev = find_device_
File "/usr/bin/
df_out = check_output(['df', '-P', filename]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/
main()
File "/usr/bin/
config = Config(config_file, args)
File "/usr/bin/
swap_
File "/usr/bin/
raise Exception("Failed to find the filesystem type of /")
Exception: Failed to find the filesystem type of /
When fixed, the results should look like:
$ sudo /usr/bin/
Effective config: {'log_to_syslog': True, 'log_to_stderr': True, 'mkswap': 'mkswap {swapfile}', 'swapon': 'swapon {swapfile}', 'swapoff': 'swapoff {swapfile}', 'touch_swap': False, 'grub_update': True, 'swap_percentage': 100, 'swap_mb': 4000, 'state_dir': '/var/lib/
Requesting new IMDSv2 token.
Hibernation Configured Flag found
Will check if swap is at least: 4000 megabytes
There's sufficient swap available (have 4194304000, need 4194304000)
Running: swapon /swap-hibinit
Updating the kernel offset for the swapfile: /swap-hibinit
Setting swap device to 66305 with offset 1017856
Done updating the swap offset. Turning swapoff
Running: swapoff /swap-hibinit
[ Where things can go wrong ]
This now relies on the Python sys.getfilesyst
Related branches
- Dan Bungert (community): Approve
- Michael Hudson-Doyle (community): Approve
- git-ubuntu import: Pending requested
-
Diff: 109 lines (+70/-0)5 files modifieddebian/changelog (+10/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
debian/postinst (+21/-0)
- Dan Bungert (community): Approve
- Michael Hudson-Doyle (community): Approve
- git-ubuntu import: Pending requested
-
Diff: 107 lines (+68/-0)5 files modifieddebian/changelog (+10/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
debian/postinst (+19/-0)
- Dan Bungert (community): Approve
- Michael Hudson-Doyle (community): Approve
- git-ubuntu import: Pending requested
-
Diff: 107 lines (+68/-0)5 files modifieddebian/changelog (+10/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
debian/postinst (+19/-0)
- Dan Bungert (community): Approve
- Steve Langasek (community): Approve
- Michael Hudson-Doyle (community): Approve
- git-ubuntu import: Pending requested
-
Diff: 108 lines (+69/-0)5 files modifieddebian/changelog (+11/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
debian/postinst (+19/-0)
- Utkarsh Gupta (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 78 lines (+50/-0)4 files modifieddebian/changelog (+11/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
Changed in ec2-hibinit-agent (Ubuntu Mantic): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in ec2-hibinit-agent (Ubuntu Lunar): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in ec2-hibinit-agent (Ubuntu Kinetic): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in ec2-hibinit-agent (Ubuntu Jammy): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in ec2-hibinit-agent (Ubuntu Focal): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
Changed in ec2-hibinit-agent (Ubuntu Mantic): | |
status: | New → In Progress |
Changed in ec2-hibinit-agent (Ubuntu Focal): | |
status: | New → Fix Committed |
Changed in ec2-hibinit-agent (Ubuntu Jammy): | |
status: | New → Fix Committed |
Changed in ec2-hibinit-agent (Ubuntu Kinetic): | |
status: | New → Fix Committed |
Changed in ec2-hibinit-agent (Ubuntu Lunar): | |
status: | New → Fix Committed |
tags: |
added: verification-done verification-done-focal verification-done-jammy verification-done-kinetic verification-done-lunar removed: verification-needed verification-needed-focal verification-needed-jammy verification-needed-kinetic verification-needed-lunar |
This bug was fixed in the package ec2-hibinit-agent - 1.0.0-0ubuntu15
---------------
ec2-hibinit-agent (1.0.0-0ubuntu15) mantic; urgency=medium
* debian/ patches/ lp2023924- remove- quotes- from-state- dir.patch: fixes patches/ lp2024505- fix-locale- issue.patch: fixes an issue where
an issue where a weird directory would be created in root
(LP: #2023924)
* debian/
certain locales can cause an error when trying to decode the output of
`df -P` (LP: #2024505)
-- Mitchell Dzurick <email address hidden> Tue, 20 Jun 2023 17:01:17 -0700