4.8 KiB
Ubuntu Serial or USB Console
For systemd, (Xenial, Stretchm etc. try this recipe
Make desktop system into a server
If you want to neuter your desktop install (all that may be available for xenial or stretch, t
Be sure /etc/network/interfaces is properly configured and test it!
Then
# apt-get purge network-manager\*
Tell systemd you want a text, not graphical, console
The voodoo for telling systemd that you want a text console instead of X11 is:
# systemctl set-default multi-user.target
/etc/default/grub
Edit /etc/default/grub to have
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,9600n8"
...
GRUB_TERMINAL=console
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
If you set GRUB_TERMINAL to serial instead of console, the GRUB boot dialog should show up on the serial console.
You can toss glorp in to change the name of the ethers to good old ethN
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 console=tty0 console=ttyS0,9600n8"
And reconfigure grub
# update-grub
At this point you should reboot, because the GRUB configuration doesn't have much effect until the next boot.
Sometimes the above is insufficient, as systemd needs to be further pacified. Try the reboot first, but if that doesn't work:
cat > /lib/systemd/system/ttyS0.service << EOF
[Unit]
Description=Serial Console Service
[Service]
ExecStart=/sbin/getty -L 115200 ttyS0 vt102
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable ttyS0
systemctl start ttyS0
Done
systemd will automatically start a getty on the console if it thinks the console exists. If there's no getty, it's probably because systemd doesn't think that's the console. In wp's case, systemd was right about this: a serial port that doesn't exist probably is not the console.
For upstart-based systems
/etc/default/grub
Hack a new /etc/default/grub, being sure to run update-grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=6
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,9600n8"
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
Be sure to run update-grub
/etc/init/ttyS0.conf
Hack /etc/init/ttyS0.conf as follows"
# ttyS0 - getty
start on stopped rc or RUNLEVEL=[12345]
stop on RUNLEVEL=[!12345]
respawn
exec /sbin/getty -L 115200 ttyS0
For trusty, just try
start ttyS0
If you have an /etc/inittab, uncomment
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
And you can kick off the getty without reboot
start ttyS0
For Non_Ganeti (Old)
This is old. See The Official Ubuntu Hack for modern penguins.
Assuming there is also a video card you want to support, edit /boot/grub/grub.cfg to add
console=tty0 console=ttyS0,9600n8
as in
linux /boot/vmlinuz-3.5.0-40-generic root=UUID=11b8206e-6eed-4adf-83d8-e03e712d4c51 ro console=tty0 console=ttyS0,9600n8
If it is a USB console, it will be
console=tty0 console=ttyUSB0,9600n8
Now, next boot of the server should be visible on the serial (and video) console.
To get a normal getty running, create /etc/event.d/ttyS0 with the following content:
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /sbin/getty -L 9600 ttyS0 vt102
Analogously for /etc/event.d/ttyUSB0.
Of course, baud rate should be adjusted to taste.