Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build-tests/x86/fedora/test-image-live-disk/appliance.kiwi
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
</type>
</preferences>
<preferences profiles="Virtual">
<type image="oem" filesystem="btrfs" kernelcmdline="console=ttyS0" firmware="uefi" format="qcow2" btrfs_root_is_subvolume="true" btrfs_set_default_volume="false" rootfs_label="fedora" bootpartition="true" bootfilesystem="ext4">
<type image="oem" filesystem="btrfs" kernelcmdline="console=ttyS0" firmware="uefi" format="qcow2" btrfs_root_is_subvolume="true" btrfs_set_default_volume="false" rootfs_label="fedora" bootpartition="false">
<systemdisk name="fedora">
<volume name="@root=root"/>
<volume name="boot" parent="/"/>
<volume name="home" parent="/"/>
<volume name="var" parent="/"/>
</systemdisk>
Expand Down
30 changes: 7 additions & 23 deletions kiwi/bootloader/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,6 @@ def get_boot_path(self, target='disk'):
# according to the mount path.
bootpath = '/'

if target == 'disk':
if not need_boot_partition:
filesystem = self.xml_state.build_type.get_filesystem()
volumes = self.xml_state.get_volumes()
if filesystem == 'btrfs' and volumes:
# grub boot data paths must not be in a subvolume
# otherwise grub won't be able to find its config file
grub2_boot_data_paths = ['boot', 'boot/grub', 'boot/grub2']
for volume in volumes:
if volume.name in grub2_boot_data_paths:
raise KiwiBootLoaderTargetError(
'{0} must not be a subvolume'.format(
volume.name
)
)

if target == 'iso':
bootpath = '/boot/' + self.arch + '/loader'

Expand Down Expand Up @@ -541,9 +525,6 @@ def _mount_system(
if not self.root_mount.device == self.boot_mount.device:
self.boot_mount.mount()

if efi_device:
self.efi_mount.mount()

if volumes:
for volume_path in Path.sort_by_hierarchy(
sorted(volumes.keys())
Expand All @@ -557,6 +538,9 @@ def _mount_system(
options=[volumes[volume_path]['volume_options']]
)

if efi_device:
self.efi_mount.mount()

if self.root_filesystem_is_overlay:
# In case of an overlay root system all parts of the rootfs
# are read-only. However tools like grub's mkconfig creates
Expand Down Expand Up @@ -600,6 +584,10 @@ def _umount_system(self):
setup = SystemSetup(self.xml_state, self.root_mount.mountpoint)
setup.setup_selinux_file_contexts()
# Umount system
if self.efi_mount:
self.efi_mount.umount()
if self.boot_mount:
self.boot_mount.umount()
for volume_mount in reversed(self.volumes_mount):
volume_mount.umount()
if self.device_mount:
Expand All @@ -608,14 +596,10 @@ def _umount_system(self):
self.proc_mount.umount()
if self.sys_mount:
self.sys_mount.umount()
if self.efi_mount:
self.efi_mount.umount()
if self.tmp_mount:
self.tmp_mount.umount()
if self.etc_kernel_mount:
self.etc_kernel_mount.umount()
if self.boot_mount:
self.boot_mount.umount()
if self.root_mount:
self.root_mount.umount()
self.system_is_mounted = False
Expand Down
18 changes: 0 additions & 18 deletions test/unit/bootloader/config/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,24 +247,6 @@ def test_get_boot_path_raises(self):
with raises(KiwiBootLoaderTargetError):
self.bootloader.get_boot_path('foo')

@patch('kiwi.bootloader.config.base.DiskSetup')
@patch('kiwi.xml_parse.type_.get_filesystem')
@patch('kiwi.xml_state.XMLState.get_volumes')
def test_get_boot_path_btrfs_boot_is_a_volume_error(
self, mock_volumes, mock_fs, mock_disk_setup
):
volume = Mock()
volume.name = 'boot'
mock_volumes.return_value = [volume]
mock_fs.return_value = 'btrfs'
disk_setup = Mock()
disk_setup.need_boot_partition = Mock(
return_value=False
)
mock_disk_setup.return_value = disk_setup
with raises(KiwiBootLoaderTargetError):
self.bootloader.get_boot_path()

@patch('kiwi.bootloader.config.base.DiskSetup')
@patch('kiwi.xml_parse.type_.get_filesystem')
@patch('kiwi.xml_parse.type_.get_btrfs_root_is_snapper_snapshot')
Expand Down