換了一台新筆記本,於是安裝上了最新的Ubuntu 16.10,結果從舊機器導文件過來的時候發現系統裡沒有rc.local,一下感覺醉醉的。
Google查了下,原來是1610把rc.local服務化了,看來systemd已經決心獨立了。。話說這個sysvinit流傳的下來的東東生命力確實頑強,而且真的很好用啊。
解決方法:
首先創建systemd的服務腳本
1、sudo vi /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
#sysVstart這行可以刪掉,我看啟動日志中貌似報忽略這個了。。
[Install]
WantedBy=multi-user.target
2、sudo systemctl enable rc-local.service
然後就按以前的格式編輯/etc/rc.local就好了。
最後記得chmod +x /etc/rc.local
補充:Ubuntu 16.10的網卡名更換
編輯/etc/default/grub
GRUB_CMD_LINUX="net.ifname=0 biosdevname=0"
然後
sudo grub-mkconfig -o /boot/grub/grub.cfg
後記:systemd的時代已經來臨,是時候學一波systemd服務腳本編寫了。
更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2