[neon/neon/calamares-settings/Neon/unstable] oem-prepare: setting oem uid/gid to 60000 is enough on it's own
Carlos De Maine
null at kde.org
Fri Feb 20 05:16:26 GMT 2026
Git commit f9c4face6592da2d0b45e636815cac9a5095374d by Carlos De Maine.
Committed on 20/02/2026 at 05:16.
Pushed by carlosdem into branch 'Neon/unstable'.
setting oem uid/gid to 60000 is enough on it's own
to reset the counter for useradd
M +0 -4 oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
M +4 -9 oem-prepare/usr/sbin/calamares-oem-uid
M +1 -5 oem-prepare/usr/sbin/calamares-oem-uid-undo-and-configure
https://invent.kde.org/neon/neon/calamares-settings/-/commit/f9c4face6592da2d0b45e636815cac9a5095374d
diff --git a/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup b/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
index 50c61db..cdcce3b 100755
--- a/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
+++ b/oem-prepare/calamares/oem-prepare/prepare-system/oem-cleanup
@@ -31,7 +31,3 @@ done
# finalize the cleanup. On the flip side we need to manually rm.
rm -rf /usr/bin/calmares-oem
rm -rf /usr/share/calmares-oem
-
-# remove the last of the oem uer dance/hack
-mv $ROOT/etc/login.defs.oem $ROOT/etc/login.defs
-
diff --git a/oem-prepare/usr/sbin/calamares-oem-uid b/oem-prepare/usr/sbin/calamares-oem-uid
index baceb78..b198594 100755
--- a/oem-prepare/usr/sbin/calamares-oem-uid
+++ b/oem-prepare/usr/sbin/calamares-oem-uid
@@ -3,16 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# Hack...
-# This hack allows us to not break with the expecation that the default/first
-# user will be UID 1000.
-# Since calamares doesn't allow forcing a uid we'll implcitly move the
-# auto-ranges so the oem user is created at uid 60000.
+# This hack allows us to not break with the expecation that the default/first user will be UID 1000.
+# Since calamares doesn't allow forcing a uid we'll implcitly move the auto-ranges so the oem user is created at uid 60000.
# useradd adds a user uid even if we set the uid_min to a system uid (eg 900) as we are adding a user account.
-# The first part of this hack is undone in a calamares-oem-uid-undo-and-configure once the user was created.
-# We also then set a new hack of uid_max and gid_max at 59999 which let's useradd reset the uid
-# counter as our oem user has a uid equal to the max, thus the to be installed user will be uid 1000.
-# Finally, in the oem-cleanup service, we cp the original login.defs back after oem user has been deleted and we
-# are about to reboot into the freshly installed system.
+# As oem user has the maximum uid & gid of 60000, the new installed on first boot will receive the reset min id and gid of 1000.
+# This this hack is undone in a calamares-oem-uid-undo-and-configure after the user has been created.
# EndHack...
set -ex
diff --git a/oem-prepare/usr/sbin/calamares-oem-uid-undo-and-configure b/oem-prepare/usr/sbin/calamares-oem-uid-undo-and-configure
index 99a1ee7..5f8459a 100755
--- a/oem-prepare/usr/sbin/calamares-oem-uid-undo-and-configure
+++ b/oem-prepare/usr/sbin/calamares-oem-uid-undo-and-configure
@@ -10,13 +10,9 @@ set -ex
ROOT=$1
# reinstate login.defs and reset user uid & gid to 1000
-cp $ROOT/etc/login.defs.oem $ROOT/etc/login.defs
-sed -i 's%UID_MAX.*1000%UID_MAX 60000%g' $ROOT/etc/login.defs
-sed -i 's%GID_MAX.*1000%GID_MAX 60000%g' $ROOT/etc/login.defs
-
+mv $ROOT/etc/login.defs.oem $ROOT/etc/login.defs
# ... and also do some special modifications to configure the oem user
-
mkdir -p $ROOT/home/oem/Desktop
ln -s ../../../calamares/oem-prepare/oem-prepare.desktop $ROOT/home/oem/Desktop/oem-prepare.desktop
# Make sure the oem user (900) can clean up this file!
More information about the Neon-commits
mailing list