Stop systemd automounts when unmounting
@@ -175,11 +175,27 @@ class UnmountOldrootState(OSEncryptionState):
sleep(10)
+ proc_comm = ProcessCommunicator()
+ self.command_executor.Execute(command_to_execute="systemctl list-units",
+ raise_exception_on_failure=True,
+ communicator=proc_comm)
+
+ for line in proc_comm.stdout.split('\n'):
+
+ match = re.search(r'\s(\S*?\.mount)', line)
+ if match:
+ mount = match.groups()[0]
+ self.command_executor.Execute('systemctl stop {0}'.format(mount))
+ continue
+
+ sleep(10)
+
if self.command_executor.Execute('mountpoint /var') == 0:
self.command_executor.Execute('umount /var', True)
sleep(3)
+ if self.command_executor.Execute('mountpoint ' + mountpoint) == 0:
self.command_executor.Execute('umount ' + mountpoint, True)
def should_exit(self):
