Skip to content

Disable the first boot service from setup-station itself - #11

Merged
ericbsd merged 3 commits into
masterfrom
rc-setup
Aug 30, 2026
Merged

ericbsd merged 3 commits into
masterfrom
rc-setup

Conversation

@ericbsd

@ericbsd ericbsd commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

initial_setup disabled itself as soon as startx returned, which happens whether or not setup completed. A crashed X or a machine powered off partway through left the service disabled with nothing configured. The decision moves into setup-station, which only reaches it after the other steps have run.

remove_ghostbsd_autologin goes with it. It looked for the ghostbsd user in gettytab and ttys, but the installer had already rewritten both to root by the time it ran, so neither sed matched and installed systems kept a root autologin on ttyv0. The mate image now autologins through lightdm, so there is nothing left for it to undo.

disable_initial_setup clears both locations, since the installer writes /etc/rc.conf.d/initial_setup while older installs set the variable in /etc/rc.conf.

The step 5 label changes with the behaviour, so its msgid needs re-extracting.

Summary by Sourcery

Disable the first-boot setup service only after setup-station completes its configuration steps.

Bug Fixes:

  • Prevent incomplete or failed first-boot setup from permanently disabling the setup service before configuration finishes.
  • Remove obsolete GhostBSD live-user autologin cleanup that no longer applies to the installer images.
  • Disable first-boot setup for both current and legacy configuration locations after setup completes.

Enhancements:

  • Move the first-boot service disablement into setup-station’s final setup step.

Chores:

  • Regenerate translated message catalogs for the updated setup progress label.

initial_setup disabled itself as soon as startx returned, which happens
whether or not setup completed. A crashed X or a machine powered off
partway through left the service disabled with nothing configured. The
decision moves into setup-station, which only reaches it after the other
steps have run.

remove_ghostbsd_autologin goes with it. It looked for the ghostbsd user
in gettytab and ttys, but the installer had already rewritten both to
root by the time it ran, so neither sed matched and installed systems
kept a root autologin on ttyv0. The mate image now autologins through
lightdm, so there is nothing left for it to undo.

disable_initial_setup clears both locations, since the installer writes
/etc/rc.conf.d/initial_setup while older installs set the variable in
/etc/rc.conf.

The step 5 label changes with the behaviour, so its msgid needs
re-extracting.
@ericbsd
ericbsd requested review from a team as code owners August 30, 2026 12:08
@sourcery-ai

sourcery-ai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR prevents incomplete installations from disabling first-boot setup by moving that decision to setup-station’s final step, where it clears both current and legacy enablement locations; it also removes obsolete GhostBSD autologin cleanup and updates the step messaging.

Sequence diagram for final first-boot setup disablement

sequenceDiagram
    participant SetupStation
    participant InstallerSteps
    participant SystemCalls
    participant Filesystem
    participant Sysrc

    SetupStation->>InstallerSteps: run installation steps
    InstallerSteps-->>SetupStation: steps complete
    SetupStation->>SystemCalls: disable_initial_setup()
    SystemCalls->>Filesystem: remove /etc/rc.conf.d/initial_setup
    SystemCalls->>Sysrc: sysrc -qx initial_setup_enable
    Sysrc-->>SystemCalls: clear legacy rc.conf setting
    SystemCalls-->>SetupStation: first-boot setup disabled
Loading

Flow diagram for deferred first-boot setup disablement

flowchart TD
    A[Machine boots] --> B[initial_setup runs]
    B --> C[setup-station runs installation steps]
    C --> D[disable_initial_setup]
    D --> E[Clear current and legacy enablement]
    E --> F[Setup complete]
Loading

File-Level Changes

Change Details Files
Move first-boot service shutdown into the final setup-station step so it occurs only after setup has completed.
  • Replace the removed live-user autologin cleanup call with initial_setup disabling.
  • Update the progress label and step comment to reflect the new behavior.
  • Delete both the installer-generated rc.conf.d file and the legacy rc.conf variable, tolerating an absent legacy variable.
setup_station/setup_system.py
setup_station/system_calls.py
Remove obsolete first-boot and autologin implementation artifacts and update ancillary metadata.
  • Remove the old initial_setup service script.
  • Remove the no-longer-needed GhostBSD autologin cleanup path.
  • Update ignored/generated files and re-extract the changed setup-step message identifier.
src/initial_setup
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="setup_station/setup_system.py" line_range="72-73" />
<code_context>
-    GLib.idle_add(update_progress, progress_bar, 5/6, get_text("Removing system setup autologin"))
-    remove_ghostbsd_autologin()
+    # Step 5/6: Disabling first boot setup
+    GLib.idle_add(update_progress, progress_bar, 5/6, get_text("Disabling first boot setup"))
+    disable_initial_setup()
     sleep(1)

</code_context>
<issue_to_address>
**issue:** The new progress label is not present in the checked-in POT or translation catalogs, which still contain only "Removing system setup autologin". Non-English installations therefore fall back to the English string "Disabling first boot setup" instead of receiving an extracted/translated message.

**Triggers:** When setup-station runs with a non-English locale.

**Suggested fix:** Re-run the translation extraction/update command and include the new msgid in the POT and PO files.
</issue_to_address>

### Comment 2
<location path="setup_station/system_calls.py" line_range="523" />
<code_context>
-        run(['sed', '-i', '', '/ttyv0/s/ghostbsd/Pc/g', '/etc/ttys'], check=True)
+        # The variable is absent from rc.conf on current installs, and sysrc
+        # exits non-zero in that case, so this is deliberately unchecked.
+        run(['sysrc', '-qx', 'initial_setup_enable'])
     except Exception as e:
-        raise RuntimeError(f"Failed to remove ghostbsd autologin configuration: {e}") from e
</code_context>
<issue_to_address>
**issue (bug_risk):** The return status of `sysrc -qx initial_setup_enable` is ignored, so a permission, filesystem, or other sysrc failure is treated as success and the old `/etc/rc.conf` setting remains enabled. `disable_initial_setup` then returns without raising even though the service will run again on the next boot.

**Triggers:** When sysrc exits nonzero for a reason other than the intentionally absent variable.

**Suggested fix:** Distinguish the expected 'variable absent' status from operational failures and raise on the latter, or verify the variable was removed after the command.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and the change persistently disables the initial-setup service by deleting its configuration, and reverting the code will not restore that configuration on systems already processed. It also replaces the prior cleanup of GhostBSD autologin entries, so those entries may remain and permit automatic login; correcting either outcome requires manual system repair rather than a normal code revert.

Blocking findings: setup_station/setup_system.py:73, setup_station/system_calls.py:523


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread setup_station/setup_system.py Resolved
Comment thread setup_station/system_calls.py Resolved
- Updated translation files with new `POT-Creation-Date`.
- Adjusted references in `setup_system.py` for better consistency.
- Changed "Removing system setup autologin" to "Disabling first boot setup" for clarity.
- Added support to configure hardware clock mode, allowing users to choose between UTC or local time. Enhanced system timezone handling by symlinking `/etc/localtime` instead of copying zoneinfo files.
@ericbsd
ericbsd merged commit f5e936a into master Aug 30, 2026
1 check passed
@ericbsd
ericbsd deleted the rc-setup branch August 30, 2026 19:54
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Aug 30, 2026
@ericbsd ericbsd self-assigned this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant