[mount][bootloader] Ensure root subvolume is set correctly for systemd-boot
This commit is contained in:
parent
ece1e338e0
commit
b0f6530a58
@ -178,10 +178,13 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker
|
|||||||
+ partition["luksMapperName"]]
|
+ partition["luksMapperName"]]
|
||||||
|
|
||||||
for partition in partitions:
|
for partition in partitions:
|
||||||
# systemd-boot with a BTRFS root filesystem needs to be told
|
# systemd-boot with a BTRFS root filesystem needs to be told abouut the root subvolume.
|
||||||
# about the root subvolume.
|
# If a btrfs root subvolume wasn't set, it means the root is directly on the partition
|
||||||
|
# and this option isn't needed
|
||||||
if is_btrfs_root(partition):
|
if is_btrfs_root(partition):
|
||||||
kernel_params.append("rootflags=subvol=@")
|
btrfs_root_subvolume = libcalamares.globalstorage.value("btrfsRootSubvolume")
|
||||||
|
if btrfs_root_subvolume:
|
||||||
|
kernel_params.append("rootflags=subvol=" + btrfs_root_subvolume)
|
||||||
|
|
||||||
# zfs needs to be told the location of the root dataset
|
# zfs needs to be told the location of the root dataset
|
||||||
if is_zfs_root(partition):
|
if is_zfs_root(partition):
|
||||||
|
@ -20,6 +20,7 @@ import os
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
_ = gettext.translation("calamares-python",
|
_ = gettext.translation("calamares-python",
|
||||||
localedir=libcalamares.utils.gettext_path(),
|
localedir=libcalamares.utils.gettext_path(),
|
||||||
languages=libcalamares.utils.gettext_languages(),
|
languages=libcalamares.utils.gettext_languages(),
|
||||||
@ -61,7 +62,8 @@ def get_btrfs_subvolumes(partitions):
|
|||||||
btrfs_subvolumes = [dict(mountPoint="/", subvolume="/@"), dict(mountPoint="/home", subvolume="/@home")]
|
btrfs_subvolumes = [dict(mountPoint="/", subvolume="/@"), dict(mountPoint="/home", subvolume="/@home")]
|
||||||
|
|
||||||
# Filter out the subvolumes which have a dedicated partition
|
# Filter out the subvolumes which have a dedicated partition
|
||||||
non_root_partition_mounts = [ m for m in [ p.get("mountPoint", None) for p in partitions ] if m is not None and m != '/' ]
|
non_root_partition_mounts = [m for m in [p.get("mountPoint", None) for p in partitions] if
|
||||||
|
m is not None and m != '/']
|
||||||
btrfs_subvolumes = list(filter(lambda s: s["mountPoint"] not in non_root_partition_mounts, btrfs_subvolumes))
|
btrfs_subvolumes = list(filter(lambda s: s["mountPoint"] not in non_root_partition_mounts, btrfs_subvolumes))
|
||||||
|
|
||||||
# If we have a swap **file**, give it a separate subvolume.
|
# If we have a swap **file**, give it a separate subvolume.
|
||||||
@ -189,9 +191,11 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
libcalamares.globalstorage.insert("btrfsSubvolumes", btrfs_subvolumes)
|
libcalamares.globalstorage.insert("btrfsSubvolumes", btrfs_subvolumes)
|
||||||
# Create the subvolumes that are in the completed list
|
# Create the subvolumes that are in the completed list
|
||||||
for s in btrfs_subvolumes:
|
for s in btrfs_subvolumes:
|
||||||
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
subprocess.check_call(["btrfs", "subvolume", "create",
|
||||||
root_mount_point + s['subvolume']])
|
root_mount_point + s["subvolume"]])
|
||||||
|
if s["mountPoint"] == "/":
|
||||||
|
# insert the root subvolume into global storage
|
||||||
|
libcalamares.globalstorage.insert("btrfsRootSubvolume", s["subvolume"])
|
||||||
subprocess.check_call(["umount", "-v", root_mount_point])
|
subprocess.check_call(["umount", "-v", root_mount_point])
|
||||||
|
|
||||||
device = partition["device"]
|
device = partition["device"]
|
||||||
|
Loading…
Reference in New Issue
Block a user