2014年4月10日 星期四

linux Console_Redirection -RHEL 6.x

linux Console_Redirection -RHEL 6.x

步驟一:編輯 /boot/grub/menu.lst   (legacy mode)
                           /boot/efi/EFI/redhat/grub.conf (UEFI mode)
在 title ..... 上方,加上

## Enable serial console
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

這行前面加上註解

#splashimage=(hd0,1)/boot/grub/splash.xpm.gz

找到實際開機所需的那一行,例如是

title CentOS-4 i386-up (2.6.9-34.0.2.EL)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.9-34.0.2.EL ro root=LABEL=/1
        initrd /boot/initrd-2.6.9-34.0.2.EL.img

在 kernel 後方加上 console=tty0 console=ttyS0,9600n8

kernel /boot/vmlinuz-2.6.9-34.0.2.EL ro root=LABEL=/1 console=tty0 console=ttyS0,9600n8
步驟二:編輯 /etc/inittab最下方加上這行

# Enable serial console
sc:2345:respawn:/sbin/agetty ttyS0 115200,9600 xterm

步驟三: 系統預設是不予許 root 直接從 serial console 登入,這樣造成管理不是很方便,所以修改一下設定。
編輯 /etc/securetty,最底下加上
ttyS0

若在Redhat 6的系統發生進入OS發生亂碼
那是因為安裝了tboot套件
可將grub.conf做修改

Removing tboot after installation

1) Using grubby add the existing kernel
# ARGS=$(grep "^[[:space:]]*module /vmlinuz-$(uname -r)" /boot/grub/grub.conf | sed -e 's/^.*x86_64 //' | head -n 1)

# grubby --add-kernel=/boot/vmlinuz-$(uname -r) --args="${ARGS}" --initrd=/boot/initramfs-$(uname -r).img --make-default --title "Red Hat Enterprise Linux without tboot ($(uname -r))"

# grep -v ^# /boot/grub/grub.conf 
default=0
timeout=5
serial --unit=0 --speed=115200
terminal --timeout=5 serial console
title Red Hat Enterprise Linux without tboot (2.6.32-358.el6.x86_64
    kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg00-root intel_iommu=on rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg00/root crashkernel=auto crashkernel=auto console=ttyS0,115200 rd_NO_DM
    initrd /initramfs-2.6.32-358.el6.x86_64.img
title Red Hat Enterprise Linux (2.6.32-358.el6.x86_64)
    root (hd0,0)
    kernel /tboot.gz logging=vga,serial,memory
    module /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg00-root intel_iommu=on rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg00/root crashkernel=auto crashkernel=auto console=ttyS0,115200 rd_NO_DM
    module /initramfs-2.6.32-358.el6.x86_64.img
2) Remove the tboot kernel
# grubby --remove-kernel=/boot/tboot.gz

# grep -v ^# /boot/grub/grub.conf 
default=0
timeout=5
serial --unit=0 --speed=115200
terminal --timeout=5 serial console
title Red Hat Enterprise Linux without tboot (2.6.32-358.el6.x86_64
    kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg00-root intel_iommu=on rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg00/root crashkernel=auto crashkernel=auto console=ttyS0,115200 rd_NO_DM
    initrd /initramfs-2.6.32-358.el6.x86_64.img
  • Now can remove tboot, as not in use by grub.





沒有留言:

張貼留言

(TOP)Temp for soulin only

123