Bug 977952

Summary: RFE: disable all direct writes to the console
Product: [Fedora] Fedora Reporter: Matthew Miller <mattdm>
Component: cloud-initAssignee: Garrett Holmstrom <gholms>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: apevec, gholms, herrold, Jan.van.Eldik, kchamart, mattdm, p
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cloud-init-0.7.2-7.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-18 19:54:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Miller 2013-06-25 16:22:54 UTC
cloud-init has code which opens /dev/console directly and writes output to it. This causes two problems:

1. Utter failure of cloud-init if the console device happens to not exist
2. Messages interspersed randomly with other console output

The former is a problem when attempting to ship one cloud image which works in multiple environments. The latter is a problem if one is hoping to mine the output for machine-parseable info -- it could be corrupt.

I think the solution here is to tell cloud-init to never open /dev/console. I think this is most easily achieved with the big hammer of patching out the /dev/console bit from the multi_log function in ./cloudinit/util.py, but am open to more elegant solutions.

_Then_, we do one of the following:

A. Use StandardOutput=syslog+console in the systemd service files (and actually remove the log call in multi_log as well)

or

B. Use the systemd option to write _all_ journal log data to the console.

"A" is the more narrow solution, of course. "B" would result in much more information being written to the console and thus available through API calls.

Comment 1 Garrett Holmstrom 2013-09-20 02:13:06 UTC
I replaced multi_log's writes to /dev/console with simple print statements that go to stdout and switched the .service files over to StandardOutput=journal+console (syslog continues to be more verbose and handled normally), but messages don't actually appear to show up on the console unless the one appropriate for the cloud in question happens to be the last one on the kernel command line.  F20 alpha RC 3 puts console=tty0 last, so EC2 sees no cloud-init output at all unless I swap that with console=hvc0.

Do you happen to know if this is a systemd thing or a linux thing?

Comment 2 Matthew Miller 2013-09-20 12:48:21 UTC
That is a linux thing. I think we need to figure out how to put hvc0 last for EC2.

Actually, although it's pretty super-ugly, I know one way -- put hvc0 there for pvgrub, and use tty0 for syslinux. At least for EC2 -- does that help at all in Eucalyptus?

Comment 3 Fedora Update System 2013-09-25 02:41:37 UTC
cloud-init-0.7.2-6.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/cloud-init-0.7.2-6.fc20

Comment 4 Fedora Update System 2013-09-25 02:42:57 UTC
cloud-init-0.7.2-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/cloud-init-0.7.2-6.fc19

Comment 5 Fedora Update System 2013-09-27 00:44:25 UTC
Package cloud-init-0.7.2-7.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cloud-init-0.7.2-7.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17724/cloud-init-0.7.2-7.fc19
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-09-27 01:19:54 UTC
cloud-init-0.7.2-7.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/cloud-init-0.7.2-7.fc18

Comment 7 Fedora Update System 2013-10-15 06:28:39 UTC
cloud-init-0.7.2-7.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2013-10-18 19:46:14 UTC
cloud-init-0.7.2-7.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2013-10-18 19:54:30 UTC
cloud-init-0.7.2-7.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.