Redirigere la console linux su tty

  • strict warning: Non-static method view::load() should not be called statically in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/views.module on line 1113.
  • strict warning: Declaration of views_handler_argument::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_argument::query() should be compatible with views_handler::query($group_by = false) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_sort::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::query() should be compatible with views_handler::query($group_by = false) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_handler_filter::query() should be compatible with views_handler::query($group_by = false) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_plugin_query::options_submit() should be compatible with views_plugin::options_submit($form, &$form_state) in /web/htdocs/www.rfc.it/home/drupal/sites/all/modules/views/plugins/views_plugin_query.inc on line 169.

In caso di problemi, o in mancanza di monitor tastiera, può essere comodo redirigere l’output della console su un terminale tty (hyper terminal o qualcosa di simile).
Nel mio caso la macchina dava problemi al boot, la console classica erra incontrollabile e l’output scrollava velocemente impedendone la visualizzazione, quindi ho voluto redirigere laconsole e catturare l'output.
L'operazione relativamente semplice. Occorre in cavo seriale, da Linux a PC - o terminale- un cavo incrociato (null modem). Il nome della tty è nei messaggi di boot:

dmesg | grep tty

xen-test:~ # dmesg | grep tty
[    0.000000] console [tty0] enabled
[    0.297603] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.297993] 00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
xen-test:~ #

Poi modificare i parametri di boot (/boot/grub/menu.lst) aggiungendo ai parametri di boot le opzioni:

console=ttyS0 console=ttyS0,9600

 

title SUSE Linux Enterprise Server 11 SP2 - 3.0.93-0.5 console tty
    root (hd0,1)
    kernel /boot/vmlinuz-3.0.93-0.5-default root=/dev/sda1 vga=0x317 console=tty0 console=ttyS0,9600
    initrd /boot/initrd-3.0.93-0.5-default


Nel caso di XEN:

title Xen -- console tty - 3.0.93-0.5
    root (hd0,1)
    kernel /boot/xen.gz vga=mode-0x317 noapic console=vga,com1 com1=9600
    module /boot/vmlinuz-3.0.93-0.5-xen root=/dev/sda1 vga=0x317 console=ttyS0 console=xvc0,9600
    module /boot/initrd-3.0.93-0.5-xen

Ovviamente ttyS0 è il nome della tty, da dmesg si vede l'indirizzo hardware 0x3f8 tipico di una com1:

Il parametro 9600 si riferisce alla velocità della seriale e può essere modificato secondo necessità.

L’esempio si riferisce ad un server SLES

Se l’avvio ha problemi, le modifiche si possono fare avviando la macchina con un CD Linux live, montando il disco di root su una directory (la classica /mnt) per modificare il fiel di boot.