Add emerg-automount module for autodetecting and mounting a root device in emergency mode #694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dracut is currently only able to find and mount the root device if it is told exactly where to look. If something happens to the system that causes disk identification info to change (for instance cloning a partition and forgetting to change the root UUID specified on the kernel command line), it's possible for dracut to be unable to locate the root filesystem. In this instance the user is dropped unceremoniously into an emergency shell, where they are left to "figure out" how to mount the root filesystem on their own. Depending on the skill level of the user, this may be impossible.
This pull request makes it much easier for a new user to get their system to boot after being dropped into an emergency shell. It adds a new dracut module,
95emerg-automount
, that automates the process of finding and mounting a root filesystem "in the dark" (i.e. without prior info about which filesystem to mount or where it is located). Roughly speaking, the algorithm used is:/sysroot
and instruct the user to exit the emergency shell.This script is NOT run automatically when the emergency shell is entered, as mounting arbitrary partitions comes with security risks and just blindly mounting everything to check it was not considered an acceptable solution. Instead, a small emergency hook is added that informs the user they can try to automount the root partition if they want to by running
automount.sh
. If they don't want to, they don't have to.In the event a user has multiple operating systems installed on the same system, it can be difficult to determine which one is the correct one to boot. In order to make things easier, the module's installation routine copies
/etc/os-release
from the root filesystem into the initramfs. This allows the automounter to determine which OS release the user is trying to boot. The automounter can then compare this OS release info with the OS release info from each partition it scans for usability. If it finds a match, it knows the user probably wants to boot that OS, in which case it will show that partition to the user with a "this is probably what you want to boot" message, and will automatically attempt to boot it if the user doesn't choose the OS to boot (i.e. they just hit Enter when asked what to do).TODOs
/etc/os-release
file thatmodule-setup.sh
gets to see. Probably using rather than a Dracut install command will fix this.Changes
95emerg-automount
, with the features listed above.Checklist
Fixes dracutdevs/dracut#2589.