Bug 258985

Summary: sysutils/firstboot-freebsd-update: System sometimes doesn't restart
Product: Ports & Packages Reporter: martin.stoyanov
Component: Individual Port(s)Assignee: Colin Percival <cperciva>
Status: Closed Unable to Reproduce    
Severity: Affects Some People CC: grahamperrin
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (cperciva)
koobs: merge-quarterly?
Hardware: amd64   
OS: Any   

Description martin.stoyanov 2021-10-07 13:17:29 UTC
During first boot on a custom EC2 AMI FreeBSD 13-RELEASE (built according to https://www.daemonology.net/blog/2019-02-16-FreeBSD-ZFS-AMIs-now-available.html), occasionally the system doesn't restart after firstboot-freebsd-update requests the reboot. 
According to my troubleshooting, /usr/local/etc/rc.d/firstboot_freebsd_update creates the ${firstboot-sentinel}-reboot file, which seems to trigger /etc/rc to issue "kill -INT 1", however sometimes the instance doesn't restart.

Modifying /etc/rc with:
147c147
<               kill -INT 1
---
>               /sbin/reboot

seems to fix that and the instances reboot reliably.
Comment 1 Colin Percival freebsd_committer freebsd_triage 2021-10-07 17:31:16 UTC
This is very strange -- init(8) is supposed to reboot the system when it receives SIGINT.
Comment 2 martin.stoyanov 2021-10-07 17:52:12 UTC
Indeed it's very strange, also I am not able to reproduce this issue reliably... I am not quite sure what could prevent init from handling SIGINT in some cases (background fsck maybe?), but /sbin/reboot is a bit more persistent and since I made that change all instances behaved as expected.
Comment 3 Colin Percival freebsd_committer freebsd_triage 2022-02-17 21:13:10 UTC
I can't reproduce this, and the original reported can no longer reproduce it, so I'm going to close the PR; if anyone manages to reproduce this (even if it's only a once-per-hundred-boots thing) please reopen the PR or email me directly.