openbmc / phosphor-time-manager

Local time policy and emulated host RTC manager
Apache License 2.0
6 stars 10 forks source link

Manual Set Time not retained following a BMC cold reset #7

Open smcdougal opened 3 years ago

smcdougal commented 3 years ago

When NTP is turned off and a manual time is set, the manually set time is not retained following a BMC cold reset.

The only modification I made was to change to webui-vue rather than phosphor-webui. This is a Romulus build running in QEMU from a WSL Ubuntu session in Win10.

Version information: root@romulus:/# cat /etc/os-release ID=openbmc-romulus NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)" VERSION="2.10.0-dev" VERSION_ID=2.10.0-dev-393-g98120a8d8-dirty PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 2.10.0-dev" BUILD_ID="2.10.0-dev" OPENBMC_TARGET_MACHINE="romulus"


Test Script

export token_wp=`curl -k -H "Content-Type: application/json" -X POST https://localhost/login -d '{"username" : "root", "password" : "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

echo "disable NTP protocol"
curl -k -H "X-Auth-Token: $token_wp" -X PATCH -d '{"NTP": { "ProtocolEnabled": false } }' https://localhost/redfish/v1/Managers/bmc/NetworkProtocol
sleep 20

echo "disable DHCP NTP settings"
curl -k -H "X-Auth-Token: $token_wp" -X PATCH -d '{"DHCPv4": { "UseNTPServers": false } }' https://localhost/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
curl -k -H "X-Auth-Token: $token_wp" -X PATCH -d '{"DHCPv6": { "UseNTPServers": false } }' https://localhost/redfish/v1/Managers/bmc/EthernetInterfaces/eth0

echo "display NTP setting"
curl -k -H "X-Auth-Token: $token_wp" -X GET https://localhost/redfish/v1/Managers/bmc/NetworkProtocol

echo "display dhcp settings"
curl -k -H "X-Auth-Token: $token_wp" -X GET https://localhost/redfish/v1/Managers/bmc/EthernetInterfaces/eth0

export get_time=`curl -k -H "X-Auth-Token: $token_wp" -X GET https://localhost/redfish/v1/Managers/bmc/ | grep -i datetime`
echo "Current Time Set on System: $get_time"

echo "set time"
curl -k -H "X-Auth-Token: $token_wp" -X PATCH -d '{"DateTime": "2020-12-15T15:15:14+00:00"}' https://localhost/redfish/v1/Managers/bmc/

echo "get time"
export set_time=`curl -k -H "X-Auth-Token: $token_wp" -X  GET https://localhost/redfish/v1/Managers/bmc/ | grep -i datetime`
echo "Current Time set on System: $set_time"

## REBOOT THE BMC
echo "reboot the BMC"
ipmitool -I lanplus -H localhost -U root -P 0penBmc -p 623 mc reset cold -v
sleep 180

## Verify time
export token_wp=`curl -k -H "Content-Type: application/json" -X POST https://localhost/login -d '{"username" : "root", "password" : "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

echo "get time"
export get_time=`curl -k -H "X-Auth-Token: $token_wp" -X  GET https://localhost/redfish/v1/Managers/bmc/ | grep -i datetime`
echo "Current Time set on System: $get_time"

But the time I set before the reset was still lost by the time the BMC comes back up.

vishwabmc commented 3 years ago

@ratagupt FYI ^

ushasrinivasan-cornelisnetworks commented 3 years ago

Hi, I switched to webui-vue and am having the same issue; the BMC time is lost after reboot or reset.

matthewfischer commented 1 year ago

I cannot repro this using palmetto in qemu built off top of tree from July. I did the steps above roughly except I set the time in the web UI because I had issues with the formatting of the json above (not sure what the issue was there).

  1. Boot palmetto in qemu
  2. Fire up the browser, disable NTP. the time was 03:13 UTC.
  3. Disable NTP for IPv4 (I don't have v6 enabled)
  4. Manually set the time to 10:30 UTC.
  5. Check that NTP is disabled with redfish (it is)
  6. Check the time with Redfish
  7. Reboot with IPMI
  8. Wait for it to come back
  9. Check settings again (NTP off)
  10. Check time again - now 10:35 (accounting for delays in the steps as I had a typo in my IPMI call)
  11. Repeat again after some time, now says 10:49.
Screenshot 2023-10-08 at 9 34 55 PM Screenshot 2023-10-08 at 9 35 00 PM
mdmillerii commented 1 year ago

I can manually verify that the DHCP UseNTPServers is still set to false, and the NTP Protocol is still disabled. I verified that UseNTP is set to false in /etc/systemd/network/00-bmc-eth0.network before and after the cold reset. 'timedatectl status' shows that the system clock is "not synchronized" and the NTP Service is inactive. But the time I set before the reset was still lost by the time the BMC comes back up.

What hardware do you expect to maintain the time over a cold reboot?