From 12ba9020c4fb25172e432e866c8aaa4ce2029a1e Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Apr 24 2026 01:05:19 +0000 Subject: Revert "livesys-main: Don't create liveuser on GNOME" This reverts commit de4d00ddf5eecffa1e20fb5e1b3eeb7c91d641d2. We gave up on the 'run gnome-initial-setup on live boot' approach a couple of years ago, with GNOME 47 Beta, because the patches were not merged upstream and maintaining them downstream became too onerous: https://src.fedoraproject.org/rpms/gnome-initial-setup/c/3cd24ee0efb277932c28e3e39fd09b49870fe128?branch=rawhide so we should have reverted this at that time, too. We only have not noticed any problems more or less by coincidence: creation of /var/lib/gnome-initial-setup has not been working in the live environment, which means we wind up creating a liveuser account anyway because the check for /var/lib/gnome-initial-setup in this code fails. Recently on ELN, though, /var/lib/gnome-initial-setup started to get successfully created in the live env, so we don't create a liveuser account, and so g-i-s runs. This should fix that, and also mean we don't suddenly started seeing g-i-s on Rawhide if /var/lib/gnome-initial-setup starts showing up again there. --- diff --git a/libexec/livesys/livesys-main b/libexec/livesys/livesys-main index b21105d..cfb9e03 100755 --- a/libexec/livesys/livesys-main +++ b/libexec/livesys/livesys-main @@ -22,15 +22,6 @@ fi { [ "${cmdline##* rd.live.image[= ]}" = "$cmdline" ] && [ "${cmdline##* liveimg[= ]}" = "$cmdline" ]; } && exit 0 -autouser=1 -if [ -f /etc/sysconfig/livesys ]; then - . /etc/sysconfig/livesys - - if [ "${livesys_session}" = "gnome" -a -d /var/lib/gnome-initial-setup/ ]; then - autouser=0 - fi -fi - [ -e /.liveimg-configured ] && configdone=1 livedir="LiveOS" @@ -100,11 +91,9 @@ fi ################### Code below runs only on first boot ##################### # add liveuser user with no passwd -if [ "${autouser}" -eq "1" ]; then - action "Adding live user" useradd ${USERADDARGS:+"$USERADDARGS"} -c "Live System User" liveuser - passwd -d liveuser > /dev/null - usermod -aG wheel liveuser > /dev/null -fi +action "Adding live user" useradd ${USERADDARGS:+"$USERADDARGS"} -c "Live System User" liveuser +passwd -d liveuser > /dev/null +usermod -aG wheel liveuser > /dev/null # Remove root password lock passwd -d root > /dev/null @@ -144,10 +133,16 @@ sed -i 's/rtcsync//' /etc/chrony.conf # https://bugzilla.redhat.com/show_bug.cgi?id=1370222 hostnamectl set-hostname "localhost-live" -if [ "${livesys_session}" ]; then - if [ -f "/usr/libexec/livesys/sessions.d/livesys-${livesys_session}" ]; then - . /usr/libexec/livesys/sessions.d/"livesys-${livesys_session}" +if [ -f /etc/sysconfig/livesys ]; then + + . /etc/sysconfig/livesys + + if [ "${livesys_session}" ]; then + if [ -f "/usr/libexec/livesys/sessions.d/livesys-${livesys_session}" ]; then + . /usr/libexec/livesys/sessions.d/"livesys-${livesys_session}" + fi fi + fi # allow extra stuff to be defined for derived spins (e.g., fedora labs) @@ -156,10 +151,8 @@ if [ -f /var/lib/livesys/livesys-session-extra ]; then fi # make sure to set the right permissions and selinux contexts -if [ -d /home/liveuser ]; then - chown -R liveuser:liveuser /home/liveuser/ - restorecon -RF /home/liveuser/ -fi +chown -R liveuser:liveuser /home/liveuser/ +restorecon -RF /home/liveuser/ #>>>>> Mark things as configured and keep this at the end of this script. <<<<< : > /.liveimg-configured diff --git a/libexec/livesys/sessions.d/livesys-gnome b/libexec/livesys/sessions.d/livesys-gnome index e77c5ff..d357902 100755 --- a/libexec/livesys/sessions.d/livesys-gnome +++ b/libexec/livesys/sessions.d/livesys-gnome @@ -4,7 +4,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -cmdline="$(cat /proc/cmdline)" # disable gnome-software automatically downloading updates cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE @@ -21,11 +20,9 @@ cat >> /usr/share/gnome-shell/search-providers/org.gnome.Software-search-provide DefaultDisabled=true FOE -if [ ! -d /var/lib/gnome-initial-setup ]; then - # don't run gnome-initial-setup - mkdir ~liveuser/.config - : > ~liveuser/.config/gnome-initial-setup-done -fi +# don't run gnome-initial-setup +mkdir ~liveuser/.config +: > ~liveuser/.config/gnome-initial-setup-done # suppress anaconda spokes redundant with gnome-initial-setup cat >> /etc/sysconfig/anaconda << FOE @@ -51,24 +48,22 @@ if [ -f /usr/share/applications/liveinst.desktop ]; then favorite-apps=['org.mozilla.firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop'] FOE - if [ ! -d /var/lib/gnome-initial-setup ]; then - # Make the welcome screen show up - # The name was changed in March 2023 in Fedora 39, we can stop - # caring about the old name (fedora-welcome.desktop) when F38 is - # EOL - for deskname in org.fedoraproject.welcome-screen.desktop fedora-welcome.desktop; do - if [ -f /usr/share/anaconda/gnome/${deskname} ]; then - mkdir -p ~liveuser/.config/autostart - cp /usr/share/anaconda/gnome/${deskname} /usr/share/applications/ - cp /usr/share/anaconda/gnome/${deskname} ~liveuser/.config/autostart/ - fi - done - - # Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen - cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override <<- " FOE" - welcome-dialog-last-shown-version='4294967295' - FOE - fi + # Make the welcome screen show up + # The name was changed in March 2023 in Fedora 39, we can stop + # caring about the old name (fedora-welcome.desktop) when F38 is + # EOL + for deskname in org.fedoraproject.welcome-screen.desktop fedora-welcome.desktop; do + if [ -f /usr/share/anaconda/gnome/${deskname} ]; then + mkdir -p ~liveuser/.config/autostart + cp /usr/share/anaconda/gnome/${deskname} /usr/share/applications/ + cp /usr/share/anaconda/gnome/${deskname} ~liveuser/.config/autostart/ + fi + done + + # Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen + cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE +welcome-dialog-last-shown-version='4294967295' +FOE # Copy Anaconda branding in place if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then @@ -79,14 +74,12 @@ fi # rebuild schema cache with any overrides we installed glib-compile-schemas /usr/share/glib-2.0/schemas -# set up auto-login if it's a non-persistent boot -if [ "${cmdline##* rd.live.overlay[= ]}" != "$cmdline" -o ! -d /var/lib/gnome-initial-setup ]; then - cat > /etc/gdm/custom.conf <<- " FOE" - [daemon] - AutomaticLoginEnable=True - AutomaticLogin=liveuser - FOE -fi +# set up auto-login +cat > /etc/gdm/custom.conf << FOE +[daemon] +AutomaticLoginEnable=True +AutomaticLogin=liveuser +FOE # Turn off PackageKit-command-not-found while uninstalled if [ -f /etc/PackageKit/CommandNotFound.conf ]; then