yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #88161
[Bug 1959400] [NEW] apt module crashes on devices without a hardware clock
Public bug reported:
Back in 2016 the ntp module was moved after the apt module, because it
was reasoned that if ntp configuration was requested and the ntp package
was not installed it would be a deadlock situation (here:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1628337)
However, running the apt module requires having the correct time on the
system, and this is only possible with a hardware clock. Devices such as
the Raspberry Pi do not have one and rely solely on ntp (which is
already preinstalled) to get the time, thus in this case the ntp module
must run before apt (example of the problem:
https://forums.raspberrypi.com/viewtopic.php?t=315089)
Breakage from the cloud-init.log pasted in the Raspberry Forums:
=====
2021-07-02 20:12:33,579 - util.py[WARNING]: Running module package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py'>) failed
2021-07-02 20:12:33,579 - util.py[DEBUG]: Running module package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 848, in _run_modules
ran, _r = cc.run(run_name, mod.handle, func_args,
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 124, in handle
raise errors[-1]
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 100, in handle
cloud.distro.install_packages(pkglist)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 112, in install_packages
self.package_command('install', pkgs=pkglist)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 199, in package_command
util.log_time(logfunc=LOG.debug,
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2318, in log_time
ret = func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 293, in subp
raise ProcessExecutionError(stdout=out, stderr=err,
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['eatmydata', 'apt-get', '--option=Dpkg::Options::=--force-confold', '--option=Dpkg::options::=--force-unsafe-io', '--assume-yes', '--quiet', 'install', 'apt-transport-https', 'syncthing']
=====
I'm not entirely sure what the fix should be, both orderings make sense
but it depends on the situation. What I'm currently doing is editing the
cloud.cfg file manually to move up the ntp module (i.e. I undo the 2016
patch by hand) before booting my Raspberry for the first time.
** Affects: cloud-init
Importance: Undecided
Status: New
--
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/1959400
Title:
apt module crashes on devices without a hardware clock
Status in cloud-init:
New
Bug description:
Back in 2016 the ntp module was moved after the apt module, because it
was reasoned that if ntp configuration was requested and the ntp
package was not installed it would be a deadlock situation (here:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1628337)
However, running the apt module requires having the correct time on
the system, and this is only possible with a hardware clock. Devices
such as the Raspberry Pi do not have one and rely solely on ntp (which
is already preinstalled) to get the time, thus in this case the ntp
module must run before apt (example of the problem:
https://forums.raspberrypi.com/viewtopic.php?t=315089)
Breakage from the cloud-init.log pasted in the Raspberry Forums:
=====
2021-07-02 20:12:33,579 - util.py[WARNING]: Running module package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py'>) failed
2021-07-02 20:12:33,579 - util.py[DEBUG]: Running module package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 848, in _run_modules
ran, _r = cc.run(run_name, mod.handle, func_args,
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 124, in handle
raise errors[-1]
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 100, in handle
cloud.distro.install_packages(pkglist)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 112, in install_packages
self.package_command('install', pkgs=pkglist)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 199, in package_command
util.log_time(logfunc=LOG.debug,
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2318, in log_time
ret = func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 293, in subp
raise ProcessExecutionError(stdout=out, stderr=err,
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['eatmydata', 'apt-get', '--option=Dpkg::Options::=--force-confold', '--option=Dpkg::options::=--force-unsafe-io', '--assume-yes', '--quiet', 'install', 'apt-transport-https', 'syncthing']
=====
I'm not entirely sure what the fix should be, both orderings make
sense but it depends on the situation. What I'm currently doing is
editing the cloud.cfg file manually to move up the ntp module (i.e. I
undo the 2016 patch by hand) before booting my Raspberry for the first
time.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1959400/+subscriptions
Follow ups