Add a getty/login prompt on ttyS0 cloud images

Bug #1220740 reported by Alessandro Pilotti
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-images
Fix Released
Wishlist
Robert C Jennings

Bug Description

Most hypervisors have the option to connect to guests via serial port. Adding a console on ttyS0 is particularly helpful for troubleshooting purposes.

Example:

/bin/sed -i 's/rhgb quiet/quiet console=tty0 console=ttyS0,115200n8/g' /boot/grub/grub.conf

/bin/sed -i 's/^hiddenmenu$/hiddenmenu\nserial\ --unit=0\ --speed=115200\ --word=8\ --parity=no\ --stop=1\nterminal\ --timeout=5\ console\ serial/g' /boot/grub/grub.conf

tags: added: cloud-images
tags: added: cloud-images-build
description: updated
Scott Moser (smoser)
summary: - Add a ttyS0 console in cloud images
+ Add a getty/login prompt on ttyS0 cloud images
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1220740/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Changed in ubuntu:
importance: Undecided → Wishlist
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

The problem here is that if you configure grub for the serial console, you don't get it for on the terminal. I am not opposed to making the change, but this would enable some users at the risk of breaking others.

http://www.gnu.org/software/grub/manual/html_node/Serial-terminal.html

Indicates that you can have both, but "In this case, a terminal in which you press any key will be selected as a GRUB terminal. "

With out testing, I'm not sure that we can it both ways with out breaking a user.

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Also, I might add that starting with 12.10, the Cloud Images are configured in appliance mode -- unless there is a problem, the images will boot immediately with out a grub timeout unless there is a problem.

Changed in ubuntu:
assignee: nobody → Ben Howard (utlemming)
Changed in ubuntu:
milestone: none → ubuntu-14.04-beta-1
Revision history for this message
Robert C Jennings (rcj) wrote :

I believe that this could work if we launch getty with something like this in /etc/init/ttyS0.conf :
# ttyS01 - getty
#
# This service maintains a getty on ttyS01 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

pre-start script
  # getty will not be started if the serial console is not present
  stty -F /dev/ttyS0 -a 2> /dev/null > /dev/null || { stop ; exit 0; }
end script

respawn
script
  exec /sbin/getty -L 115200 ttyS01
end script

Without the pre-start, configuring a console on ttyS0 for upstart in /etc/init/ttyS0.conf for instances that do not have a serial console present will result in getty repeatedly failing and respawning and the failures would clutter up /var/log/auth.log with messages like:

Jan 10 21:34:22 test-system getty[1163]: /dev/ttyS0: not a character device
Jan 10 21:34:33 test-system getty[1186]: /dev/ttyS0: not a character device
Jan 10 21:34:43 test-system getty[1200]: /dev/ttyS0: not a character device
Jan 10 21:34:53 test-system getty[1211]: /dev/ttyS0: not a character device
Jan 10 21:35:03 test-system getty[1223]: /dev/ttyS0: not a character device
Jan 10 21:35:13 test-system getty[1235]: /dev/ttyS0: not a character device

Revision history for this message
Robert C Jennings (rcj) wrote :

Adding this for Trusty in x86/amd64. Testing the patch now.

Revision history for this message
Robert C Jennings (rcj) wrote :

Fix merged and awaiting next image build to verify release.

Changed in ubuntu:
assignee: Ben Howard (utlemming) → Robert Jennings (rcj4747)
status: New → Fix Committed
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Validated 14.04 daily build in both EC2 and in KVM. I've confirmed that ttyS0 is present on systems with a serial console, while not doing anything on systems with out a ttyS0.

This fix should roll out to 12.04 released images in the next few weeks. Marking as "fix released."

Changed in ubuntu:
status: Fix Committed → Fix Released
Revision history for this message
Vincent Bernat (vbernat) wrote :

Ben, I am looking at the latest 12.04 cloud images and it doesn't seem to have that. Could you check?

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Vincent, can you provide more information? ttyS0 will appear if the device is found. After smoke-checking, it should indeed be there. Can you provide a console log and the cloud where you are seeing this (if its a public cloud) or the hypervisor?

Mathew Hodson (mhodson)
affects: ubuntu → cloud-images
Changed in cloud-images:
milestone: ubuntu-14.04-beta-1 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.