基於工作上, 有許多系統階/板階的測試需要執行, 有多種OS運行/重複開機的需求; 每一次啟動就需要輸入一次帳號密碼實在是惹人厭;秉持著“能坐就不站,能躺就不坐”的精神,索性就自動化處理了
思路如下:
自Ubuntu 15.04開始,常駐程式(Daemon)由systemd管理/控制;包含使用者登入
所以建立一daemon,用以辨識不同tty後執行自動登入
一般影像輸出/入共有六組tty (tty1~6), 根據需求逐一編寫config並建立deamon即可, 最後記得賦予config權限
Command: mkdir /etc/systemd/system/getty@tty1.service.d
Command: vim /etc/systemd/system/getty@tty1.service.d/override.conf
Command: chmod a+x /etc/systemd/system/getty@tty1.service.d/override.conf
最初使用mingetty套件抓取serial port並建立daemon,但發現有機率自動登入失敗
所以改變方案:
直接修改getty核心模組
Command: vim /lib/systemd/system/serial-getty\@.service
直接搜尋ExecStart
變數所在位置:
將ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 %I $TERM
註解後,在下一行增加以下指令:
ExecStart=-/sbin/agetty -a root 115200 %I $TERM
最後, 啟用system daemon
Command: systemctl enable getty@tty1.service
重新啟動驗證功能:
Pass!!
啟動後,執行狀態可用以下指令監看
Command: systemctl status getty@tty1.service
Ubuntu service
Ubuntu system file list
about getty
How To Enable Automatic Login In Ubuntu Desktop And Server
Enabling a Serial Port Console: getty systemd
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing