Bug 1760760
| Summary: | RFE: Provide a way to amend the host_devs table transparently | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Renaud Métrich <rmetrich> |
| Component: | dracut | Assignee: | Lukáš Nykrýn <lnykryn> |
| Status: | CLOSED INSUFFICIENT_DATA | QA Contact: | qe-baseos-daemons |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 8.1 | CC: | dracut-maint-list, dtardon, jcall, scorreia |
| Target Milestone: | rc | Keywords: | FutureFeature |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-05-04 05:41:24 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Renaud Métrich
2019-10-11 09:23:38 UTC
The solution for Clevis may be to include all file systems found in /etc/fstab not having _netdev option or not known to be remote, but I don't know if this could impact other modules behaviour at all. The following code snippet automatically adds all local filesystems to "host_devs" array:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
--- /usr/bin/dracut.orig 2019-10-16 13:25:24.807000000 +0200
+++ /usr/bin/dracut 2019-10-16 13:59:35.012000000 +0200
@@ -245,6 +245,19 @@
EOF
}
+_network_filesystems=( "afs" "cifs" "smbfs" "sshfs" "ncpfs" "ncp" "nfs" "nfs4"
+ "gfs" "gfs2" "glusterfs" "pvfs2" "ovfs2" "lustre" )
+
+# Returns 0 is the filesystem is a known network filesystem
+is_network_filesystem() {
+ local fstype="${1##fuse.}"
+ if [[ " ${_network_filesystems[@]} " =~ " $fstype " ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
local _dev
@@ -1256,6 +1269,26 @@
_dev=$(expand_persistent_dev "$_d")
_dev="$(readlink -f "$_dev")"
[[ -b $_dev ]] || continue
+
+ push_host_devs "$_dev"
+ if [[ "$_t" == btrfs ]]; then
+ for i in $(btrfs_devs "$_m"); do
+ push_host_devs "$i"
+ done
+ fi
+ done < /etc/fstab
+ fi
+
+ # collect all non-network file systems entries from /etc/fstab
+ if [[ -f /etc/fstab ]]; then
+ while read _d _m _t _o _r || [ -n "$_d" ]; do
+ [[ "$_d" == \#* ]] && continue
+ [[ $_d ]] || continue
+ [[ "$_o" != *_netdev* ]] || continue
+ is_network_filesystem $_t && continue
+ _dev=$(expand_persistent_dev "$_d")
+ _dev="$(readlink -f "$_dev")"
+ [[ -b $_dev ]] || continue
push_host_devs "$_dev"
if [[ "$_t" == btrfs ]]; then
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
This introduces a new _network_filesystems array which contains a static list of known network filesystems, which of course must be kept in sync with systemd's list.
Of course, such code is suboptimal when *not* using Clevis, since this will integrate unlocking of the devices in the initramfs, even when a passphrase is used.
Still, it's better than mounting the file systems early.
I'm not sure I understand the problem... The host_devs variable is accessible to modules and they should be able to add more stuff to it in install(). The real work of setting up the devices to be waited for during boot happens in 99base:install(), which should run after install() of pretty much every other module... Or am I missing something? Hi David, Honestly this RFE is so old that I don't remember why I wanted this. I guess it is for clevis dracut module to automatically include all LUKS local file systems for decryption in the initramfs, in replacement to having to configure with x-initrd.mount. Let's close this for now until I have some time to experiment again to see what are the issues I wanted to solve. |