Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package transactional-update for 
openSUSE:Factory checked in at 2024-04-14 11:53:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/transactional-update (Old)
 and      /work/SRC/openSUSE:Factory/.transactional-update.new.26366 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "transactional-update"

Sun Apr 14 11:53:56 2024 rev:106 rq:1167144 version:4.6.5

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/transactional-update/transactional-update.changes    
    2024-03-14 17:43:07.401118038 +0100
+++ 
/work/SRC/openSUSE:Factory/.transactional-update.new.26366/transactional-update.changes
     2024-04-14 11:54:21.570880636 +0200
@@ -1,0 +2,22 @@
+Fri Apr 12 15:36:13 UTC 2024 - Ignaz Forster <[email protected]>
+
+- Version 4.6.5
+  - Rework soft-reboot support introduced in 4.6.0:
+    - On transactional systems with systemd 254 the system could
+      hang with with a soft-reboot, as /var and /etc have to be
+      mounted in /run/nextroot explicitly. As a soft-reboot can
+      also be triggered by an admin the mounting of the
+      corresponding mount points was moved to a systemd service to
+      be independent of t-u itself.
+    - Support for systemd 255
+    - Don't decrease reboot level on multiple commands
+    - Various other bugfixes
+    - soft-reboot support is disabled by default now to gather more feedback
+  - libtukit: Fix kexec reboot method to boot kernel / initrd of next snapshot
+  - tukit: Don't clone lock file handle on exec [boo#1222411]
+  - t-u: Always use zypper of installed system [bsc#1221346]
+  - t-u: Remove remaining telemetrics references
+- Add prepare-nextroot-for-softreboot service
+- Add (empty) %check section
+
+-------------------------------------------------------------------

Old:
----
  transactional-update-4.6.0.tar.gz

New:
----
  transactional-update-4.6.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ transactional-update.spec ++++++
--- /var/tmp/diff_new_pack.IottVo/_old  2024-04-14 11:54:22.414911817 +0200
+++ /var/tmp/diff_new_pack.IottVo/_new  2024-04-14 11:54:22.418911965 +0200
@@ -26,7 +26,7 @@
 %{!?_distconfdir: %global _distconfdir %{_prefix}%{_sysconfdir}}
 
 Name:           transactional-update
-Version:        4.6.0
+Version:        4.6.5
 Release:        0
 Summary:        Transactional Updates with btrfs and snapshots
 License:        GPL-2.0-or-later AND LGPL-2.1-or-later
@@ -226,15 +226,19 @@
 
 %pre -n tukit
 %systemd_pre create-dirs-from-rpmdb.service
+%systemd_pre prepare-nextroot-for-softreboot.service
 
 %post -n tukit
 %systemd_post create-dirs-from-rpmdb.service
+%systemd_post prepare-nextroot-for-softreboot.service
 
 %preun -n tukit
 %systemd_preun create-dirs-from-rpmdb.service
+%systemd_preun prepare-nextroot-for-softreboot.service
 
 %postun -n tukit
 %systemd_postun_with_restart create-dirs-from-rpmdb.service
+%systemd_postun_with_restart prepare-nextroot-for-softreboot.service
 
 %pre -n tukitd
 %systemd_pre tukitd.service
@@ -291,6 +295,8 @@
 %{_sbindir}/tukit
 %{_sbindir}/create_dirs_from_rpmdb
 %{_unitdir}/create-dirs-from-rpmdb.service
+%{_libexecdir}/prepare-nextroot-for-softreboot
+%{_unitdir}/prepare-nextroot-for-softreboot.service
 %{_distconfdir}/tukit.conf
 %{_mandir}/man5/tukit.conf.5.gz
 
@@ -323,3 +329,5 @@
 %files zypp-config
 %config(noreplace) %{_sysconfdir}/zypp/systemCheck.d/transactional-update.check
 
+%check
+

++++++ transactional-update-4.6.0.tar.gz -> transactional-update-4.6.5.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/.gitignore 
new/transactional-update-4.6.5/.gitignore
--- old/transactional-update-4.6.0/.gitignore   2024-03-04 15:47:42.000000000 
+0100
+++ new/transactional-update-4.6.5/.gitignore   2024-04-12 17:03:40.000000000 
+0200
@@ -37,6 +37,7 @@
 tukitd
 sbin/transactional-update
 src/transactional-update
+systemd/prepare-nextroot-for-softreboot.service
 systemd/transactional-update.service
 systemd/transactional-update-cleanup.service
 man/transactional-update.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/NEWS 
new/transactional-update-4.6.5/NEWS
--- old/transactional-update-4.6.0/NEWS 2024-03-04 15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/NEWS 2024-04-12 17:03:40.000000000 +0200
@@ -2,6 +2,22 @@
 
 Copyright (C) 2016-2023 Thorsten Kukuk, Ignaz Forster et al.
 
+Version 4.6.5 (2024-04-12)
+* Rework soft-reboot support introduced in 4.6.0:
+  * On transactional systems with systemd 254 the system could hang with with
+    a soft-reboot, as /var and /etc have to be mounted in /run/nextroot
+    explicitly. As a soft-reboot can also be triggered by an admin the
+    mounting of the corresponding mount points was moved to a systemd service
+    to be independent of t-u itself.
+  * Support for systemd 255
+  * Don't decrease reboot level on multiple commands
+  * Various other bugfixes
+  * soft-reboot support is disabled by default now to gather more feedback
+* libtukit: Fix kexec reboot method to boot kernel / initrd of next snapshot
+* tukit: Don't clone lock file handle on exec [boo#1222411]
+* t-u: Always use zypper of installed system [bsc#1221346]
+* t-u: Remove remaining telemetrics references
+
 Version 4.6.0 (2024-03-04)
 * tukit / t-u: Implement support for systemd soft-reboot, but needs package
   manager support (provided by zypp-boot-plugin on openSUSE) to determine which
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/configure.ac 
new/transactional-update-4.6.5/configure.ac
--- old/transactional-update-4.6.0/configure.ac 2024-03-04 15:47:42.000000000 
+0100
+++ new/transactional-update-4.6.5/configure.ac 2024-04-12 17:03:40.000000000 
+0200
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(transactional-update, 4.6.0)
+AC_INIT(transactional-update, 4.6.5)
 # Increase on any interface change and reset revision
 LIBTOOL_CURRENT=5
 # On interface change increase if backwards compatible, reset otherwise
 LIBTOOL_AGE=1
 # Increase on *any* C/C++ library code change, reset at interface change
-LIBTOOL_REVISION=1
+LIBTOOL_REVISION=2
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_FILES([tukit.pc])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/etc/tukit.conf 
new/transactional-update-4.6.5/etc/tukit.conf
--- old/transactional-update-4.6.0/etc/tukit.conf       2024-03-04 
15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/etc/tukit.conf       2024-04-12 
17:03:40.000000000 +0200
@@ -15,7 +15,7 @@
 # For "rebootmgr" and "systemd" reboot methods, allow them to use
 # systemd's soft-reboot mechanism if /run/reboot-needed indicates this
 # would be sufficient (see man 8 zypp-boot-plugin).
-REBOOT_ALLOW_SOFT_REBOOT=true
+REBOOT_ALLOW_SOFT_REBOOT=false
 
 # For "systemd" reboot method, allow to use kexec to reboot into the new
 # system if /run/reboot-needed indicates this would be sufficient (see
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/lib/Reboot.cpp 
new/transactional-update-4.6.5/lib/Reboot.cpp
--- old/transactional-update-4.6.0/lib/Reboot.cpp       2024-03-04 
15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/lib/Reboot.cpp       2024-04-12 
17:03:40.000000000 +0200
@@ -9,7 +9,6 @@
 #include "Configuration.hpp"
 #include "Exceptions.hpp"
 #include "Log.hpp"
-#include "Mount.hpp"
 #include "Snapshot.hpp"
 #include "SnapshotManager.hpp"
 #include "Util.hpp"
@@ -46,16 +45,8 @@
         type = "force-kexec";
     }
 
-    if (type == "soft-reboot" && config.get("REBOOT_ALLOW_SOFT_REBOOT") == 
"true") {
-        auto sf = SnapshotFactory::get();
-        std::unique_ptr<Snapshot> newSnap = sf->open(sf->getDefault());
-        auto nextroot = new BindMount("/run/nextroot");
-        nextroot->setSource(newSnap->getRoot());
-        nextroot->mount();
-    }
-
     if (method == "rebootmgr") {
-        if (type == "soft-boot" && config.get("REBOOT_ALLOW_SOFT_REBOOT") == 
"true") {
+        if (type == "soft-reboot" && config.get("REBOOT_ALLOW_SOFT_REBOOT") == 
"true") {
             command  = "/usr/sbin/rebootmgrctl soft-reboot";
         } else {
             command  = "/usr/sbin/rebootmgrctl reboot";
@@ -64,10 +55,14 @@
         command  = "/usr/bin/transactional-update-notifier client";
     } else if (method == "systemd") {
         command  = "sync;";
-        if (type == "soft-boot" && config.get("REBOOT_ALLOW_SOFT_REBOOT") == 
"true") {
+        if (type == "soft-reboot" && config.get("REBOOT_ALLOW_SOFT_REBOOT") == 
"true") {
             command += "systemctl soft-reboot;";
-        } else if (type == "force-kexec" || ((type == "kexec" || type == 
"soft-boot") && config.get("REBOOT_ALLOW_KEXEC") == "true")) {
-            command  = "kexec --kexec-syscall-auto -l /boot/vmlinuz 
--initrd=/boot/initrd --reuse-cmdline;";
+        } else if (type == "force-kexec" || ((type == "kexec" || type == 
"soft-reboot") && config.get("REBOOT_ALLOW_KEXEC") == "true")) {
+            auto sm = SnapshotFactory::get();
+            sm->getDefault();
+            std::unique_ptr<Snapshot> defaultSnap = sm->open(sm->getDefault());
+
+            command  = "kexec --kexec-syscall-auto -l " + 
std::string(defaultSnap->getRoot() / "boot" / "vmlinuz") + " --initrd=" + 
std::string(defaultSnap->getRoot() / "boot" / "initrd") + " --reuse-cmdline;";
             command += "systemctl kexec;";
         } else {
             command += "systemctl reboot;";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/transactional-update-4.6.0/sbin/transactional-update.in 
new/transactional-update-4.6.5/sbin/transactional-update.in
--- old/transactional-update-4.6.0/sbin/transactional-update.in 2024-03-04 
15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/sbin/transactional-update.in 2024-04-12 
17:03:40.000000000 +0200
@@ -44,7 +44,7 @@
 REGISTRATION_ARGS=""
 ROLLBACK_SNAPSHOT=0
 REBOOT_AFTERWARDS=0
-REBOOT_LEVEL="reboot"
+REBOOT_LEVEL="none"
 REBOOT_LEVEL_PREV=""
 REBOOT_METHOD="auto"
 declare -A REBOOT_ASSOCS
@@ -52,13 +52,13 @@
 REBOOT_PRIO[reboot]=3
 REBOOT_PRIO[kexec]=2
 REBOOT_PRIO[soft-reboot]=1
+REBOOT_PRIO[none]=0
 RUN_CMD=""
 RUN_SHELL=0
 SETUP_FIPS=0
 SETUP_KDUMP=0
 SETUP_SELINUX=0
 UPDATE_METHOD="up"
-USE_TELEMETRICS=0
 CONFFILE="@sysconfdir@/transactional-update.conf"
 SYSTEMCONFFILE="@prefix@@sysconfdir@/transactional-update.conf"
 LOGFILE="/var/log/transactional-update.log"
@@ -100,8 +100,9 @@
 BASE_SNAPSHOT_ID=""
 TMPFILE=""
 APPLYWORKDIR=""
-DO_CALLEXT=0
+DO_CALLEXT=1
 LAST_BOOTED=""
+HAS_COMMAND=0
 
 declare -A ROLES=()
 REPOS=()
@@ -393,7 +394,7 @@
        rmdir "${APPLYWORKDIR}/mount"
        rmdir "${APPLYWORKDIR}"
        if [ -e "${NEEDS_RESTARTING_FILE}" ]; then
-           grep -q soft-reboot "${NEEDS_RESTARTING_FILE}" && rm 
"${NEEDS_RESTARTING_FILE}"
+           grep -q soft-reboot "${NEEDS_RESTARTING_FILE}" && rm 
"${NEEDS_RESTARTING_FILE}" && REBOOT_AFTERWARDS=0
        fi
 
        log_info "Executing systemctl daemon-reexec..."
@@ -411,22 +412,20 @@
     fi
 }
 
-write_needs_restarting() {
-    local prio1="${REBOOT_PRIO[${1}]}"
-    local prio2=0
-    local prio3=0
-    if [ -n "${2}" ]; then
-       prio2="${REBOOT_PRIO[${2}]}"
+set_reboot_level() {
+    if [ "${REBOOT_PRIO[${1}]}" -gt "${REBOOT_PRIO[${REBOOT_LEVEL}]}" ]; then
+       REBOOT_LEVEL="${1}"
     fi
+}
+
+write_needs_restarting() {
     if [ -e "${NEEDS_RESTARTING_FILE}" ]; then
-       prio3="${REBOOT_PRIO[$(cat "${NEEDS_RESTARTING_FILE}")]}"
+       if [ "${REBOOT_PRIO[${REBOOT_LEVEL}]}" -lt "${REBOOT_PRIO[$(cat 
"${NEEDS_RESTARTING_FILE}")]}" ]; then
+           REBOOT_LEVEL="$(cat "${NEEDS_RESTARTING_FILE}")"
+       fi
     fi
 
-    if [ "${prio1}" -ge "${prio2}" ] && [ "${prio1}" -gt "${prio3}" ]; then
-       echo -n "${1}" > "${NEEDS_RESTARTING_FILE}"
-    elif [ "${prio2}" -ge "${prio1}" ] && [ "${prio2}" -gt "${prio3}" ]; then
-       echo -n "${2}" > "${NEEDS_RESTARTING_FILE}"
-    fi
+    echo -n "${REBOOT_LEVEL}" > "${NEEDS_RESTARTING_FILE}"
 }
 
 add_unique_id() {
@@ -854,6 +853,10 @@
            break
        fi
 
+       if [[ $1 != --* ]]; then
+           HAS_COMMAND=1
+       fi
+
        case "$1" in
            cleanup)
                DO_CLEANUP_OVERLAYS=1
@@ -872,20 +875,16 @@
                DO_DUP=1
                ZYPPER_ARG="--no-cd dup"
                shift
-               TELEM_CLASS="upgrade"
                ;;
            update|up)
                ZYPPER_ARG=up
                shift
-               TELEM_CLASS="update"
                ;;
            patch)
                ZYPPER_ARG="--non-interactive-include-reboot-patches patch"
                shift
-               TELEM_CLASS="patch"
                ;;
            ptf|pkg|package)
-               TELEM_CLASS="package"
                shift
                if [ $# -eq 0 ]; then
                    usage 1
@@ -900,7 +899,7 @@
                    remove|rm)
                        ZYPPER_ARG="remove"
                        if [ -n "${ZYPPER_NONINTERACTIVE}" ]; then
-                   ZYPPER_NONINTERACTIVE="-y"
+                           ZYPPER_NONINTERACTIVE="-y"
                        fi
                        shift
                        ;;
@@ -912,7 +911,6 @@
                        usage 1;
                        ;;
                esac
-               DO_CALLEXT=1
 
                if [ $# -eq 0 ]; then
                    usage 1
@@ -928,8 +926,6 @@
                done
                ;;
            migration)
-               TELEM_CLASS="migration"
-               __NO_RESET=0
                DO_MIGRATION=1
                ZYPPER_ARG="migration --no-snapshots --no-selfupdate"
                if [ -n "${FORCE_NONINTERACTIVE}" ]; then
@@ -942,18 +938,15 @@
                shift
                ;;
            bootloader)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="bootloader"
                REWRITE_BOOTLOADER=1
                REWRITE_GRUB_CFG=1
                shift
                ;;
            grub.cfg)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="bootloader"
                REWRITE_GRUB_CFG=1
                shift
                ;;
            shell)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="shell"
                RUN_SHELL=1
                shift
                if [ "$1" = "-c" ]; then
@@ -967,13 +960,11 @@
                fi
                ;;
            initrd)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="initrd"
                REWRITE_INITRD=1
                REBUILD_KDUMP_INITRD=1
                shift
                ;;
            kdump)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="kdump"
                REBUILD_KDUMP_INITRD=1
                SETUP_KDUMP=2
                shift
@@ -983,7 +974,6 @@
                shift
                ;;
            rollback)
-               TELEM_CLASS="rollback"
                DO_ROLLBACK=1
                DO_SELF_UPDATE=0
                shift
@@ -997,7 +987,6 @@
                shift
                ;;
            run)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="shell"
                DO_RUN=1
                shift
 
@@ -1010,12 +999,10 @@
                break
                ;;
            setup-fips)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="fips"
                SETUP_FIPS=1
                shift
                ;;
            setup-kdump)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="setup-kdump"
                SETUP_KDUMP=1
                shift
                if [[ $1 == --crashkernel* ]]; then
@@ -1029,7 +1016,6 @@
                fi
                ;;
            setup-selinux)
-               test -z "$TELEM_CLASS" && TELEM_CLASS="selinux"
                SETUP_SELINUX=1
                shift
                ;;
@@ -1192,9 +1178,7 @@
 fi
 
 # If no commands were given, use default from config
-if [ -z "${ZYPPER_ARG}" -a -z "${TELEM_CLASS}" -a "${REBOOT_AFTERWARDS}" -eq 0 
\
-       -a "${DO_REGISTRATION}" -eq 0 -a "${DO_CLEANUP_OVERLAYS}" -eq 0 \
-       -a "${DO_CLEANUP_SNAPSHOTS}" -eq 0 -a "${DO_APPLY}" -eq 0 ]; then
+if [ "${HAS_COMMAND}" -eq 0 ]; then
     parse_args "${UPDATE_METHOD}"
 fi
 
@@ -1204,14 +1188,6 @@
     exit 1
 fi
 
-# Store current reboot level for reset in case of failure and delete flag file
-if [ -e "${NEEDS_RESTARTING_FILE}" ]; then
-    REBOOT_LEVEL_PREV="$(cat "${NEEDS_RESTARTING_FILE}")"
-    rm "${NEEDS_RESTARTING_FILE}"
-else
-    REBOOT_LEVEL_PREV=none
-fi
-
 # Check if this is a self-updated transactional-update; if it isn't lock and
 # check for update
 if [ -z "${TA_UPDATE_TMPFILE}" ]; then
@@ -1244,6 +1220,14 @@
 # Clean up in case the application is interrupted
 trap 'log_error "Received termination signal..." && quit 1' HUP INT QUIT TERM
 
+# Store current reboot level for reset in case of failure and delete flag file
+if [ -e "${NEEDS_RESTARTING_FILE}" ]; then
+    REBOOT_LEVEL_PREV="$(cat "${NEEDS_RESTARTING_FILE}")"
+    rm "${NEEDS_RESTARTING_FILE}"
+else
+    REBOOT_LEVEL_PREV=none
+fi
+
 # Load old state file
 if [ -f ${STATE_FILE} ]; then
     . ${STATE_FILE}
@@ -1331,7 +1315,8 @@
        if [ ${NEED_REBOOT} -eq 0 ]; then
            rm -f "${NEEDS_RESTARTING_FILE}"
        else
-           write_needs_restarting "${REBOOT_LEVEL}" 
"${REBOOT_ASSOCS[${ROLLBACK_SNAPSHOT}]}"
+           REBOOT_LEVEL="reboot"
+           write_needs_restarting
        fi
     else
        NEED_REBOOT=1
@@ -1478,7 +1463,7 @@
 
     if [ ${DO_REGISTRATION} -eq 1 ]; then
        tukit ${TUKIT_OPTS} callext ${SNAPSHOT_ID} SUSEConnect --root {} 
${REGISTRATION_ARGS} |& tee -a ${LOGFILE} 1>&${origstdout}
-       REBOOT_LEVEL="soft-reboot"
+       set_reboot_level "soft-reboot"
     fi
 
     if [ -n "${ZYPPER_ARG}" ]; then
@@ -1487,7 +1472,7 @@
        if [ ${DO_MIGRATION} -eq 1 ]; then
            # transactional-update migration
            export DISABLE_RESTART_ON_UPDATE=yes
-           tukit ${TUKIT_OPTS} call "${SNAPSHOT_ID}" zypper ${ZYPPER_ARG} 
${ZYPPER_NONINTERACTIVE} "${ZYPPER_ARG_PKGS[@]}" |& tee -a ${LOGFILE} 
1>&${origstdout}
+           tukit ${TUKIT_OPTS} callext "${SNAPSHOT_ID}" zypper ${ZYPPER_ARG} 
--root {} ${ZYPPER_NONINTERACTIVE} "${ZYPPER_ARG_PKGS[@]}" |& tee -a ${LOGFILE} 
1>&${origstdout}
            RETVAL=${PIPESTATUS[0]}
        else
            if [ ${DO_CALLEXT} -eq 1 ]; then
@@ -1561,7 +1546,9 @@
        fi
        # If zypp-boot-plugin is available and didn't return anything, then 
soft-reboot is enough
        if rpm --quiet -q zypp-boot-plugin && [ ! -e "${NEEDS_RESTARTING_FILE}" 
] ; then
-           REBOOT_LEVEL="soft-reboot"
+           set_reboot_level "soft-reboot"
+       else
+           set_reboot_level "reboot"
        fi
     fi
 
@@ -1621,7 +1608,7 @@
        else
            REBUILD_KDUMP_INITRD=1
        fi
-       REBOOT_LEVEL="kexec"
+       set_reboot_level "kexec"
     fi
 
     if [ ${REBUILD_KDUMP_INITRD} -eq 1 ]; then
@@ -1631,7 +1618,7 @@
            log_error "ERROR: kdump initrd creation failed!"
            EXITCODE=1
        fi
-       REBOOT_LEVEL="soft-reboot"
+       set_reboot_level "soft-reboot"
     fi
 
     if [ ${REWRITE_GRUB_CFG} -eq 1 ]; then
@@ -1645,6 +1632,7 @@
                 chcon --reference /boot/grub2/grub.cfg 
"${SNAPSHOT_DIR}/boot/grub2/grub.cfg"
             fi
        fi
+       set_reboot_level "reboot"
     fi
 
     if [ ${REWRITE_BOOTLOADER} -eq 1 ]; then
@@ -1654,16 +1642,19 @@
            log_error "ERROR: /sbin/pbl --install failed!"
            EXITCODE=1;
        fi
+       set_reboot_level "reboot"
     fi
 
     if [ ${DO_RUN} -eq 1 ]; then
        tukit ${TUKIT_OPTS} call "${SNAPSHOT_ID}" "${RUN_CMD[@]}" |& tee -a 
${LOGFILE} 1>&${origstdout}
+       set_reboot_level "reboot"
     fi
 
     if [ ${RUN_SHELL} -eq 1 ]; then
        log_to_stdout "Opening chroot in snapshot ${SNAPSHOT_ID}, continue with 
'exit'"
         export PS1="transactional update # "
        tukit ${TUKIT_OPTS} call "${SNAPSHOT_ID}" bash 1>&${origstdout} 
2>&${origstderr}
+       set_reboot_level "reboot"
     fi
 
     if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then
@@ -1723,8 +1714,7 @@
        quit ${EXITCODE}
     fi
 
-    write_needs_restarting "${REBOOT_LEVEL}" 
"${REBOOT_ASSOCS[${BASE_SNAPSHOT_ID}]}"
-    rebootmethod="$(cat "${NEEDS_RESTARTING_FILE}")"
+    write_needs_restarting
     if ! { [ $REBOOT_AFTERWARDS -eq 1 ] || [ $DO_APPLY -eq 1 -a 
"${rebootmethod}" == "soft-reboot" ]; }; then
        log_info ""
        log_info "Please reboot your machine to activate the changes and avoid 
data loss."
@@ -1741,6 +1731,11 @@
     log_info "New default snapshot is #${SNAPSHOT_ID} (${SNAPSHOT_DIR})."
 fi
 
+# No command changing the reboot level given - restore potential previous one
+if [ "${REBOOT_LEVEL}" == "none" -a "${REBOOT_LEVEL_PREV}" != "none" ]; then
+    echo -n "${REBOOT_LEVEL_PREV}" > "${NEEDS_RESTARTING_FILE}"
+fi
+
 if [ ${DO_APPLY} -eq 1 -a ${EXITCODE} -eq 0 ]; then
     do_apply
 fi
@@ -1748,7 +1743,7 @@
 log_info "transactional-update finished"
 
 if [ ${EXITCODE} -eq 0 ]; then
-    if [ $REBOOT_AFTERWARDS -eq 1 -a -e "${NEEDS_RESTARTING_FILE}" ]; then
+    if [ $REBOOT_AFTERWARDS -eq 1 ]; then
        trap '-' HUP INT QUIT TERM
        case "$REBOOT_METHOD" in
            auto)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/systemd/Makefile.am 
new/transactional-update-4.6.5/systemd/Makefile.am
--- old/transactional-update-4.6.0/systemd/Makefile.am  2024-03-04 
15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/systemd/Makefile.am  2024-04-12 
17:03:40.000000000 +0200
@@ -6,17 +6,22 @@
 
 systemd_DATA = transactional-update.timer transactional-update.service \
        transactional-update-cleanup.timer transactional-update-cleanup.service 
\
-       create-dirs-from-rpmdb.service
+       create-dirs-from-rpmdb.service prepare-nextroot-for-softreboot.service
 EXTRA_DIST = transactional-update.timer transactional-update-cleanup.timer \
        transactional-update.service.in transactional-update-cleanup.service.in 
\
-       create-dirs-from-rpmdb.service
-CLEANFILES = transactional-update.service transactional-update-cleanup.service
+       create-dirs-from-rpmdb.service 
prepare-nextroot-for-softreboot.service.in
+CLEANFILES = transactional-update.service transactional-update-cleanup.service 
\
+       prepare-nextroot-for-softreboot.service
+libexec_SCRIPTS = prepare-nextroot-for-softreboot
 
 do_subst = sed -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
        -e 's,[@]sbindir[@],$(sbindir),g' \
+       -e 's,[@]libexecdir[@],$(libexecdir),g' \
        -e 's,[@]prefix[@],$(prefix),g'
 
 transactional-update.service: transactional-update.service.in Makefile
        $(do_subst) < transactional-update.service.in > 
transactional-update.service
 transactional-update-cleanup.service: transactional-update-cleanup.service.in 
Makefile
        $(do_subst) < transactional-update-cleanup.service.in > 
transactional-update-cleanup.service
+prepare-nextroot-for-softreboot.service: 
prepare-nextroot-for-softreboot.service.in Makefile
+       $(do_subst) < prepare-nextroot-for-softreboot.service.in > 
prepare-nextroot-for-softreboot.service
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/transactional-update-4.6.0/systemd/prepare-nextroot-for-softreboot 
new/transactional-update-4.6.5/systemd/prepare-nextroot-for-softreboot
--- old/transactional-update-4.6.0/systemd/prepare-nextroot-for-softreboot      
1970-01-01 01:00:00.000000000 +0100
+++ new/transactional-update-4.6.5/systemd/prepare-nextroot-for-softreboot      
2024-04-12 17:03:40.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh -eu
+
+# By default a systemd soft-reboot will stay within the current snapshot. On
+# a regular r/w system this is not a problem because updates will change the
+# existing snapshot. On a transactional system however the default snapshot
+# will be changed, and the user probably wants to boot into that new snapshot.
+# In general this problem also exists when doing a rollback on a conventional
+# system, but we left systemd's default behavior there.
+
+# Someone prepared a nextroot mount already
+[ -e /run/nextroot/etc/fstab ] && exit 0
+
+# Don't do anything if in default snapshot already
+snapper --csvout list --columns default,active | grep -q 'yes,yes' || exit 0
+
+# Mount default subvolume into /run/nextroot
+mkdir -p /run/nextroot
+DEFAULT_SUBVOL="$(btrfs subvolume get-default /)"
+findmnt --noheadings / | awk '{ sub("subvol=/@/[^,]*", "", $4); 
sub("subvolid=[^,]*", "", $4); sub("\\[.*\\]", "", $2); system("mount -o \x27" 
$4 "\x27 " $2 " /run/nextroot") }'
+
+# Perform all mounts marked with x-initrd.mount inside /run/nextroot
+awk '$1 !~ /^#/ && $4 ~ /(\<|,)x-initrd\.mount(\>|,)/ {
+       gsub(/sysroot\//,"run/nextroot/", $4); # The /etc overlay mount 
hardcodes /sysroot paths in options
+       if(system("findmnt /run/nextroot" $2 " >/dev/null || mount 
--target-prefix /run/nextroot --fstab /run/nextroot/etc/fstab --options-mode 
ignore -o \x27" $4 "\x27 " $2) != 0) exit 1;
+       }' /run/nextroot/etc/fstab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/transactional-update-4.6.0/systemd/prepare-nextroot-for-softreboot.service.in
 
new/transactional-update-4.6.5/systemd/prepare-nextroot-for-softreboot.service.in
--- 
old/transactional-update-4.6.0/systemd/prepare-nextroot-for-softreboot.service.in
   1970-01-01 01:00:00.000000000 +0100
+++ 
new/transactional-update-4.6.5/systemd/prepare-nextroot-for-softreboot.service.in
   2024-04-12 17:03:40.000000000 +0200
@@ -0,0 +1,12 @@
+[Unit]
+Description=Mount next snapshot for soft-reboot
+DefaultDependencies=no
+Before=systemd-soft-reboot.service
+
+[Service]
+ExecStart=@libexecdir@/prepare-nextroot-for-softreboot
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+RequiredBy=soft-reboot.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/transactional-update-4.6.0/tukit/tukit.cpp 
new/transactional-update-4.6.5/tukit/tukit.cpp
--- old/transactional-update-4.6.0/tukit/tukit.cpp      2024-03-04 
15:47:42.000000000 +0100
+++ new/transactional-update-4.6.5/tukit/tukit.cpp      2024-04-12 
17:03:40.000000000 +0200
@@ -245,7 +245,7 @@
 class Lock {
 public:
     Lock(){
-        lockfile = open(config.get("LOCKFILE").c_str(), O_CREAT|O_WRONLY, 
0600);
+        lockfile = open(config.get("LOCKFILE").c_str(), 
O_CREAT|O_WRONLY|O_CLOEXEC, 0600);
         if (lockfile < 0) {
             throw runtime_error{"Could not create lock file '" + 
config.get("LOCKFILE") + "': " + strerror(errno)};
         }

Reply via email to