yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #88896
[Bug 1969526] Re: cc-ssh: traceback when openssh-server absent
This bug is believed to be fixed in cloud-init in version 22.2. If this
is still a problem for you, please make a comment and set the state back
to New
Thank you.
** Changed in: cloud-init
Status: Triaged => Fix Released
--
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/1969526
Title:
cc-ssh: traceback when openssh-server absent
Status in cloud-init:
Fix Released
Bug description:
In minimal cloud images without openssh-server, cloud-init will get
the following traceback when the following cloud-config is provided:
```
#cloud-config
ssh_pwauth: true
```
2022-04-19 20:42:32,593 - stages.py[DEBUG]: Running module set-passwords (<module 'cloudinit.config.cc_set_passwords' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py'>) with frequency once-per-instance
2022-04-19 20:42:32,593 - handlers.py[DEBUG]: start: modules-config/config-set-passwords: running config-set-passwords with frequency once-per-instance
2022-04-19 20:42:32,593 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/rocky-8/sem/config_set_passwords - wb: [644] 24 bytes
2022-04-19 20:42:32,593 - helpers.py[DEBUG]: Running config-set-passwords using lock (<FileLock using file '/var/lib/cloud/instances/rocky-8/sem/config_set_passwords'>)
2022-04-19 20:42:32,594 - ssh_util.py[DEBUG]: line 1: option PasswordAuthentication added with no
2022-04-19 20:42:32,594 - util.py[DEBUG]: Writing to /etc/ssh/sshd_config - wb: [644] 26 bytes
2022-04-19 20:42:32,594 - subp.py[DEBUG]: Running command ['service', 'sshd', 'restart'] with allowed return codes [0] (shell=False, capture=True)
2022-04-19 20:42:32,620 - handlers.py[DEBUG]: finish: modules-config/config-set-passwords: FAIL: running config-set-passwords with frequency once-per-instance
2022-04-19 20:42:32,621 - util.py[WARNING]: Running module set-passwords (<module 'cloudinit.config.cc_set_passwords' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py'>) failed
2022-04-19 20:42:32,621 - util.py[DEBUG]: Running module set-passwords (<module 'cloudinit.config.cc_set_passwords' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 876, in _run_modules
freq=freq)
File "/usr/lib/python3.6/site-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python3.6/site-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py", line 234, in handle
service_name=cloud.distro.get_option('ssh_svcname', 'ssh'))
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py", line 131, in handle_ssh_pwauth
subp.subp(cmd)
File "/usr/lib/python3.6/site-packages/cloudinit/subp.py", line 295, in subp
cmd=args)
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['service', 'sshd', 'restart']
Exit code: 5
Reason: -
Stdout:
Stderr: Redirecting to /bin/systemctl restart sshd.service
Failed to restart sshd.service: Unit sshd.service not found.
While one could argue that cloud images without openssh-server might
have limited utility, there are use cases for slim apps/micro-services
that may not rely on this stack and cloud-init should probably cope
better in the face of this missing dependency.
While working this issue, let's add a Suggests: openssh-server to
debian/control for Deb-based systems.
--- Steps to reproduce problem
cat > ssh_needed.yaml << EOF
#cloud-config
ssh_pwauth: true
EOF
lxc launch ubuntu-daily:focal f1 -c user.user-data="$(cat ssh_needed.yaml)"
lxc exec f1 -- cloud-init status --wait
lxc exec f1 apt remove opensssh-server
# reset PasswordAuthentication off again so that cloud-init wants to reset ssh server
lxc exec f1 -- sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
# force clean reboot so cloud-init reruns
lxc exec f1 -- cloud-init clean --logs --reboot
lxc exec f1 -- cloud-init status --wait --long
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1969526/+subscriptions
References