20180723_jeffrey - silenceuncrio/diary GitHub Wiki

0905

繼續排除異常的 atd

先把 at 的 bbappend 刪掉的 INITSCRIPT_PARAMS = "disable" 注解掉試試

讓 atd 一開機就被啟動

0945

/etc/rc0.d/ 有看到 K20atd

root@Cellular Router:~# ls -al /etc/rc0.d/
drwxr-xr-x    2 root     root           864 Jan  1  1970 .
drwxr-xr-x   40 root     root          6792 Jul 23 01:32 ..
lrwxrwxrwx    1 root     root            13 Jan  1  1970 K20atd -> ../init.d/atd

atd 卻沒被啟動

root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped

試著啟動

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped

明明顯示啟動成功了但卻還是失敗

把整個 at 的 bbappend 目錄刪掉再 build 一次

1015

再次實驗

/etc/rc0.d/K20atd 存在

root@Cellular Router:~# ls /etc/rc0.d/
K20atd           K80networking    S30urandom       S90halt
K20hwclock.sh    S20sendsigs      S31umountnfs.sh
K20xl2tpd        S25save-rtc.sh   S40umountfs

atd 還是沒被啟動

root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped

1020

上禮拜還為了 at 這 recipe 寫了 bbappend 不讓它在一開始被啟動

怎麼現在卻不啟動了呢

先從 prosrc 的 bb file 把 at 拿掉再 build 一次

還原回禮拜五早上的情況

1030

/etc/rc0.d/ 沒有 atd 相關連結

root@Cellular Router:~# ls /etc/rc0.d/
K20hwclock.sh    S20sendsigs      S31umountnfs.sh
K20xl2tpd        S25save-rtc.sh   S40umountfs
K80networking    S30urandom       S90halt

確認 at 相關 command

root@Cellular Router:~# type atd
-sh: type: atd: not found
root@Cellular Router:~# type atq
-sh: type: atq: not found
root@Cellular Router:~# type at
-sh: type: at: not found

1035

再度前進

at 加回 prosrc/prosrc_0.1.bb

1100

確認 K20atd

root@Cellular Router:~# ls /etc/rc0.d/
K20atd           K80networking    S30urandom       S90halt
K20hwclock.sh    S20sendsigs      S31umountnfs.sh
K20xl2tpd        S25save-rtc.sh   S40umountfs

確認 atd 的啟動狀態... 失敗

root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped

不過後續啟動成功了

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd (pid 15320) is running...

1110

試著觀察開機後多久才能手動啟動成功

重新 reboot 後出現一些 debug information

Cellular Router login: miniupnpd[2739]: HTTP listening on port 50914
miniupnpd[2739]: no HTTP IPv6 address, disabling IPv6
miniupnpd[2739]: Listening for NAT-PMP/PCP traffic on port 5351
miniupnpd[2739]: shutting down MiniUPnPd
miniupnpd[3311]: HTTP listening on port 59374
miniupnpd[3311]: no HTTP IPv6 address, disabling IPv6
miniupnpd[3311]: Listening for NAT-PMP/PCP traffic on port 5351

Cellular Router login: root
Password:

Login incorrect
Cellular Router login: root
Password:

紀錄一下開機後的時間

root@Cellular Router:~# date
Mon Jul 23 02:51:08 GREENWI 2018

Mon Jul 23 02:52:26 GREENWI 2018

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped
root@Cellular Router:~# date
Mon Jul 23 02:52:26 GREENWI 2018

Mon Jul 23 02:53:26 GREENWI 2018

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped
root@Cellular Router:~# date
Mon Jul 23 02:53:26 GREENWI 2018

Mon Jul 23 02:54:58 GREENWI 2018

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped
root@Cellular Router:~# date
Mon Jul 23 02:54:58 GREENWI 2018

Mon Jul 23 02:57:46 GREENWI 2018

root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped
root@Cellular Router:~# date
Mon Jul 23 02:57:46 GREENWI 2018

想看一下 atd 有什麼 log

root@Cellular Router:~# tail /home/log/slogd.log
2018-07-23 02:44:54 Cellular Router daemon.info <<CONNMGR:CONNMGR>>: Ethernet link down
2018-07-23 02:44:55 Cellular Router daemon.info <<HARDWARE:LTE>>: Switch SIM card(2) done
2018-07-23 02:44:55 Cellular Router daemon.notice <<HARDWARE:ALARM>>: LAN Disconnect by port 1
2018-07-23 02:44:55 Cellular Router daemon.notice <<HARDWARE:ALARM>>: LAN Recover by port 2
2018-07-23 02:44:55 Cellular Router daemon.err <<HARDWARE:LTE>>: SIM not inserted
2018-07-23 02:44:55 Cellular Router daemon.notice <<HARDWARE:ALARM>>: LAN Disconnect by port 3
2018-07-23 02:45:00 Cellular Router daemon.info <<LAN:DHCP>>: DHCP server reconfigured
2018-07-23 02:45:05 Cellular Router daemon.info <<MANAGEMENT:SSH>>: SSH key files generated.
2018-07-23 02:45:05 Cellular Router daemon.info <<MANAGEMENT:WEB>>: iweb HTTPS key and cert generated.
2018-07-23 02:49:38 Cellular Router syslog.info syslogd exiting

發現 syslogd exiting

1120

再度重開機看 下

root@Cellular Router:~# tail /home/log/slogd.log
2018-07-23 03:01:47 Cellular Router daemon.info <<HARDWARE:LTE>>: Used SIM mode: (0)  Current SIM NO: (0) sim_pri=(0)
2018-07-23 03:01:48 Cellular Router daemon.err <<HARDWARE:LTE>>: SIM not inserted
2018-07-23 03:01:48 Cellular Router daemon.info <<HARDWARE:LTE>>: Start to switch SIM card(1 -> 2). Please wait around 20 seconds...
2018-07-23 03:01:51 Cellular Router daemon.info <<LAN:DHCP>>: DHCP server reconfigured
2018-07-23 03:01:51 Cellular Router daemon.info <<HARDWARE:LTE>>: User change WAN connection type (0)
2018-07-23 03:01:52 Cellular Router daemon.info <<CONNMGR:CONNMGR>>: User change WAN ethernet protocol
2018-07-23 03:01:52 Cellular Router daemon.info <<CONNMGR:CONNMGR>>: Ethernet link down
2018-07-23 03:01:56 Cellular Router daemon.info <<LAN:DHCP>>: DHCP server reconfigured
2018-07-23 03:02:26 Cellular Router daemon.info <<HARDWARE:LTE>>: Switch SIM card(2) done
2018-07-23 03:02:26 Cellular Router daemon.err <<HARDWARE:LTE>>: SIM not inserted

啟動 atd 失敗

root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped
root@Cellular Router:~# /etc/init.d/atd start
Starting atd: OK
root@Cellular Router:~# /etc/init.d/atd status
/usr/sbin/atd is stopped

沒發現 syslogd exiting

root@Cellular Router:~# tail /home/log/slogd.log
2018-07-23 03:01:47 Cellular Router daemon.info <<HARDWARE:LTE>>: Used SIM mode: (0)  Current SIM NO: (0) sim_pri=(0)
2018-07-23 03:01:48 Cellular Router daemon.err <<HARDWARE:LTE>>: SIM not inserted
2018-07-23 03:01:48 Cellular Router daemon.info <<HARDWARE:LTE>>: Start to switch SIM card(1 -> 2). Please wait around 20 seconds...
2018-07-23 03:01:51 Cellular Router daemon.info <<LAN:DHCP>>: DHCP server reconfigured
2018-07-23 03:01:51 Cellular Router daemon.info <<HARDWARE:LTE>>: User change WAN connection type (0)
2018-07-23 03:01:52 Cellular Router daemon.info <<CONNMGR:CONNMGR>>: User change WAN ethernet protocol
2018-07-23 03:01:52 Cellular Router daemon.info <<CONNMGR:CONNMGR>>: Ethernet link down
2018-07-23 03:01:56 Cellular Router daemon.info <<LAN:DHCP>>: DHCP server reconfigured
2018-07-23 03:02:26 Cellular Router daemon.info <<HARDWARE:LTE>>: Switch SIM card(2) done
2018-07-23 03:02:26 Cellular Router daemon.err <<HARDWARE:LTE>>: SIM not inserted

1140

不用 at 這個 recipe 了

想辦法用 cronie 湊合湊合

發現以下的 config 是無效的

root@Cellular Router:~# cat /etc/cron.d/schedule_reboot
# schedule reboot
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
0 */2 * * * root schedule_reboot.sh

schedule_reboot.sh 必須明確的指定路徑才行

root@Cellular Router:~# cat /etc/cron.d/schedule_reboot
# schedule reboot
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
0 */2 * * * root /usr/sbin/icos/schedule_reboot.sh

1450

commit 601cb7e6e9bb6f6c49d0ab01786590f46f5b4e63
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Mon Jul 23 14:48:29 2018 +0800

    implement 'schedule reboot'

 meta-proscend/recipes-core/prosrc/prosrc_0.1.bb    |  2 +-
 .../recipes-extended/at/at_3.1.16.bbappend         |  4 --
 .../icos/schedule_reboot/schedule_reboot.json      |  5 +-
 .../icos/icoslib/schedule_reboot/schedule_reboot.c | 79 ++++++++++++++++++++--
 .../prosrc/icos/include/module_schedule_reboot.h   | 23 ++++---
 proscend/prosrc/icos/script/schedule_reboot.sh     |  4 ++
 .../prosrc/www/app/feature/schedule_reboot.html    | 14 +++-
 7 files changed, 103 insertions(+), 28 deletions(-)

1625

回頭作 52xxz

pull 最新的 code

➜  52XXZ git:(develop) git pull
remote: Counting objects: 239, done.
remote: Compressing objects: 100% (137/137), done.
remote: Total 239 (delta 155), reused 144 (delta 72)
Receiving objects: 100% (239/239), 89.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (155/155), completed with 67 local objects.
From 192.168.0.124:RD/52XXZ
   da37db5..37a9b83  develop    -> origin/develop
First, rewinding head to replay your work on top of it...
Fast-forwarded develop to 37a9b834bbe0be5724ff5815b28070d676587342.

最外層 make cleanmake -j4

1630

沒 build 過 有 error

make -j4 V=s 再一次

看不明白 error 在哪

make distclean

1645

make -j4ing...

1730

卡住在同一個 package 兩次

手動針對該 package build 就 build 過了

然後再 make 就一路到成功了

不過進 proscend 後也要先 make distclean

不然會 build 不過

1740

燒錄完 image 發現 www 服務已經起來了

問題已經消失了

1805

commit 938f8e4b28858aec3d60f85feba4d5cc2b740637
Refs: [release/v1.71], {origin/release/v1.71}
Author: jeffrey <[email protected]>
Date:   Mon Aug 27 18:05:09 2018 +0800

    correct the behaviour of 'Schedule Reboot'

 proscend/prosrc/icos/icoslib/schedule_reboot/schedule_reboot.c | 2 +-
 proscend/prosrc/icos/script/schedule_reboot.sh                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️