Skip to content

gnome-initial-setup: useradd fails (exit 12) when /var/home/<user> already exists on disk #17

@hanthor

Description

@hanthor

Problem

gnome-initial-setup fails at the final user-creation step with:

accounts-daemon: useradd: cannot create directory /var/home/james
gnome-initial-setup: Error saving data: Failed to create user 'james':
  GDBus.Error:org.freedesktop.Accounts.Error.Failed: running '/usr/sbin/useradd' failed: Child process exited with code 12

GIS then times out, the done marker (/var/lib/gnome-initial-setup-done) is never written, and GIS re-runs on every subsequent boot — creating an infinite loop.

Root Cause

shadow-utils 4.15.0 (EL10) calls mkdir(/var/home/<user>) in create_home_dir(). If the directory already exists (e.g. from a previous install on the same disk), mkdir returns EEXIST and shadow-utils exits with code 12 (E_HOMEDIR) rather than skipping creation gracefully.

This is reproducible when:

  • Installing Yellowfin onto a disk that previously had a Yellowfin (or any Linux) install with /var/home/<username> already present
  • The /var partition/directory is not wiped by the installer

Environment

  • Image: ghcr.io/tuna-os/yellowfin:gnome50
  • gnome-initial-setup-50.0-2.el10
  • shadow-utils-4.15.0-11.el10
  • selinux-policy-43.1-1.el10 (enforcing)
  • gnome50-el10-compat-1.2.6-1.el10 installed — SELinux modules present, no AVC denials observed

Workaround

touch /var/lib/gnome-initial-setup-done

This prevents GIS from re-running. The user then needs to be created manually via useradd.

Proposed Fixes

Option A — accounts-service / GIS wrapper (preferred)

Before calling useradd -m, check if the home directory already exists. If it does, pass -M (no home creation) and then chown/restorecon the existing directory instead.

This could be a patch to our gnome-initial-setup spec or a wrapper script around useradd.

Option B — shadow-utils patch

Backport the upstream shadow-utils fix that handles EEXIST gracefully in create_home_dir(). Newer versions (4.17+) handle this case.

Option C — tuna-installer

Have the tuna-installer wipe /var/home during a fresh install so GIS always has a clean slate.

Notes

  • gnome-initial-setup-first-login.service was skipped (ConditionEnvironment=XDG_SESSION_CLASS=user unmet) — so the copy-worker never ran either
  • F43 ships GIS 49.0; our COPR has GIS 50.0 (correct for gnome50 variant, matches F44)
  • The brew-setup.service bakes /var/home/linuxbrew into the image — this is unrelated but confirms /var/home is pre-populated before first boot

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions