Comment 0 for bug 1975629

Revision history for this message
Brett Holman (holmanb) wrote :

While attempting to debug errors on cloud-init on ppc64el, I noticed what I believe is a bug.

[ Help ] -> [Enter shell]

Enters a shell that a user will likely want to use for debugging. However, netplan (and I suspect other python-based tools as well) are broken:

root@ubuntu-server:/# netplan try
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 247, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 81, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 247, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 84, in command_try
    if not self.is_revertable():
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 169, in is_revertable
    self.config_manager.parse(extra_config=extra_config)
  File "/usr/share/netplan/netplan/configmanager.py", line 175, in parse
    self._merge_yaml_config(yaml_file)
  File "/usr/share/netplan/netplan/configmanager.py", line 290, in _merge_yaml_config
    yaml_data = yaml.load(f, Loader=yaml.CSafeLoader)
AttributeError: module 'yaml' has no attribute 'CSafeLoader'. Did you mean: 'SafeLoader'?
root@ubuntu-server:/# python3
imPython 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'5.3.1'
>>> quit()
root@ubuntu-server:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"

I believe this is caused by the PATH:

root@ubuntu-server:/# echo $PATH
/snap/subiquity/3361/bin:/snap/subiquity/3361/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
root@ubuntu-server:/# echo $PYTHONPATH
/snap/subiquity/3361/lib/python3.8/site-packages

Overriding the settings allowed me to `netplan apply` and carry on as expected, but I don't think we want users to have to debug unexpected environment variables when they are trying to troubleshoot the system.