emmc_log: Add rsyslog state to eMMC
Make sure the rsyslog state is not removed at boot which will force
rsyslog to load the whole eMMC at every boot.
Expected workflow:
- Journal in RAM
- Rsyslog start reading from journal and the state is in RAM
- Network is not available yet so we export any log to syslog yet.
- eMMC becomes ready before the network is ready
- start_emmc_logging
- Stop rsyslog
- All journal logs are dump into the eMMC.
- Symlink the rsyslog journal state to the one in eMMC.
- Restart rsyslog
- Network comes up
- Start exporting logs from the state in eMMC.
Tested:
```
ls -l /var/log/state
lrwxrwxrwx 1 root root 31 Sep 20 04:26 /var/log/state -> /mnt/luks-mmcblk0_fs/logs/state
```
Old logs are not being reloaded again.
### The journal state is pointed to before the SEL and after
powercycle the logs get pull in.
Before Powercycle,
```
root@dddfz27-nfd01:~# systemctl stop rsyslog
root@dddfz27-nfd01:~# journalctl -b 0 | grep sel-log
Feb 13 22:49:36 dddfz27-nfd01.prod.google.com assert-efuse-sel-log.sh[3531]: System is power on !
Feb 13 22:49:36 dddfz27-nfd01.prod.google.com assert-efuse-sel-log.sh[3531]: There is not efuse error occur, ignore this trigger signal !
Feb 13 22:49:36 dddfz27-nfd01.prod.google.com systemd[1]: assert-efuse-sel-log.service: Deactivated successfully.
Feb 13 23:24:36 dddfz27-nfd01.prod.google.com sel-logger[433]: a
Feb 13 23:24:47 dddfz27-nfd01.prod.google.com sel-logger[433]: a
root@dddfz27-nfd01:~# journalctl --sync
root@dddfz27-nfd01:~# tray_powercycle.sh
```
After powercycle,
```
root@dddfz27-nfd01:~# ipmitool sel
SEL Information
Version : 1.5 (v1.5, v2 compliant)
Entries : 1
Free Space : 65535 bytes or more
Percent Used : unknown
Last Add Time : 02/13/24 23:30:25 PST
Last Del Time : Not Available
Overflow : false
Supported Cmds : 'Reserve'
root@dddfz27-nfd01:~# ipmitool sel list
2 | 02/13/24 | 23:24:47 PST | reserved #0xff | | Asserted
```
### The journal state is pointed to after the SEL and after
powercycle it doesn't get log again.
Before Powercycle,
```
root@dddfz27-nfd01:~# busctl call xyz.openbmc_project.Logging.IPMI /xyz/openbmc_project/Logging/IPMI xyz.openbmc_project.Logging.IPMI IpmiSelAdd ssaybq 'a' 'b' 0 1 1
root@dddfz27-nfd01:~# busctl call xyz.openbmc_project.Logging.IPMI /xyz/openbmc_project/Logging/IPMI xyz.openbmc_project.Logging.IPMI IpmiSelAdd ssaybq 'a' 'b' 0 1 1
root@dddfz27-nfd01:~# ipmitool sel
SEL Information
Version : 1.5 (v1.5, v2 compliant)
Entries : 4
Free Space : 65535 bytes or more
Percent Used : unknown
Last Add Time : 02/13/24 23:53:43 PST
Last Del Time : Not Available
Overflow : false
Supported Cmds : 'Reserve'
root@dddfz27-nfd01:~# journalctl --sync
root@dddfz27-nfd01:~# tray_powercycle.sh
```
After Powercycle,
```
root@dddfz27-nfd01:~# ipmitool sel
SEL Information
Version : 1.5 (v1.5, v2 compliant)
Entries : 0
Free Space : 65535 bytes or more
Percent Used : unknown
Last Add Time : Not Available
Last Del Time : Not Available
Overflow : false
Supported Cmds : 'Reserve'
```
Google-Bug-Id: 320709780
Change-Id: I07f6b97d68d64eaf798455a57b5889906dd74c8a
Signed-off-by: Willy Tu <wltu@google.com>
2 files changed