Size: 9426
Comment: trick to avoid conflicts
|
Size: 9398
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 169: | Line 169: |
{{{ GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8" }}} {{{{#!wiki important Attention! Dans Xen, il faut plutôt configurer la console série de '''Xen'''!!! Utilisez ceci au lieu de la première ligne: {{{ GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=hvc0 console=hvc1 earlyprintk=xen" GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M,max:512M com1=115200,8n1 com2=115200,8n1 console=com1,com2,vga" }}} [[http://wiki.xen.org/wiki/Xen_Serial_Console|source]] }}}} |
On the servers that the console works, like venus, there is: {{{ GRUB_CMDLINE_LINUX="console=tty0,115200n8 console=ttyS0,115200n8 console=ttyS1,115200n8" GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=750M,max:750M console=tty0,115200n8 console=ttyS0,115200n8 console=ttyS1,115200n8" GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 console=tty0 console=hvc1 earlyprintk=xen" GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M,max:512M com1=115200,8n1 com2=115200,8n1 console=com1,com2,vga" }}} |
Contents
Voir aussi ConsoleSérieMaintenance.
Connecter au serveur de console
Required
- SSH Client
- Access Credentials
Connecting
Connect to the console switch using your username, password and port number
Using your SSH client, connect to the desired serial console and port.
ssh user@cs2.koumbit.net -p 3101
Enter your password.
user@cs2.koumbit.net's password:
Assuming your password is correct, you will be re-directed and automatically connected to the port specified earlier.
Hewlett-Packard HPSCS16 S/W Version 1.9 Connected to Port: 2 115200,8,N,1,NONE 61 bytes available in history buffer Debian GNU/Linux 5.0 shell.koumbit.net tty1 shell.koumbit.net login:
You may have to send some input to trigger a response from the console.
You may not be able to use vi properly... If the screen is garbled, try to reset your TERM variable, like this:
export TERM=screen
Disconnecting
Disconnecting from your session
When you wish to disconnect, you may either close your SSH client (the serial console will eventually figure out the hanging terminal and end the session) or press Control+D, then enter quit at the > prompt.
shell.koumbit.net login: <Control+D> Entering Command Mode > quit Session Terminated
For additional information, refer to ConsoleSérieService/hp-scs-users-guide.pdf
Hard resets
Sending the Skinny Elephants signals can be done by sending a break signal to the serial console. On the HP serial console devices, you can send a break signal with ctrl-D followed by port break followed by resume. Do these in rapid succession so you can send the control character quickly thereafter. You might prefer to write all your commands into a text file and then copy/paste to the ssh session.
Here is an example of serial console output sending h after the magic sysrq (to get a help listing):
monkey login: Entering Command Mode > port break > resume Connected to Port: 1 115200,8,N,1,NONE 63310 bytes available in history buffer [ 1268.051544] SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I) thaw-filesystems(J) saK show-backtrace-all-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) powerOff show-registers(P) show-all-timers(Q) unRaw Sync show-task-states(T) Unmount show-blocked-tasks(W) dump-ftrace-buffer(Z) Debian GNU/Linux 6.0 monkey ttyS0 monkey login:
See HardReset for the details of the specific signals you can send.
How to configure your server to be accessible through the a serial console
Linux servers
There is an excellent howto about remote serial consoles, however it covers more stuff than what we actually need. The breakdown is actually quite simple. there are three different parts (ignoring the BIOS here): the console (the login prompt you usually see when you boot your OS), the kernel (linux here) and the boot loader (grub).
Debian Jessie is using systemd to manage services, it also changes how to enable the serial console!
There is a bug in the jessie installer, when the install is done from the serial console, the parameter to enable stoutput to serial console is not activated... Debian bug 769406
Operating system with systemd
If the serial port connected is ttyS0, you can run the following commands, but make sure that the kernel has already been configure to output to the serial console.
# systemctl enable serial-getty@ttyS0.service # systemctl start serial-getty@ttyS0.service
Operating system without systemd
Configure the console tty
This configures a login terminal to popup on the serial console port.
Add this line (or uncomment) in /etc/inittab:
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
Then use the traditionnal kill -1 1 to tell init to reload inittab.
Vérifier avec la commande :
# ps -ax | grep getty
Here you should already have your login console on the serial console, this allows you to quickly test without rebooting
Configure the kernel
Then you configure the kernel to also show up on the serial console. The argument to pass the kernel is console=tty0 console=ttyS0,115200n8, for the console to appear both on the serial console and regular VGA console. This is differently done in Grub 1 and 2.
In grub 1
In /boot/grub/menu.list, you need to add console=tty0 console=ttyS0,115200n8 on the kernel line:
kernel /vmlinuz-2.4.9-21 ro root=/dev/hda6 console=tty0 console=ttyS0,115200n8
For this to survive Debian kernel upgrades, you also need to add those to the kopt line in /boot/grub/menu.list:
# kopt=root=/dev/mapper/ceres-root ro console=tty0 console=ttyS0,115200n8
Then run update-grub to apply the new parameters to the current kernel installed in the grub menu.lst
In grub 2
Make sure those lines are present in /etc/default/grub:
On the servers that the console works, like venus, there is:
GRUB_CMDLINE_LINUX="console=tty0,115200n8 console=ttyS0,115200n8 console=ttyS1,115200n8" GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=750M,max:750M console=tty0,115200n8 console=ttyS0,115200n8 console=ttyS1,115200n8" GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 console=tty0 console=hvc1 earlyprintk=xen" GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M,max:512M com1=115200,8n1 com2=115200,8n1 console=com1,com2,vga"
Then rerun update-grub2.
Configure the bootloader
To configure grub to show up on the serial console, add this on top of /boot/grub/menu.list:
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console
Grub 2
# Uncomment to disable graphical terminal (grub-pc only) GRUB_TERMINAL=serial GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
Si c'est le COM2 qu'on utilise, changez pour --unit=1:
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"
Configure the BIOS
Configuring the BIOS and other operating systems is not covered here yet.
Ensuite, certains serveurs offrent la possibilité d'envoyer le output du bios vers le port série, c'est a vérifier cas par cas dans le bios de chaque machine.
FreeBSD
As documented in the advanced guide, we can easily configure FreeBSD to boot from the serial console, which will just show up in the terminal in qemu, very handy.
Enable serial console in /etc/ttys by editing the ttyu0 entry. The ttyu0 line should appear like the following;
ttyu0 "/usr/libexec/getty std.115200" vt100 on secure
Be sure to disable the other tty's listed by changing the value on to off otherwise you'll see errors when booting.
Edit /boot/loader.conf (It may be empty) and add the following;
boot_multicons="YES" boot_serial="YES" comconsole_speed="115200" console="comconsole,vidconsole"
add the following line to /boot.config:
-D -S115200
memtest86
To run memtest86+ on the serial console, you need to add this parameter: console=ttyS0,115200n8, for example, in grub:
menuentry "Memory test (memtest86+, serial console 115200)" { linux16 /boot/memtest86+.bin console=ttyS0,115200n8 }
How to access a console using the USB port
In Linux command line:
screen /dev/ttyUSB0 115200
To exit and kill the screen:
<CTRL+a> <k>
Having two screen sessions connected to the same serial console device creates weird conflits that break screen feedback and keyboard interactivity. In order to avoid those issues you can use the following command, which will create a screen session only if there's none, otherwise you'll be reconnected to the current screen session:
devnum=2; if fuser -s /dev/ttyUSB$devnum; then screen -x; else screen /dev/ttyUSB$devnum 115200; fi