SUSE / suse-migration-services

GNU General Public License v3.0
7 stars 10 forks source link

Prevent kernel filesystems from umount #145

Closed schaefi closed 4 years ago

schaefi commented 4 years ago

Since the change to let systemd drive the reboot process it is needed to keep the kernel filesystems proc, sys and dev open to let systemd perform its job. The umounting prior to reboot will be taken over by systemd as well. However if systemd can't read e.g the state of kexec through /sys it can't work as expected

tserong commented 4 years ago

Change looks good, I just want to do a rebuild and test here for my own sanity :-)

tserong commented 4 years ago

...just doing a couple more tests...

tserong commented 4 years ago

Either one of the following will fix it, without any changes to the mount code needed:

index 3069725..0d43a40 100644
--- a/suse_migration_services/units/reboot.py
+++ b/suse_migration_services/units/reboot.py
@@ -69,12 +69,12 @@ def main():
             log.info(
                 # reboot is performed through systemd. The call through
                 # systemd checks if there is a kexec loaded kernel and
-                # transparently turns 'systemctl reboot' into
-                # 'systemctl kexec'. Thus both ways, soft and hard
-                # reboot are managed in one call.
+                # transparently turns 'reboot' into 'systemctl kexec'.
+                # Thus both ways, soft and hard reboot are managed in
+                # one call.
                 'Reboot system: {0}{1}'.format(
                     os.linesep, Command.run(
-                        ['systemctl', 'reboot']
+                        ['reboot']
                     )
                 )
             )

-- or --

index 3069725..850e97e 100644
--- a/suse_migration_services/units/reboot.py
+++ b/suse_migration_services/units/reboot.py
@@ -66,15 +66,14 @@ def main():
                         )
                     )
                 )
+            if MigrationConfig().is_soft_reboot_requested():
+                reboot_cmd = 'kexec'
+            else:
+                reboot_cmd = 'reboot'
             log.info(
-                # reboot is performed through systemd. The call through
-                # systemd checks if there is a kexec loaded kernel and
-                # transparently turns 'systemctl reboot' into
-                # 'systemctl kexec'. Thus both ways, soft and hard
-                # reboot are managed in one call.
                 'Reboot system: {0}{1}'.format(
                     os.linesep, Command.run(
-                        ['systemctl', 'reboot']
+                        ['systemctl', reboot_cmd]
                     )
                 )
             )
schaefi commented 4 years ago

Thanks much for your investigations. I'll adapt the code. I like if we can stay explicit in the code

schaefi commented 4 years ago

closing on behalf of #146