焼肉が食べたい

ただの日記です。技術的に学んだことも書こうと思っていますが、あくまで自分用メモです。 プロフィールはこちら。https://chie8842.github.io/aboutme/

起動スクリプトrc.localがFailする場合の対処

/etc/rc.localスクリプトで共有ディレクトリのマウント処理を行うようにしていたのだけれど、 なぜかわからないけれど、dockerを入れた後に、再起動してもマウントされなくなっていた。

source /etc/rc.local

とすると、きちんとマウントされる。 rc.localのサービスステータスを確認すると、以下のようになっていた。

chie8842@chie-no-ubuntu:~$ sudo systemctl start rc-local
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: failed (Result: exit-code) since 月 2017-03-27 14:22:15 JST; 2min 1s ago
  Process: 897 ExecStart=/etc/rc.local start (code=exited, status=32)

 3月 27 14:22:15 chie-no-ubuntu systemd[1]: Starting /etc/rc.local Compatibility...
 3月 27 14:22:15 chie-no-ubuntu rc.local[897]: mount: mount //169.254.173.204/share on /home/chie8842/share f
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Control process exited, code=exited status=32
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: Failed to start /etc/rc.local Compatibility.
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Unit entered failed state.
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Failed with result 'exit-code'.
...skipping...
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: failed (Result: exit-code) since 月 2017-03-27 14:22:15 JST; 2min 1s ago
  Process: 897 ExecStart=/etc/rc.local start (code=exited, status=32)

 3月 27 14:22:15 chie-no-ubuntu systemd[1]: Starting /etc/rc.local Compatibility...
 3月 27 14:22:15 chie-no-ubuntu rc.local[897]: mount: mount //169.254.173.204/share on /home/chie8842/share f
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Control process exited, code=exited status=32
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: Failed to start /etc/rc.local Compatibility.
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Unit entered failed state.
 3月 27 14:22:15 chie-no-ubuntu systemd[1]: rc-local.service: Failed with result 'exit-code'.

手動で起動しようとしても失敗する。

chie8842@chie-no-ubuntu:~$ sudo systemctl start rc-local
Job for rc-local.service failed because the control process exited with erro                                r code. See "systemctl status rc-local.service" and "journalctl -xe" for det                                ails.

標準出力にあるコマンドを実行してみるが、原因はわからず。

chie8842@chie-no-ubuntu:~$ sudo systemctl start rc-local.service
Job for rc-local.service failed because the control process exited with erro                                r code. See "systemctl status rc-local.service" and "journalctl -xe" for det                                ails.
chie8842@chie-no-ubuntu:~$ journalctl -xe
 3月 27 14:10:21 chie-no-ubuntu systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January
 3月 27 14:10:21 chie-no-ubuntu systemd[1]: snapd.refresh.timer: Adding 1h 5                                1
 3月 27 14:10:21 chie-no-ubuntu systemd[1]: snapd.refresh.timer: Adding 5h 3                                3
 3月 27 14:10:21 chie-no-ubuntu systemd[1]: apt-daily.timer: Adding 6h 51min                                
 3月 27 14:10:21 chie-no-ubuntu systemd[1080]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January
 3月 27 14:10:21 chie-no-ubuntu systemd[1695]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January

最終的に、起動スクリプトの最初にsleepを入れるとうまくいった。

sleep 10
mount -t cifs …
exit 0