-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloud-init-local.service messages not written to /var/log/cloud-init.log in systemd #2768
Comments
Launchpad user Scott Moser(smoser) wrote on 2016-11-22T19:23:59.442250+00:00 I'm going to merge https://code.launchpad.net/~harlowja/cloud-init/+git/cloud-init/+merge/301729 to fix this bug. |
Launchpad user Scott Moser(smoser) wrote on 2016-12-23T17:36:07.759150+00:00 This is fixed in cloud-init 0.7.9. |
Launchpad user Brian Murray(brian-murray) wrote on 2017-01-12T19:48:07.236423+00:00 Hello Scott, or anyone else affected, Accepted cloud-init into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.8-68-gca3ae67-0ubuntu1~16.10.1 in a few hours, and then in the -proposed repository. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance! |
Launchpad user Scott Moser(smoser) wrote on 2017-01-20T15:24:01.974344+00:00 $ lxc launch ubuntu-daily:yakkety y1 % head -n 1 /var/log/cloud-init.log % dpkg-query --show cloud-init % cat /etc/cloud/build.info % m=http://archive.ubuntu.com/ubuntu % apt update -q keep seed dir for lxd datasource% ( cd /var/lib/cloud && for d in ; do [ "$d" = "seed" ] && continue; rm -Rf "$d"; done ) % reboot $ lxc exec y1 /bin/bash |
Launchpad user Andy Whitcroft(apw) wrote on 2017-01-30T18:17:46.933368+00:00 The verification of the Stable Release Update for cloud-init has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions. |
Launchpad user Launchpad Janitor(janitor) wrote on 2017-01-30T18:18:12.820305+00:00 This bug was fixed in the package cloud-init - 0.7.8-68-gca3ae67-0ubuntu1~16.10.1 cloud-init (0.7.8-68-gca3ae67-0ubuntu1~16.10.1) yakkety; urgency=medium
-- Scott Moser smoser@ubuntu.com Mon, 19 Dec 2016 15:07:12 -0500 |
Launchpad user Brian Murray(brian-murray) wrote on 2017-02-06T15:44:25.325062+00:00 Hello Scott, or anyone else affected, Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-0ubuntu1~16.04.1 in a few hours, and then in the -proposed repository. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance! |
Launchpad user Brian Murray(brian-murray) wrote on 2017-02-06T21:33:22.397811+00:00 Hello Scott, or anyone else affected, Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-0ubuntu1~16.04.2 in a few hours, and then in the -proposed repository. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance! |
Launchpad user Scott Moser(smoser) wrote on 2017-02-09T02:30:01.949763+00:00 $ release=xenial $ lxc exec $name -- dpkg-query --show cloud-init $ lxc file pull $name/etc/cloud/build.info - $ lxc exec $name -- head -n 1 /var/log/cloud-init.log enable proposed, update$ m=http://archive.ubuntu.com/ubuntu; clean up to make it look like first boot.$ lxc exec $name -- sh -c 'cd /var/lib/cloud; for d in ; do [ "$d" = "seed" ] || rm -vRf "$d"; done' $ lxc exec $name -- grep WARN /var/log/cloud-init.log || echo no warn |
Launchpad user Launchpad Janitor(janitor) wrote on 2017-02-22T00:43:01.813488+00:00 This bug was fixed in the package cloud-init - 0.7.9-0ubuntu1~16.04.2 cloud-init (0.7.9-0ubuntu1~16.04.2) xenial-proposed; urgency=medium
cloud-init (0.7.9-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
-- Scott Moser smoser@ubuntu.com Mon, 06 Feb 2017 16:18:28 -0500 |
This bug was originally filed in Launchpad as LP: #1643990
Launchpad details
Launchpad user Scott Moser(smoser) wrote on 2016-11-22T19:23:07.279928+00:00
=== Begin SRU Template ===
[Impact]
Cloud-init's logging is inconsistent due to availability of syslog during
boot.
Cloud-init logs to /var/log/cloud-init.log by default. It does this in
a way that was originally designed to prefer to use syslog if it was
available, and then fall back to writing directly to that file.
Over time this has been shown to be problematic.
a.) it relied on syslog during boot, and on some distros it wasn't
present.
b.) sometimes it would not be available during cloud-init-local.service
and then would be during cloud-init.service. The result was that
the log would have two different time stamp formats (one written
by rsyslog and one by python logging).
c.) if rsyslog was used, micro seconds were not included in the log.
d.) since the move to systemd, there has even been times when cloud-init's
attempt to determine if syslog was available would false-positive.
that would result logging not being written to the file at all.
Over all, the complexity was just not found to worth the benefit.
[Test Case]
Launch an instance.
Look at /var/log/cloud-init.log.
on start, the cloud-int process logs a message like
'Cloud-init v 0.7.8 running'
Look at those messages specifically. In the example here (lxd), neither
cloud-init.service or cloud-init-local.service successfully logged at all.
grep Cloud-init /var/log/cloud-init.log
Dec 2 18:06:56 y2 [CLOUDINIT] util.py[DEBUG]: Cloud-init v. 0.7.8 running 'modules:config' at Fri, 02 Dec 2016 18:06:56 +0000. Up 5.0 seconds.
Dec 2 18:06:58 y2 [CLOUDINIT] util.py[DEBUG]: Cloud-init v. 0.7.8 running 'modules:final' at Fri, 02 Dec 2016 18:06:58 +0000. Up 7.0 seconds.
Dec 2 18:06:58 y2 [CLOUDINIT] util.py[DEBUG]: Cloud-init v. 0.7.8 finished at Fri, 02 Dec 2016 18:06:58 +0000. Datasource DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]. Up 7.0 seconds
update to proposed, cleanup reboot
enable propose and update
cleanup
sudo rm -Rf /var/log/cloud-init* /var/lib/cloud/
sudo reboot
login again and look.
This time, all messages will have the format:
2016-12-02 17:58:43,175 - util.py[DEBUG]: Cloud-init v. 0.7.8 running 'init-local' at Fri, 02 Dec 2016 17:58:43 +0000. Up 13.73 seconds.
And you will have one for each 'init-local', 'init', 'modules:config' and
modules:final.
[Regression Potential]
Users relying on cloud-init writing entries to syslog will lose that.
[Other Info]
=== End SRU Template ===
output of cloud-init-local.service can get lost in systemd.
The result is that there is no output in /var/log/cloud-init.log from cloud-init-local.service.
There is some information in https://code.launchpad.net/~harlowja/cloud-init/+git/cloud-init/+merge/301729
about how this occurrs and how it used to work.
copying part of that here:
Cloud-init's logging basically employed a "try syslog and fallback to direct log to file".
The proposed "just log to a file" is definitely dramatically simpler and advantageous in some cases.
The way the "try syslog and fallback" works (or worked) on Ubuntu up until systemd was:
a.) cloud-init init --local
1. read logging config,
2. attempt to log to syslog ([ *log_base, *log_syslog ])
3. that fail, so it log to file directly
b.) cloud-init init
1.) rsyslog would have /dev/log up functional at this point
2.) cloud-init logging config read and ends up logging to syslog
Systemd changed some things in teh way /dev/log was handled, and the above no longer worked well.
Additionally, cloud-init installs a file /etc/rsyslog.d/21-cloudinit.conf which tells rsyslog to redirect messages generated by cloud-init to /var/log/cloud-init.log
The value of doing this in this way was that we use syslog, so if the user had configured the system to log remotely, cloud-init's logs would go to that remote system as they desired.
If we directly log to a file, then cloud-init's log messages will not without further configuration go to syslog.
One other thing to be aware of is that cloud-init can itself configure rsyslog through cloudinit/config/cc_rsyslog.py . So, the user could provide in user-data some rsyslog configuration, and then the system's syslog (including cloud-init messages) would start goign to that remote server as soon as they realistically could.
The text was updated successfully, but these errors were encountered: