How-To set up a serial console on Debian
2017-01-11 15:13
411 查看
转自:https://www.debuntu.org/how-to-set-up-a-serial-console-on-debian/
This tutorial will go over the steps to go through in order to set up a
serial console on Debian Linux.
Debian uses sysvinit to handle the booting process, amongst the different task, and as such, there is a few differences between most of the tutorial that you might find on the internet regarding how to set up a serial console.
A Serial Console becomes handy when running a headless server (i.e no keyboard and screen) or if you cannot connect a a server because of a network issue.
In this tutorial, we will set up a serial console on the
server, the machine we want an access to. Setting up a serial console client will be covered in another article.
//本地console口
$ dmesg | grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
From this output, we can guess that there is 2 serial interface2 (/dev/ttyS0 and
/dev/ttyS1). This tutorial considers that you are using device 1 (ttyS0), if you use the second device, you will need to change ttyS0 by ttyS1.
A serial console on ttyS0Have kernel booting messages output to the serial console
Make Grub outputs to the serial console
getty on the serial device. getty will take care of prompting the user for a username and password.
//设置开机配置环境,强制console口运行环境
Go and edit /etc/inittab and add:
just below:
Now, run:
# init q
In order to have sysvinit re-read its configuration and spawn a getty on
/dev/ttyS0 .
To authorize root to log in through the serial console, you need to edit /etc/securetty and make sure you have:
In the section before the different kernels. This will take care of having grub being displayed one the serial console so you can actually modify grub through the serial console or boot using another kernel.
If using ttyS1, then change it to --unit=1
Also, in order to get the booting messages outputted to the serial console, you can append to your
kernel line the following:
So, finally, the kernel line will look like:
That's it, upon next reboot, you will be able to connect directly to your box using a serial console!.
How-To set up a serial console client
How To: Installing Debian Etch From a running Debian based system — page 2
How-To: Set up a LAN gateway with DHCP, Dynamic DNS and iptables on Debian Etch — page 2 — DNS server
Tags: system
This entry was posted on Saturday, May 3rd, 2008 at 2:26 pm and is filed under Administration, HowTo, System. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
This tutorial will go over the steps to go through in order to set up a
serial console on Debian Linux.
Debian uses sysvinit to handle the booting process, amongst the different task, and as such, there is a few differences between most of the tutorial that you might find on the internet regarding how to set up a serial console.
A Serial Console becomes handy when running a headless server (i.e no keyboard and screen) or if you cannot connect a a server because of a network issue.
In this tutorial, we will set up a serial console on the
server, the machine we want an access to. Setting up a serial console client will be covered in another article.
1. Checking the serial devices
In order to find which devices are available on a box, you can run://本地console口
$ dmesg | grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
From this output, we can guess that there is 2 serial interface2 (/dev/ttyS0 and
/dev/ttyS1). This tutorial considers that you are using device 1 (ttyS0), if you use the second device, you will need to change ttyS0 by ttyS1.
2. Setting up the serial console on the server
On the server, we are going to set up:A serial console on ttyS0Have kernel booting messages output to the serial console
Make Grub outputs to the serial console
2.1. The serial console
To set up a serial console, We need to edit the file called /etc/inittab in order to spawn agetty on the serial device. getty will take care of prompting the user for a username and password.
//设置开机配置环境,强制console口运行环境
Go and edit /etc/inittab and add:
s0:2345:respawn:/sbin/getty -L 115200 ttyS0 vt102
just below:
1:2345:respawn:/sbin/getty 38400 tty1 2:23:respawn:/sbin/getty 38400 tty2 3:23:respawn:/sbin/getty 38400 tty3 4:23:respawn:/sbin/getty 38400 tty4 5:23:respawn:/sbin/getty 38400 tty5 6:23:respawn:/sbin/getty 38400 tty6
Now, run:
# init q
In order to have sysvinit re-read its configuration and spawn a getty on
/dev/ttyS0 .
To authorize root to log in through the serial console, you need to edit /etc/securetty and make sure you have:
ttyS0
2.2. Having grub outputting to ttyS0
grub can be configured to output on the serial console.Edit grub and add:serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console
In the section before the different kernels. This will take care of having grub being displayed one the serial console so you can actually modify grub through the serial console or boot using another kernel.
If using ttyS1, then change it to --unit=1
Also, in order to get the booting messages outputted to the serial console, you can append to your
kernel line the following:
console=ttyS0,115200n8 console=tty0
So, finally, the kernel line will look like:
kernel /boot/vmlinuz-2.6.18-6-686 root=/dev/sda1 ro console=ttyS0,115200n8 console=tty0
That's it, upon next reboot, you will be able to connect directly to your box using a serial console!.
Related posts:
How-To set up a serial console on UbuntuHow-To set up a serial console client
How To: Installing Debian Etch From a running Debian based system — page 2
How-To: Set up a LAN gateway with DHCP, Dynamic DNS and iptables on Debian Etch — page 2 — DNS server
Tags: system
This entry was posted on Saturday, May 3rd, 2008 at 2:26 pm and is filed under Administration, HowTo, System. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
相关文章推荐
- CenterWindow()的用法
- 开通博客了 定个小目标
- 使用kettle工具将文本文件的内容插入Linux虚拟机下的mysql表中
- [leetcode]70. Climbing Stairs
- Java遍历对象属性(反射实现)
- bootstrap input 下拉树 下拉菜单 下拉列表
- iOS UILabel text两边对齐
- SSM框架——使用MyBatis Generator自动创建代码
- android webview与H5混合开发,webview自定义缓存
- bootstrap/angularjs 日期控件
- 设置tomca访问页面直接是指定页面
- OC 第一个OC类
- 谈谈new Thread的弊端及Java四种线程池的使用
- 前端好的工具集推荐 lodash
- FSDB Dumper
- linux查看CPU的相关命令
- cookies的用法
- my代码跟踪之driver_register
- (OK) 救砖:华为全网通 honor 5x - KIW-AL10 线刷 + 卡刷 (KIW-AL10C00B258-back-from-B430)
- 编译udhcpc for ARM_linux