← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1969526] [NEW] cc-ssh: traceback when openssh-server absent

 

Public bug reported:

In minimal cloud images without openssh-server, cloud-init will get the
following traceback.


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.

** Affects: cloud-init
     Importance: Low
         Status: Triaged


** Tags: bitesize

** Changed in: cloud-init
   Importance: Undecided => Low

-- 
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:
  Triaged

Bug description:
  In minimal cloud images without openssh-server, cloud-init will get
  the following traceback.


  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.

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



Follow ups