Skip to content

Commit

Permalink
rescue: Don't allow to mount systems without a root device
Browse files Browse the repository at this point in the history
If the rescue mode founds an operating system with /etc/fstab without the root
device (because it is, for example, commented out), it should ignore this system
instead of trying to mount it. If there are no Linux systems to mount, show the
"No Linux systems found" message instead of "You don't have any Linux partitions".

(cherry-picked from a commit c440e7c)

Related: RHEL-14696
  • Loading branch information
poncovka committed Jan 17, 2024
1 parent a8c654b commit a304062
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyanaconda/rescue.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,18 @@ def find_roots(self):
task_proxy = STORAGE.get_proxy(task_path)
sync_run_task(task_proxy)

# Collect existing systems.
roots = OSData.from_structure_list(
self._device_tree_proxy.GetExistingSystems()
)

# Ignore systems without a root device.
roots = [r for r in roots if r.get_root_device()]

if not roots:
self.status = RescueModeStatus.ROOT_NOT_FOUND

log.debug("These systems were found: %s", str(roots))
return roots

# TODO separate running post scripts?
Expand Down Expand Up @@ -451,7 +456,7 @@ def refresh(self, args=None):
finish_msg = exit_reboot_msg
else:
finish_msg = ""
text = TextWidget(_("You don't have any Linux partitions.\n") + finish_msg)
text = TextWidget(_("No Linux systems found.\n") + finish_msg)
else:
if self._rescue.reboot:
finish_msg = exit_reboot_msg
Expand Down

0 comments on commit a304062

Please sign in to comment.