2017年5月23日火曜日

CentOS7(Raspberry Pi 3)でroot宛メールをGmailに転送する
ふとした時にroot宛にメールが飛ぶことがあるけど、
気付くのが遅れたりすることが多いので、
よく見るGmailで確認できたら楽かなと思って、今回対応してみる。


■本日の目標

 Raspberry Pi 3からroot宛メールをGmailに転送する


■主な作業環境

・HW:Raspberry Pi 3 Model B
・OS:CentOS Linux release 7.3.1611 (Core)


■Postfixのインストール

・CentOS7からはデフォルトMTAとしてPostfixがインストール済で、
 先日、初期エラーの対策をして正常稼働できるようにしたので、
 ここでは特に作業なし。
 一応、yumの情報を確認しておく。
$ yum info postfix
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
インストール済みパッケージ
名前                : postfix
アーキテクチャー    : armv7hl
エポック            : 2
バージョン          : 2.10.1
リリース            : 6.el7
容量                : 11 M
リポジトリー        : installed
提供元リポジトリー  : centos-base_rbf
要約                : Postfix Mail Transport Agent
URL                 : http://www.postfix.org
ライセンス          : IBM and GPLv2+
説明                : Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL),
                    : TLS


■mailxのインストール

・mailコマンドでメールが送れるようにmailxをインストールする。
$ yum info mailx
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
利用可能なパッケージ
名前                : mailx
アーキテクチャー    : armv7hl
バージョン          : 12.5
リリース            : 12.el7
容量                : 219 k
リポジトリー        : base/7/armhfp
要約                : Enhanced implementation of the mailx command
URL                 : http://heirloom.sourceforge.net/mailx.html
ライセンス          : BSD with advertising and MPLv1.1
説明                : Mailx is an enhanced mail command, which provides the functionality
                    : of the POSIX mailx command, as well as SysV mail and Berkeley Mail
                    : (from which it is derived).
                    :
                    : Additionally to the POSIX features, mailx can work with Maildir/ e-mail
                    : storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
                    : protocols (including over SSL) to operate with remote hosts, handles mime
                    : types and different charsets. There are a lot of other useful features,
                    : see mailx(1).
                    :
                    : And as its ancient analogues, mailx can be used as a mail script language,
                    : both for sending and receiving mail.
                    :
                    : Besides the "mailx" command, this package provides "mail" and "Mail"
                    : (which should be compatible with its predecessors from the mailx-8.x source),
                    : as well as "nail" (the initial name of this project).
$ yum install mailx
・・・(中略)・・・
完了しました!


■Postfixの設定

・「/etc/postfix/main.cf」にrelayhostとSMTP認証の設定を書く。
$ vi /etc/postfix/main.cf
# relayhost(relayhostの項目末尾に追加)
relayhost = [smtp.gmail.com]:587
# SMTP認証(ファイル末尾に追加)
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps = hash:/etc/postfix/gmail_auth
smtp_sasl_security_options =
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_tls_eccert_file =
smtp_tls_eckey_file =
smtp_use_tls = yes
smtp_enforce_tls = no
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom


■SMTP認証情報を作成

・先ほど追記した「/etc/postfix/main.cf」の『smtp_sasl_password_maps』の項に書いた認証ファイルを作成し、利用するGmailの情報を記載する。
$ echo '[smtp.gmail.com]:587 xxxxx@gmail.com:password' > /etc/postfix/gmail_auth

・認証ファイルをハッシュ化する。
$ chmod 600 /etc/postfix/gmail_auth
$ postmap /etc/postfix/gmail_auth
$ ll /etc/postfix/gmail*
-rw-------. 1 root root    52  5月 14 21:32 /etc/postfix/gmail_auth
-rw-------. 1 root root 12288  5月 14 21:34 /etc/postfix/gmail_auth.db

・Postfixに反映する。
$ systemctl restart postfix
$ systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2017-05-14 22:48:10 JST; 5s ago
  Process: 2990 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
  Process: 3007 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 3004 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 3001 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 3082 (master)
   CGroup: /system.slice/postfix.service
           tq3082 /usr/libexec/postfix/master -w
           tq3083 pickup -l -t unix -u
           mq3084 qmgr -l -t unix -u

 5月 14 22:48:07 WSTD-RPI3 systemd[1]: Starting Postfix Mail Transport Agent...
 5月 14 22:48:10 WSTD-RPI3 postfix/postfix-script[3080]: starting the Postfix mail system
 5月 14 22:48:10 WSTD-RPI3 postfix/master[3082]: daemon started -- version 2.10.1, configuration /etc/postfix
 5月 14 22:48:10 WSTD-RPI3 systemd[1]: Started Postfix Mail Transport Agent.


■root宛メールの転送設定

・転送先のGmailアドレスを設定する。
$ echo 'root: xxxxx@gmail.com' >> /etc/aliases
$ newaliases


■送信テスト(その1)

・設定ができたのでテスト送信をしてみよう。
$ echo 'Test Send' | mail root

 ・・・Gmailに来ないな・・・ちょっとmaillogを見てみよう。
$ tail -n 20 /var/log/maillog
・・・(中略)・・・
May 14 22:49:05 WSTD-RPI3 postfix/pickup[3083]: 232E04677: uid=0 from=
May 14 22:49:05 WSTD-RPI3 postfix/cleanup[3090]: 232E04677: message-id=<20170514134905 .232e04677="" localdomain="">
May 14 22:49:05 WSTD-RPI3 postfix/qmgr[3084]: 232E04677: from=, size=438, nrcpt=1 (queue active)
May 14 22:49:05 WSTD-RPI3 postfix/cleanup[3090]: 3E4C84675: message-id=<20170514134905 .232e04677="" localdomain="">
May 14 22:49:05 WSTD-RPI3 postfix/local[3092]: 232E04677: to=, orig_to=, relay=local, delay=0.19, delays=0.12/0.06/0/0.01, dsn=2.0.0, status=sent (forwarded as 3E4C84675)
May 14 22:49:05 WSTD-RPI3 postfix/qmgr[3084]: 3E4C84675: from=, size=580, nrcpt=1 (queue active)
May 14 22:49:05 WSTD-RPI3 postfix/qmgr[3084]: 232E04677: removed
May 14 22:49:06 WSTD-RPI3 postfix/smtp[3093]: warning: SASL authentication failure: No worthy mechs found
May 14 22:49:06 WSTD-RPI3 postfix/smtp[3093]: 3E4C84675: SASL authentication failed; cannot authenticate to server smtp.gmail.com[108.177.97.108]: no mechanism available
May 14 22:49:07 WSTD-RPI3 postfix/smtp[3093]: connect to smtp.gmail.com[2404:6800:4008:c00::6d]:587: Cannot assign requested address
May 14 22:49:07 WSTD-RPI3 postfix/smtp[3093]: 3E4C84675: to=, orig_to=, relay=none, delay=2.2, delays=0.01/0.21/2/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2404:6800:4008:c00::6d]:587: Cannot assign requested address)


■(対策1)cyrus-sasl-plainのインストール

・「SASL authentication failure」の出てる行を読むと、何やらSASLの認証に必要な機能が無いようなので追加インストールする。
$ yum info cyrus-sasl-plain
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
利用可能なパッケージ
名前                : cyrus-sasl-plain
アーキテクチャー    : armv7hl
バージョン          : 2.1.26
リリース            : 20.el7
容量                : 37 k
リポジトリー        : base/7/armhfp
要約                : PLAIN and LOGIN authentication support for Cyrus SASL
URL                 : http://asg.web.cmu.edu/sasl/sasl-library.html
ライセンス          : BSD with advertising
説明                : The cyrus-sasl-plain package contains the Cyrus SASL plugins which support
                    : PLAIN and LOGIN authentication schemes.
$ yum install cyrus-sasl-plain
・・・(中略)・・・
完了しました!


■送信テスト(その2)

・「cyrus-sasl-plain」がインストールできたのでもう一度テスト送信をしてみよう。
$ echo 'Test Send' | mail root

 まだ届かないので、またmailogを確認する。
$ tail -n 20 /var/log/maillog
・・・(中略)・・・
May 14 22:58:52 WSTD-RPI3 postfix/pickup[3083]: 986CC4682: uid=0 from=
May 14 22:58:52 WSTD-RPI3 postfix/cleanup[3114]: A830F127: message-id=<20170514135852 .986cc4682="" localdomain="">
May 14 22:58:52 WSTD-RPI3 postfix/qmgr[3084]: A830F127: from=, size=579, nrcpt=1 (queue active)
May 14 22:58:52 WSTD-RPI3 postfix/local[3115]: 986CC4682: to=, orig_to=, relay=local, delay=0.13, delays=0.07/0.05/0/0.02, dsn=2.0.0, status=sent (forwarded as A830F127)
May 14 22:58:52 WSTD-RPI3 postfix/qmgr[3084]: 986CC4682: removed
May 14 22:58:55 WSTD-RPI3 postfix/smtp[3108]: A830F127: SASL authentication failed; server smtp.gmail.com[108.177.97.109] said: 534-5.7.14  Please log in via your web browser and?534-5.7.14 then try again.?534-5.7.14  Learn more at?534 5.7.14  https://support.google.com/mail/answer/78754 t5sm14848004pgo.48 - gsmtp
May 14 22:58:55 WSTD-RPI3 postfix/smtp[3108]: connect to smtp.gmail.com[2404:6800:4008:c00::6d]:587: Cannot assign requested address
May 14 22:58:55 WSTD-RPI3 postfix/smtp[3108]: A830F127: to=, orig_to=, relay=none, delay=3.2, delays=0.01/0/3.2/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2404:6800:4008:c00::6d]:587: Cannot assign requested address)


■(対策2)Googleアカウントのセキュリティ設定を変更

・ログ中の「https://support.google.com/mail/answer/78754」にアクセスするとヒントが書かれていた。
 パスワードは問題無さそうなので、「安全性の低いアプリがアカウントにアクセスすることを許可」の対策を行う。
 ⇒ページ内の方法2を実施
  1.[アカウント情報] の [安全性の低いアプリ] に移動
  2.[安全性の低いアプリのアクセス] の横にある [有効にする] を選択


■送信テスト(その3)

・三度目の正直ということで・・・。
$ echo 'Test Send' | mail root

 Gmailに届いた!

 念のため、mailogを確認してみよう。
$ tail -n 20 /var/log/maillog
・・・(中略)・・・
May 14 23:12:21 WSTD-RPI3 postfix/smtp[3148]: connect to smtp.gmail.com[2404:6800:4008:c00::6d]:587: Cannot assign requested address
May 14 23:12:24 WSTD-RPI3 postfix/smtp[3148]: 1F83F127: to=, orig_to=, relay=smtp.gmail.com[108.177.97.108]:587, delay=2.9, delays=0.01/0.16/1.2/1.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1494771143 134sm13394508pgh.43 - gsmtp)
May 14 23:12:24 WSTD-RPI3 postfix/qmgr[3084]: 1F83F127: removed

 うーむ・・・「Cannot assign requested address」の行が気になるな。


■「/etc/postfix/main.cf」の追加設定(IPv6無効化)

・「Cannot assign requested address」のちょっと前の出てるアドレスってIPv6か・・・。
 さっきviで編集してるときmain.cfで使用IPアドレスのバージョン設定の箇所があったのが気になったんだよね。
 「inet_protocols」の項目。
 このRaspberry Pi 3の端末はIPv6は無効にしてあるから、「そんなアドレスに繋げられないよ」と怒られているんだろう。
 ・・・というわけで、IPv4固定に変更しよう。
$ vi /etc/postfix/main.cf
# inet_protocolsをIPv4指定に変更
inet_protocols = ipv4

 設定内容を反映する。
$ systemctl reload postfix
$ systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2017-05-14 23:23:41 JST; 14min ago
  Process: 750 ExecReload=/usr/sbin/postfix reload (code=exited, status=0/SUCCESS)
  Process: 592 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 578 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 552 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 696 (master)
   CGroup: /system.slice/postfix.service
           tq696 /usr/libexec/postfix/master -w
           tq762 pickup -l -t unix -u
           mq763 qmgr -l -t unix -u

 1月 01 09:00:16 WSTD-RPI3 systemd[1]: Starting Postfix Mail Transport Agent...
 5月 14 23:23:41 WSTD-RPI3 postfix/master[696]: daemon started -- version 2.10.1, configuration /etc/postfix
 5月 14 23:23:41 WSTD-RPI3 systemd[1]: Started Postfix Mail Transport Agent.
 5月 14 23:37:41 WSTD-RPI3 postfix/master[696]: reload -- version 2.10.1, configuration /etc/postfix
 5月 14 23:37:41 WSTD-RPI3 postfix/master[696]: warning: ignoring inet_protocols parameter value change
 5月 14 23:37:41 WSTD-RPI3 postfix/master[696]: warning: old value: "all", new value: "ipv4"
 5月 14 23:37:41 WSTD-RPI3 systemd[1]: Reloaded Postfix Mail Transport Agent.
 5月 14 23:37:41 WSTD-RPI3 postfix/master[696]: warning: to change inet_protocols, stop and start Postfix


■送信テスト(その4)

・最後にもう一度。
$ echo 'Test Send' | mail root

 念のため、mailogを確認してみよう。
$ tail -n 20 /var/log/maillog
・・・(中略)・・・
May 14 23:39:56 WSTD-RPI3 postfix/smtp[776]: 5EC25144: to=, orig_to=, relay=smtp.gmail.com[108.177.97.109]:587, delay=3.9, delays=0.01/0.26/1.7/1.9, dsn=2.0.0, status=sent (250 2.0.0 OK 1494772796 r13sm15980358pgn.16 - gsmtp)
May 14 23:39:56 WSTD-RPI3 postfix/qmgr[763]: 5EC25144: removed

 「Cannot assign requested address」が消えた。



これで何か問題があっても検知できそうだ。

2017年5月16日火曜日

Raspberry Pi 3に入れたCentOS7のエラー対策
Raspberry Pi 3にCentOS7を入れてから初期作業が終わったので、
起動エラーとなっているサービスを確認して、エラーサービスを無くそうと思う。


■本日の目標

・CentOS7のサービスで起動に失敗しているサービスを無くす


■主な作業環境

・HW:Raspberry Pi 3 Model B
・OS:CentOS Linux release 7.3.1611 (Core)


■起動失敗サービスの確認

・systemctlのステータスを確認すると、3件ほど起動に失敗しているようだ。
$ systemctl status
● WSTD-RPI3
    State: degraded
     Jobs: 0 queued
   Failed: 3 units
 (以下、略)

 続いて、失敗した3件のサービスを確認する。
$ systemctl | grep failed
● kdump.service           loaded failed failed    Crash recovery kernel arming
● network.service         loaded failed failed    LSB: Bring up/down networking
● postfix.service         loaded failed failed    Postfix Mail Transport Agent


■kdumpサービスの対策

・kdumpとは、カーネルパニックが起きたときに
 原因特定のためのdumpファイルを保存してくれるサービスだそうだ。
 では、起動失敗の原因を調べてみる。
 まずはサービスの起動結果を見る。
$ systemctl status kdump.service
● kdump.service - Crash recovery kernel arming
  Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since 木 1970-01-01 09:00:21 JST; 47 years 3 months ago
 Process: 368 ExecStart=/usr/bin/kdumpctl start (code=exited, status=1/FAILURE)
Main PID: 368 (code=exited, status=1/FAILURE)

1月 01 09:00:18 WSTD-RPI3 systemd[1]: Starting Crash recovery kernel arming...
1月 01 09:00:21 WSTD-RPI3 kdumpctl[368]: Kdump is not supported on this kernel
1月 01 09:00:21 WSTD-RPI3 kdumpctl[368]: Starting kdump: [FAILED]
1月 01 09:00:21 WSTD-RPI3 systemd[1]: kdump.service: main process exited, code=exited, status=1/FAILURE
1月 01 09:00:21 WSTD-RPI3 systemd[1]: Failed to start Crash recovery kernel arming.
1月 01 09:00:21 WSTD-RPI3 systemd[1]: Unit kdump.service entered failed state.
1月 01 09:00:21 WSTD-RPI3 systemd[1]: kdump.service failed.

 ログの2行目にこのカーネルではサポートされていないと書かれている。
 
 ・・・なんとかやりようがあるんだろうけど、今回は無効化してしまう。
$ systemctl disable kdump
Removed symlink /etc/systemd/system/multi-user.target.wants/kdump.service.


■Postfixサービスの対策

・Postfixはsendmailに代わるCentOS7の標準MTA(メール転送エージェント)。
 今後やりたいことがあるので正常起動だけでも確認したい。

 まずはサービスの起動結果を見る。
$ systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 木 1970-01-01 09:00:20 JST; 47 years 3 months ago

 1月 01 09:00:18 WSTD-RPI3 systemd[1]: Starting Postfix Mail Transport Agent...
 1月 01 09:00:18 WSTD-RPI3 aliasesdb[366]: /usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1
 1月 01 09:00:19 WSTD-RPI3 postfix/sendmail[615]: fatal: parameter inet_interfaces: no local interface found for ::1
 1月 01 09:00:19 WSTD-RPI3 aliasesdb[366]: newaliases: fatal: parameter inet_interfaces: no local interface found for ::1
 1月 01 09:00:19 WSTD-RPI3 postfix[646]: fatal: parameter inet_interfaces: no local interface found for ::1
 1月 01 09:00:20 WSTD-RPI3 systemd[1]: postfix.service: control process exited, code=exited status=1
 1月 01 09:00:20 WSTD-RPI3 systemd[1]: Failed to start Postfix Mail Transport Agent.
 1月 01 09:00:20 WSTD-RPI3 systemd[1]: Unit postfix.service entered failed state.
 1月 01 09:00:20 WSTD-RPI3 systemd[1]: postfix.service failed.

 うーむ・・・「::1」のオンパレード。
 おそらく先日無効化したIPv6に関するエラーだろう。

 「『::1』のインタフェースが見つからん」と言っているので、どこかに固有設定があると思われる。

 いろいろGrepして辿り着いたのがhostsファイルだった。
$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 この2行目の「::1」の部分をコメントアウトする。(viコマンドで)
$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 それでは起動してみよう。
$ systemctl start postfix.service
$ systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since 月 2017-05-01 15:17:57 JST; 1s ago
  Process: 1039 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 1036 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 1032 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 1111 (master)
   CGroup: /system.slice/postfix.service
           tq1111 /usr/libexec/postfix/master -w
           tq1112 pickup -l -t unix -u
           mq1113 qmgr -l -t unix -u

 5月 01 15:17:54 WSTD-RPI3 systemd[1]: Starting Postfix Mail Transport Agent...
 5月 01 15:17:57 WSTD-RPI3 postfix/master[1111]: daemon started -- version 2.10.1, configuration /etc/postfix
 5月 01 15:17:57 WSTD-RPI3 systemd[1]: Started Postfix Mail Transport Agent.

 復旧成功!


■networkの対策

・最後はnetworkサービス。
 これは読んで字の如くのことをしてくれるサービスだが・・・なぜ失敗しているのだろうか?
 
 これもサービスの起動結果を見る。
$ systemctl status network.service
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 木 1970-01-01 09:00:18 JST; 47 years 3 months ago
     Docs: man:systemd-sysv-generator(8)

 1月 01 09:00:18 WSTD-RPI3 systemd[1]: Starting LSB: Bring up/down networking...
 1月 01 09:00:18 WSTD-RPI3 systemd[1]: network.service: control process exited, code=exited status=6
 1月 01 09:00:18 WSTD-RPI3 systemd[1]: Failed to start LSB: Bring up/down networking.
 1月 01 09:00:18 WSTD-RPI3 systemd[1]: Unit network.service entered failed state.
 1月 01 09:00:18 WSTD-RPI3 systemd[1]: network.service failed.

 インタフェースの上げ下げに失敗しているのかな・・・?
 調べていて行き着いた先が海外のフォーラムだった。
 どうやらRaspberry Piが以前から抱えている問題のようで同様の事象があった模様。
 回避策としては「/etc/sysconfig/network」の空ファイルを作成するだけ。
 
 では、やってみよう。
$ cat /etc/sysconfig/network
cat: /etc/sysconfig/network: そのようなファイルやディレクトリはありません
$ touch /etc/sysconfig/network
$ systemctl restart network
$ systemctl status network
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: active (exited) since 月 2017-05-01 15:57:01 JST; 1min 21s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 754 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

 5月 01 15:56:57 WSTD-RPI3 systemd[1]: Starting LSB: Bring up/down networking...
 5月 01 15:56:59 WSTD-RPI3 network[754]: ループバックインターフェイスを呼び込み中 [  OK  ]
 5月 01 15:57:01 WSTD-RPI3 network[754]: インターフェース eth0 を活性化中:  接続が正常にアクティベートされました (D-Bus アクティブパス:/org/freedesktop/N…onnection/1)
 5月 01 15:57:01 WSTD-RPI3 network[754]: [  OK  ]
 5月 01 15:57:01 WSTD-RPI3 systemd[1]: Started LSB: Bring up/down networking.

 起動成功!
 
 ただ・・・元々、外部アクセスに問題があったわけではなかったし、
 どんな問題を抱えていたのかわからないというのが本当のところ・・・。
 
 network.serviceの起動エラーの回避策は色々見つかったけど、環境によって対応内容はそれぞれ異なるようだ。
 「NetworkManager-wait-online.serviceを自動起動にする」とか、
 他にも2~3個試してみたけど、どれもダメで、結局辿り着いたのが↑の方法だった。


■結果

・起動失敗したサービスがなくなってスッキリ!
$ systemctl status
● WSTD-RPI3
    State: running
     Jobs: 0 queued
   Failed: 0 units
 (以下、略)