Skip to content

Close and reset completed Tails Cloner after last drive removed

Based on !1310 (merged)

@sajolida requested this behavior to close #19696 (closed) along with !1310 (merged).

UX description: This does not reuse the original window, it closes it and opens a new window with the options inherited from the previous window. Meaning if the window was moved or resized that will also reset. It was too much work to make the various threads involved re-run without issues.

Implementation description: Add reset_on_remove method, monitors for removal of last cloned drive after complete and if removed closes window and opens new one, passing the previous window's selected opts. Local function check_drives checks if either last_device or last_parent remain after live.detect_supported_drives calls it. reset_on_remove is called whenever udisksclient emits a "changed" signal. Last, the if self.target_selected: statement prevents multiple windows from opening should the last drive be removed more than once.

Quirk: The GUI status log is normal. But if launched from the terminal, the 2nd iteration of cloning double prints the log, 3rd triple, etc. This is because the closed first window's logging thread is still running. Sorry, I don't know how to fix this without !1304 (merged) to pass the options to a whole new process. Should go unnoticed since most users launch with the app menu.

^Camnesia@amnesia:/usr/lib/python3/dist-packages/tails_installer$ tails-installer
2023-12-19 06:06:12,136 [creator.py:828 (partition_device)] INFO: Partitioning device /dev/sdc
2023-12-19 06:06:17,246 [creator.py:1184 (format_device)] INFO: Formatting /dev/sdc1 as FAT32
2023-12-19 06:06:18,340 [creator.py:984 (verify_filesystem)] INFO: Verifying filesystem...
2023-12-19 06:06:18,342 [creator.py:368 (extract_iso)] INFO: Extracting live image to the target device...
2023-12-19 06:07:26,010 [creator.py:375 (extract_iso)] INFO: Wrote to device at 18 MB/sec
2023-12-19 06:07:26,011 [creator.py:1259 (read_extracted_mbr)] INFO: Reading extracted MBR from /media/amnesia/Tails/utils/mbr/mbr.bin
2023-12-19 06:07:26,011 [creator.py:1019 (install_bootloader)] INFO: Installing bootloader...
2023-12-19 06:07:26,015 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:07:26,204 [creator.py:772 (unmount_device)] INFO: Unmounting mounted filesystems on "/dev/sdc1"
2023-12-19 06:07:27,247 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:07:27,465 [creator.py:1278 (reset_mbr)] INFO: Resetting Master Boot Record of /dev/sdc
2023-12-19 06:07:27,494 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
Running scope as unit: run-r6e666ce9c0ca459c94f366cb60e09241.scope
2023-12-19 06:28:12,541 [creator.py:828 (partition_device)] INFO: Partitioning device /dev/sdc
2023-12-19 06:28:12,541 [creator.py:828 (partition_device)] INFO: Partitioning device /dev/sdc
2023-12-19 06:28:18,435 [creator.py:1184 (format_device)] INFO: Formatting /dev/sdc1 as FAT32
2023-12-19 06:28:18,435 [creator.py:1184 (format_device)] INFO: Formatting /dev/sdc1 as FAT32
2023-12-19 06:28:19,606 [creator.py:289 (_get_udisks_object_data)] WARNING: Multiple mount points for /dev/sdc1
2023-12-19 06:28:19,606 [creator.py:289 (_get_udisks_object_data)] WARNING: Multiple mount points for /dev/sdc1
2023-12-19 06:28:19,720 [creator.py:984 (verify_filesystem)] INFO: Verifying filesystem...
2023-12-19 06:28:19,720 [creator.py:984 (verify_filesystem)] INFO: Verifying filesystem...
2023-12-19 06:28:19,722 [creator.py:368 (extract_iso)] INFO: Extracting live image to the target device...
2023-12-19 06:28:19,722 [creator.py:368 (extract_iso)] INFO: Extracting live image to the target device...
2023-12-19 06:29:24,370 [creator.py:375 (extract_iso)] INFO: Wrote to device at 19 MB/sec
2023-12-19 06:29:24,370 [creator.py:375 (extract_iso)] INFO: Wrote to device at 19 MB/sec
2023-12-19 06:29:24,370 [creator.py:1259 (read_extracted_mbr)] INFO: Reading extracted MBR from /media/amnesia/Tails/utils/mbr/mbr.bin
2023-12-19 06:29:24,370 [creator.py:1259 (read_extracted_mbr)] INFO: Reading extracted MBR from /media/amnesia/Tails/utils/mbr/mbr.bin
2023-12-19 06:29:24,371 [creator.py:1019 (install_bootloader)] INFO: Installing bootloader...
2023-12-19 06:29:24,371 [creator.py:1019 (install_bootloader)] INFO: Installing bootloader...
2023-12-19 06:29:24,375 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:29:24,375 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:29:24,508 [creator.py:772 (unmount_device)] INFO: Unmounting mounted filesystems on "/dev/sdc1"
2023-12-19 06:29:24,508 [creator.py:772 (unmount_device)] INFO: Unmounting mounted filesystems on "/dev/sdc1"
2023-12-19 06:29:25,537 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:29:25,537 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:29:25,754 [creator.py:1278 (reset_mbr)] INFO: Resetting Master Boot Record of /dev/sdc
2023-12-19 06:29:25,754 [creator.py:1278 (reset_mbr)] INFO: Resetting Master Boot Record of /dev/sdc
2023-12-19 06:29:25,771 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...
2023-12-19 06:29:25,771 [creator.py:1288 (flush_buffers)] INFO: Synchronizing data on disk...

Closes #19696 (closed)

Edited by Ben Westgate

Merge request reports