From 90db0c79afa3c0fa8f67896a17ddbf6fa14fef32 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 10:03:35 +0200 Subject: [PATCH 01/64] Remove /boot/grub2/x86_64-efi and @/boot/grub2/i386-pc for BLS systems --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 8848fa78f..0298299b3 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -42,6 +42,14 @@ def efi_volume end @efi_volume end + + # @return [VolumeSpecification] + def boot_volume + super + log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" + @boot_volume + end + end end end From aef99bba63ffa901f81b7914339a8667dc904eb8 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 10:47:45 +0200 Subject: [PATCH 02/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 0298299b3..b02eb5bb9 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -40,6 +40,7 @@ def efi_volume @efi_volume.desired_size = DiskSize.GiB(1) @efi_volume.max_size = DiskSize.GiB(1) end + log.info "xxxxxxxxxxx evi_volume disk: #{@evi_volume.inspect}" @efi_volume end From 376605ef85e63948786ae52d1c67635cfc7572ec Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 11:38:04 +0200 Subject: [PATCH 03/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index b02eb5bb9..087e5a9dd 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -45,11 +45,11 @@ def efi_volume end # @return [VolumeSpecification] - def boot_volume - super - log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" - @boot_volume - end +# def boot_volume +# super +# log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" +# @boot_volume +# end end end From a7ed9c807c49b484fe4845aa7f4fad7296375d14 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 11:55:45 +0200 Subject: [PATCH 04/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 087e5a9dd..b02eb5bb9 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -45,11 +45,11 @@ def efi_volume end # @return [VolumeSpecification] -# def boot_volume -# super -# log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" -# @boot_volume -# end + def boot_volume + super + log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" + @boot_volume + end end end From 715f4b15d0f85bd08ed7440eb022bad7a9466886 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 12:39:43 +0200 Subject: [PATCH 05/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index b02eb5bb9..087e5a9dd 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -45,11 +45,11 @@ def efi_volume end # @return [VolumeSpecification] - def boot_volume - super - log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" - @boot_volume - end +# def boot_volume +# super +# log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" +# @boot_volume +# end end end From e3f5125f77667a02f2c8ffadbe0892d551d374b3 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 8 Jul 2025 13:50:27 +0200 Subject: [PATCH 06/64] test --- .../y2storage/boot_requirements_strategies/bls.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 087e5a9dd..d3f3c7f28 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -40,17 +40,18 @@ def efi_volume @efi_volume.desired_size = DiskSize.GiB(1) @efi_volume.max_size = DiskSize.GiB(1) end - log.info "xxxxxxxxxxx evi_volume disk: #{@evi_volume.inspect}" + log.info "xxxxxxxxxxx efi_volume disk: #{@efi_volume.inspect}" @efi_volume end # @return [VolumeSpecification] -# def boot_volume -# super -# log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" -# @boot_volume -# end - + def boot_volume + if @boot_volume.nil? + @boot_volume = volume_specification_for("/boot") + end + log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" + @boot_volume + end end end end From de208fc08bedd25a5b30ed6c666976b55e9ab56f Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 9 Jul 2025 14:29:58 +0200 Subject: [PATCH 07/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index d3f3c7f28..08688ce44 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -28,6 +28,13 @@ def initialize(*args) super end + # @see Base#needed_partitions + def needed_partitions(target) + planned_partitions = super + log.info "xxxxxxxxxxx planned_partitions: #{planned_partitions.inspect}" + planned_partitions + end + protected # @return [VolumeSpecification] From 031ea24a1889f1b5e66eba7be57f92749d08f2cb Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 14 Jul 2025 15:14:05 +0200 Subject: [PATCH 08/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 08688ce44..9fb45e946 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -31,7 +31,7 @@ def initialize(*args) # @see Base#needed_partitions def needed_partitions(target) planned_partitions = super - log.info "xxxxxxxxxxx planned_partitions: #{planned_partitions.inspect}" + log.info "xxxxxxxxxxx needed_partitions: #{planned_partitions.inspect}" planned_partitions end From 8436432e6f3969ad9e6be617946bb458a4b48107 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 14 Jul 2025 16:59:30 +0200 Subject: [PATCH 09/64] test --- .../boot_requirements_strategies/bls.rb | 24 +++++++++---------- src/lib/y2storage/subvol_specification.rb | 5 +++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 9fb45e946..26627b2d4 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -29,11 +29,11 @@ def initialize(*args) end # @see Base#needed_partitions - def needed_partitions(target) - planned_partitions = super - log.info "xxxxxxxxxxx needed_partitions: #{planned_partitions.inspect}" - planned_partitions - end + #def needed_partitions(target) + # planned_partitions = super + # log.info "xxxxxxxxxxx needed_partitions: #{planned_partitions.inspect}" + # planned_partitions + #end protected @@ -52,13 +52,13 @@ def efi_volume end # @return [VolumeSpecification] - def boot_volume - if @boot_volume.nil? - @boot_volume = volume_specification_for("/boot") - end - log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" - @boot_volume - end + #def boot_volume + # if @boot_volume.nil? + # @boot_volume = volume_specification_for("/boot") + # end + # log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" + # @boot_volume + #end end end end diff --git a/src/lib/y2storage/subvol_specification.rb b/src/lib/y2storage/subvol_specification.rb index 39a83ecb2..c6e931f0c 100644 --- a/src/lib/y2storage/subvol_specification.rb +++ b/src/lib/y2storage/subvol_specification.rb @@ -244,7 +244,10 @@ def self.fallback_list subvols.concat( NO_COW_SUBVOL_PATHS.map { |path| SubvolSpecification.new(path, copy_on_write: false) } ) - subvols.each { |subvol| subvol.archs = SUBVOL_ARCHS[subvol.path] } + subvols.each do |subvol| + log.info("xxxxxxxxxxxxxx #{subvol}") + subvol.archs = SUBVOL_ARCHS[subvol.path] + end subvols.sort! end From 23b3107e0e647cdbeaf4662b1167c56ffcbad7db Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 10:03:06 +0200 Subject: [PATCH 10/64] test --- .../boot_requirements_strategies/bls.rb | 16 ---------------- src/lib/y2storage/subvol_specification.rb | 10 ++++------ src/lib/y2storage/volume_specification.rb | 8 ++++++++ 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 26627b2d4..caeed4e0e 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -28,13 +28,6 @@ def initialize(*args) super end - # @see Base#needed_partitions - #def needed_partitions(target) - # planned_partitions = super - # log.info "xxxxxxxxxxx needed_partitions: #{planned_partitions.inspect}" - # planned_partitions - #end - protected # @return [VolumeSpecification] @@ -47,18 +40,9 @@ def efi_volume @efi_volume.desired_size = DiskSize.GiB(1) @efi_volume.max_size = DiskSize.GiB(1) end - log.info "xxxxxxxxxxx efi_volume disk: #{@efi_volume.inspect}" @efi_volume end - # @return [VolumeSpecification] - #def boot_volume - # if @boot_volume.nil? - # @boot_volume = volume_specification_for("/boot") - # end - # log.info "xxxxxxxxxxx boot_volume disk: #{@boot_volume.inspect}" - # @boot_volume - #end end end end diff --git a/src/lib/y2storage/subvol_specification.rb b/src/lib/y2storage/subvol_specification.rb index c6e931f0c..b12176386 100644 --- a/src/lib/y2storage/subvol_specification.rb +++ b/src/lib/y2storage/subvol_specification.rb @@ -64,8 +64,8 @@ class SubvolSpecification "var/lib/pgsql" ] - # Subvolumes, from the lists above, that contain architecture modifiers - SUBVOL_ARCHS = { + # Grub2 subvolumes, from the lists above, that contain architecture modifiers + SUBVOL_GRUB2_ARCHS = { "boot/grub2/i386-pc" => ["i386", "x86_64"], "boot/grub2/x86_64-efi" => ["x86_64"], "boot/grub2/powerpc-ieee1275" => ["ppc", "!board_powernv"], @@ -244,10 +244,8 @@ def self.fallback_list subvols.concat( NO_COW_SUBVOL_PATHS.map { |path| SubvolSpecification.new(path, copy_on_write: false) } ) - subvols.each do |subvol| - log.info("xxxxxxxxxxxxxx #{subvol}") - subvol.archs = SUBVOL_ARCHS[subvol.path] - end + + subvols.each { |subvol| subvol.archs = SUBVOL_GRUB2_ARCHS[subvol.path] } subvols.sort! end diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index ae3ceca1c..22337b05d 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -222,6 +222,7 @@ def clear_cache def initialize(volume_features) apply_defaults load_features(volume_features) +print("xxxxxxxxxxxxxx #{volume_features}") adjust_features end @@ -408,6 +409,13 @@ def load_features(volume_features) # the architecture does not support to resume from swap (i.e., for s390). def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? + + print("xxxxxxxxxxxxxx22 #{@subvolumes}") + +# if Y2Storage::Arch.new.efiboot? && +# subvols.each { |subvol| subvol.archs = SUBVOL_GRUB2_ARCHS[subvol.path] } +# +# end end def validated_fs_type(type) From bea409e23dffe25e1d7e7c7793c5de811e33d113 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 11:03:23 +0200 Subject: [PATCH 11/64] test --- src/lib/y2storage/volume_specification.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 22337b05d..eab85d2b3 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -23,6 +23,7 @@ require "y2storage/equal_by_instance_variables" Yast.import "Kernel" +Yast.import "ProductFeatures" module Y2Storage # Helper class to represent a volume specification as defined in control.xml @@ -222,7 +223,7 @@ def clear_cache def initialize(volume_features) apply_defaults load_features(volume_features) -print("xxxxxxxxxxxxxx #{volume_features}") + log.info("xxxxxxxxxxxxxx #{volume_features}") adjust_features end @@ -410,12 +411,16 @@ def load_features(volume_features) def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? - print("xxxxxxxxxxxxxx22 #{@subvolumes}") - -# if Y2Storage::Arch.new.efiboot? && -# subvols.each { |subvol| subvol.archs = SUBVOL_GRUB2_ARCHS[subvol.path] } -# -# end + log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") + preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", + "preferred_bootloader") + if Y2Storage::Arch.new.efiboot? && preferred_bootloader != "grub2" + # Removing grub2 specific subvolumes because they are not needed. + # It is only needed for none efi system, or grub2 has been set in the control.xml file + log.info "Removing grub2 specific subvolumes /boot/grub2/*" + @subvolumes.delete_if { |subvol| SUBVOL_GRUB2_ARCHS.key?(subvol.path) } + end + log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") end def validated_fs_type(type) From ffe1e55502fe8edb6f47ea867f9caf7337f87e80 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 11:14:19 +0200 Subject: [PATCH 12/64] test --- src/lib/y2storage/volume_specification.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index eab85d2b3..4e947baad 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -30,6 +30,7 @@ module Y2Storage class VolumeSpecification include PartitioningFeatures include EqualByInstanceVariables + include Yast::Logger # @return [PartitionId] when the volume needs to be a partition with a specific id attr_accessor :partition_id @@ -418,7 +419,7 @@ def adjust_features # Removing grub2 specific subvolumes because they are not needed. # It is only needed for none efi system, or grub2 has been set in the control.xml file log.info "Removing grub2 specific subvolumes /boot/grub2/*" - @subvolumes.delete_if { |subvol| SUBVOL_GRUB2_ARCHS.key?(subvol.path) } + @subvolumes.delete_if { |subvol| SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) } end log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") end From 29ff5ceebde9251a6c296ec09bf34f1b53a1e944 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 11:40:33 +0200 Subject: [PATCH 13/64] test --- src/lib/y2storage/volume_specification.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 4e947baad..73c823309 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -30,7 +30,7 @@ module Y2Storage class VolumeSpecification include PartitioningFeatures include EqualByInstanceVariables - include Yast::Logger + include Yast::Logger # @return [PartitionId] when the volume needs to be a partition with a specific id attr_accessor :partition_id @@ -418,8 +418,14 @@ def adjust_features if Y2Storage::Arch.new.efiboot? && preferred_bootloader != "grub2" # Removing grub2 specific subvolumes because they are not needed. # It is only needed for none efi system, or grub2 has been set in the control.xml file - log.info "Removing grub2 specific subvolumes /boot/grub2/*" - @subvolumes.delete_if { |subvol| SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) } + @subvolumes.delete_if do |subvol| + if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) + log.info "Removing not needed grub2 specific subvolumes #{subvol.path}" + true + else + false + end + end end log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") end From fc29554db3f9707b7fed0e6da66476d75a710a21 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 11:47:07 +0200 Subject: [PATCH 14/64] test --- src/lib/y2storage/volume_specification.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 73c823309..68e061e40 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -412,12 +412,11 @@ def load_features(volume_features) def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? - log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", "preferred_bootloader") if Y2Storage::Arch.new.efiboot? && preferred_bootloader != "grub2" # Removing grub2 specific subvolumes because they are not needed. - # It is only needed for none efi system, or grub2 has been set in the control.xml file + # It is only needed for none efi system, or grub2 has been set in the control.xml file. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) log.info "Removing not needed grub2 specific subvolumes #{subvol.path}" @@ -427,7 +426,6 @@ def adjust_features end end end - log.info("xxxxxxxxxxxxxx22 #{@subvolumes}") end def validated_fs_type(type) From 007570b820a5c1fb02d97e3f7d0213ee42d7668e Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 11:47:43 +0200 Subject: [PATCH 15/64] test --- src/lib/y2storage/volume_specification.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 68e061e40..dabfdc40b 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -224,7 +224,6 @@ def clear_cache def initialize(volume_features) apply_defaults load_features(volume_features) - log.info("xxxxxxxxxxxxxx #{volume_features}") adjust_features end From 31d3ced47c1362de452e19b6b45cf2fc08ca3126 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 15 Jul 2025 14:09:35 +0200 Subject: [PATCH 16/64] test --- src/lib/y2storage/volume_specification.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index dabfdc40b..e1eb506fe 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -24,6 +24,7 @@ Yast.import "Kernel" Yast.import "ProductFeatures" +Yast.import "Arch" module Y2Storage # Helper class to represent a volume specification as defined in control.xml @@ -408,17 +409,22 @@ def load_features(volume_features) # # For example, {#adjust_by_ram} should be set to `false` by default for the swap partition when # the architecture does not support to resume from swap (i.e., for s390). + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", "preferred_bootloader") - if Y2Storage::Arch.new.efiboot? && preferred_bootloader != "grub2" + if Y2Storage::Arch.new.efiboot? && + (Yast::Arch.x86_64 || Yast::Arch.aarch64) && + !StorageEnv.instance.no_bls_bootloader && + ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) # Removing grub2 specific subvolumes because they are not needed. - # It is only needed for none efi system, or grub2 has been set in the control.xml file. + # It is only needed for none efi system, or grub2/grub2-efi has been set in the control.xml file. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) - log.info "Removing not needed grub2 specific subvolumes #{subvol.path}" + log.info "Removing grub2 specific subvolumes #{subvol.path} " \ + "because a BLS bootloader is default." true else false @@ -426,6 +432,7 @@ def adjust_features end end end + # rubocop:enable all def validated_fs_type(type) raise(ArgumentError, "Filesystem cannot be nil") unless type From 8fc1b607e809d5ff044e7036c9134984e53aa0af Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 16 Jul 2025 13:19:47 +0200 Subject: [PATCH 17/64] cleanup --- .../boot_requirements_strategies/bls.rb | 13 +++++++- src/lib/y2storage/volume_specification.rb | 30 +++++++------------ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index caeed4e0e..49a35c2d5 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -19,6 +19,9 @@ require "y2storage/boot_requirements_strategies/uefi" +Yast.import "ProductFeatures" +Yast.import "Arch" + module Y2Storage module BootRequirementsStrategies # Strategy to calculate boot requirements in BLS/UEFI systems @@ -28,6 +31,15 @@ def initialize(*args) super end + def self.bls_bootloader_proposed? + preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", + "preferred_bootloader") + Y2Storage::Arch.new.efiboot? && + (Yast::Arch.x86_64 || Yast::Arch.aarch64) && + !StorageEnv.instance.no_bls_bootloader && + ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) + end + protected # @return [VolumeSpecification] @@ -42,7 +54,6 @@ def efi_volume end @efi_volume end - end end end diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index e1eb506fe..9743940ba 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -21,10 +21,9 @@ require "y2storage/partitioning_features" require "y2storage/subvol_specification" require "y2storage/equal_by_instance_variables" +require "y2storage/boot_requirements_strategies/bls" Yast.import "Kernel" -Yast.import "ProductFeatures" -Yast.import "Arch" module Y2Storage # Helper class to represent a volume specification as defined in control.xml @@ -409,30 +408,21 @@ def load_features(volume_features) # # For example, {#adjust_by_ram} should be set to `false` by default for the swap partition when # the architecture does not support to resume from swap (i.e., for s390). - # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? - preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", - "preferred_bootloader") - if Y2Storage::Arch.new.efiboot? && - (Yast::Arch.x86_64 || Yast::Arch.aarch64) && - !StorageEnv.instance.no_bls_bootloader && - ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) - # Removing grub2 specific subvolumes because they are not needed. - # It is only needed for none efi system, or grub2/grub2-efi has been set in the control.xml file. - @subvolumes.delete_if do |subvol| - if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) - log.info "Removing grub2 specific subvolumes #{subvol.path} " \ - "because a BLS bootloader is default." - true - else - false - end + return unless BLS.bls_bootloader_proposed? + # Removing grub2/grub2-efi specific subvolumes because they are not needed. + @subvolumes.delete_if do |subvol| + if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) + log.info "Removing grub2/grub2-efi specific subvolumes #{subvol.path} " \ + "because a BLS bootloader is default." + true + else + false end end end - # rubocop:enable all def validated_fs_type(type) raise(ArgumentError, "Filesystem cannot be nil") unless type From 7b1f486c5d89ea6bdc51a4a816fdea2f570fed6e Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 16 Jul 2025 14:12:21 +0200 Subject: [PATCH 18/64] cleanup --- src/lib/y2storage/volume_specification.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 9743940ba..a49e8ca12 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -411,7 +411,7 @@ def load_features(volume_features) def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? - return unless BLS.bls_bootloader_proposed? + return unless Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? # Removing grub2/grub2-efi specific subvolumes because they are not needed. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) From 902e8f94e747201b5fcdf606bc7805fa8f281120 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 16 Jul 2025 15:01:28 +0200 Subject: [PATCH 19/64] cleanup --- src/lib/y2storage/boot_requirements_strategies/base.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/base.rb b/src/lib/y2storage/boot_requirements_strategies/base.rb index 95fb90b51..df02ad71b 100644 --- a/src/lib/y2storage/boot_requirements_strategies/base.rb +++ b/src/lib/y2storage/boot_requirements_strategies/base.rb @@ -23,6 +23,7 @@ require "y2storage/filesystems/type" require "y2storage/planned" require "y2storage/boot_requirements_strategies/analyzer" +require "y2storage/boot_requirements_strategies/bls" require "y2storage/exceptions" require "y2storage/volume_specification" require "y2storage/setup_error" @@ -84,7 +85,8 @@ def needed_partitions(target) def warnings res = [] - if !boot_readable_by_grub? + if !boot_readable_by_grub? && + !Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? error_message = _( "The grub boot loader cannot access the file system mounted at /boot. " \ From e900841b9ef88f752608c64203e7168cdda8805c Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 16 Jul 2025 16:46:13 +0200 Subject: [PATCH 20/64] rubocop --- src/lib/y2storage/volume_specification.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index a49e8ca12..2aff1d0ca 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -412,6 +412,7 @@ def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? return unless Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? + # Removing grub2/grub2-efi specific subvolumes because they are not needed. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) From 0c44f9ad5c60f844aa961be2ccc1019ab55b9f0b Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 08:42:33 +0200 Subject: [PATCH 21/64] packaging --- package/yast2-storage-ng.changes | 6 ++++++ package/yast2-storage-ng.spec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package/yast2-storage-ng.changes b/package/yast2-storage-ng.changes index 489496e1d..fa06f9577 100644 --- a/package/yast2-storage-ng.changes +++ b/package/yast2-storage-ng.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 17 06:39:11 UTC 2025 - Stefan Schubert + +- Fixed grub2 error messages and proposals. (bsc#1244755) +- 5.0.34 + ------------------------------------------------------------------- Wed Jul 16 13:00:00 UTC 2025 - José Iván López González diff --git a/package/yast2-storage-ng.spec b/package/yast2-storage-ng.spec index 9136c9044..4943c2d6b 100644 --- a/package/yast2-storage-ng.spec +++ b/package/yast2-storage-ng.spec @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 5.0.33 +Version: 5.0.34 Release: 0 Summary: YaST2 - Storage Configuration License: GPL-2.0-only OR GPL-3.0-only From 9e51afa92b5403442053088efb0a4af90f37db1b Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 13:58:48 +0200 Subject: [PATCH 22/64] fixed testcase --- test/y2storage/proposal_swap_reuse_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/y2storage/proposal_swap_reuse_test.rb b/test/y2storage/proposal_swap_reuse_test.rb index ac830a0a7..57e9b7be5 100755 --- a/test/y2storage/proposal_swap_reuse_test.rb +++ b/test/y2storage/proposal_swap_reuse_test.rb @@ -28,6 +28,10 @@ describe "#propose in a system with pre-existing swap partitions" do subject(:proposal) { described_class.new(settings: settings) } + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + include_context "proposal" let(:architecture) { :x86 } let(:settings_format) { :ng } From 772c9a2b5740d59e99c58a5d1f0afd0c71c58461 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 14:14:40 +0200 Subject: [PATCH 23/64] fixed testsuite --- test/y2storage/boot_requirements_checker_raspi_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/y2storage/boot_requirements_checker_raspi_test.rb b/test/y2storage/boot_requirements_checker_raspi_test.rb index 2fcb77823..50b840343 100755 --- a/test/y2storage/boot_requirements_checker_raspi_test.rb +++ b/test/y2storage/boot_requirements_checker_raspi_test.rb @@ -25,6 +25,10 @@ describe Y2Storage::BootRequirementsChecker do describe "#needed_partitions in a Raspberry Pi" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + using Y2Storage::Refinements::SizeCasts include_context "boot requirements" From 3d084d55227d0891ccbd1cb55753493d8d015e14 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 17:14:16 +0200 Subject: [PATCH 24/64] tests --- .../boot_requirements_strategies/bls_test.rb | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 test/y2storage/boot_requirements_strategies/bls_test.rb diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb new file mode 100644 index 000000000..636d08b60 --- /dev/null +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -0,0 +1,113 @@ +# Copyright (c) [2025] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative "../spec_helper" +require "y2storage" + +describe Y2Storage::BootRequirementsStrategies::BLS do + subject { described_class } + + describe ".bls_bootloader_proposed?" do + describe "checking suggested bootloader" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:x86_64).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + end + + context "when a none bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-efi") + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when a bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking architecture" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-bls") + end + + context "when architectue is not x86_64/aarch64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(false) + allow(Yast::Arch).to receive(:aarch64).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when architectue is x86_64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(false) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + + context "when not EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + end +end From 01eff17f3cbcf522e32b614b76c527c8382a4014 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 17:19:09 +0200 Subject: [PATCH 25/64] tests --- .../boot_requirements_strategies/bls_test.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb index 636d08b60..afa203f52 100644 --- a/test/y2storage/boot_requirements_strategies/bls_test.rb +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -58,13 +58,13 @@ allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("grub2-bls") + "preferred_bootloader").and_return("grub2-bls") end context "when architectue is not x86_64/aarch64" do before do allow(Yast::Arch).to receive(:x86_64).and_return(false) - allow(Yast::Arch).to receive(:aarch64).and_return(false) + allow(Yast::Arch).to receive(:aarch64).and_return(false) end it "returns false" do expect(subject.bls_bootloader_proposed?).to eq false @@ -73,7 +73,7 @@ context "when architectue is x86_64" do before do - allow(Yast::Arch).to receive(:x86_64).and_return(false) + allow(Yast::Arch).to receive(:x86_64).and_return(false) end it "returns true" do expect(subject.bls_bootloader_proposed?).to eq true @@ -87,12 +87,12 @@ allow(Yast::Arch).to receive(:aarch64).and_return(true) allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("systemd-boot") + "preferred_bootloader").and_return("systemd-boot") end context "when not EFI system" do before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) end it "returns false" do expect(subject.bls_bootloader_proposed?).to eq false @@ -101,13 +101,12 @@ context "when EFI system" do before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) end it "returns true" do expect(subject.bls_bootloader_proposed?).to eq true end end end - end end From 690f3e8e8f9a91d6aa1af88211b6bc0e33a580e0 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 17 Jul 2025 17:23:32 +0200 Subject: [PATCH 26/64] tests --- test/y2storage/boot_requirements_strategies/bls_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb index afa203f52..3adea7358 100644 --- a/test/y2storage/boot_requirements_strategies/bls_test.rb +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -73,7 +73,7 @@ context "when architectue is x86_64" do before do - allow(Yast::Arch).to receive(:x86_64).and_return(false) + allow(Yast::Arch).to receive(:x86_64).and_return(true) end it "returns true" do expect(subject.bls_bootloader_proposed?).to eq true From 6557862c754d4d31691b0bcedea7960339b082b5 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 18 Jul 2025 08:55:10 +0200 Subject: [PATCH 27/64] adapted changes --- package/yast2-storage-ng.changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/yast2-storage-ng.changes b/package/yast2-storage-ng.changes index fa06f9577..04fec878d 100644 --- a/package/yast2-storage-ng.changes +++ b/package/yast2-storage-ng.changes @@ -1,7 +1,9 @@ ------------------------------------------------------------------- Thu Jul 17 06:39:11 UTC 2025 - Stefan Schubert -- Fixed grub2 error messages and proposals. (bsc#1244755) +- Do not generate grub2 error messages and proposals if a BLS + bootlaoder (systemd-boot/grub2-bls) bootloader is the preferred + bootloader (bsc#1244755). - 5.0.34 ------------------------------------------------------------------- From 703b0e8958821024ee8d50d91a6fd0e9b33af966 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 21 Jul 2025 16:11:43 +0200 Subject: [PATCH 28/64] test --- .../boot_requirements_strategies/bls.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 49a35c2d5..39f9714c3 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -40,17 +40,26 @@ def self.bls_bootloader_proposed? ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) end + # No extra /boot partition which is needed by grub2 only + def needed_partitions(target) + planned_partitions = [] + planned_partitions << efi_partition(target) if efi_missing? + planned_partitions + end + protected # @return [VolumeSpecification] def efi_volume if @efi_volume.nil? @efi_volume = volume_specification_for("/boot/efi") - # BLS suggests 1GiB for boot partition - # https://uapi-group.org/specifications/specs/boot_loader_specification/ - @efi_volume.min_size = DiskSize.MiB(512) - @efi_volume.desired_size = DiskSize.GiB(1) - @efi_volume.max_size = DiskSize.GiB(1) + if preferred_bootloader == "grub2-bls" + # BLS suggests 1GiB for boot partition + # https://uapi-group.org/specifications/specs/boot_loader_specification/ + @efi_volume.min_size = DiskSize.MiB(512) + @efi_volume.desired_size = DiskSize.GiB(1) + @efi_volume.max_size = DiskSize.GiB(1) + end end @efi_volume end From 0128ce8ddccffc0cf665d0429ce1480e5ca8e10e Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 21 Jul 2025 16:25:34 +0200 Subject: [PATCH 29/64] test --- src/lib/y2storage/boot_requirements_strategies/bls.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 39f9714c3..f2dead543 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -53,7 +53,7 @@ def needed_partitions(target) def efi_volume if @efi_volume.nil? @efi_volume = volume_specification_for("/boot/efi") - if preferred_bootloader == "grub2-bls" + if Yast::ProductFeatures.GetStringFeature("globals", "preferred_bootloader") == "grub2-bls" # BLS suggests 1GiB for boot partition # https://uapi-group.org/specifications/specs/boot_loader_specification/ @efi_volume.min_size = DiskSize.MiB(512) From 81ce455caf536e077b0e6b341c2ae847e590ddd3 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 21 Jul 2025 16:57:03 +0200 Subject: [PATCH 30/64] cleanup --- .../y2storage/boot_requirements_strategies/bls.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index f2dead543..6c4ef8585 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -53,13 +53,11 @@ def needed_partitions(target) def efi_volume if @efi_volume.nil? @efi_volume = volume_specification_for("/boot/efi") - if Yast::ProductFeatures.GetStringFeature("globals", "preferred_bootloader") == "grub2-bls" - # BLS suggests 1GiB for boot partition - # https://uapi-group.org/specifications/specs/boot_loader_specification/ - @efi_volume.min_size = DiskSize.MiB(512) - @efi_volume.desired_size = DiskSize.GiB(1) - @efi_volume.max_size = DiskSize.GiB(1) - end + # BLS suggests 1GiB for boot partition + # https://uapi-group.org/specifications/specs/boot_loader_specification/ + @efi_volume.min_size = DiskSize.MiB(512) + @efi_volume.desired_size = DiskSize.GiB(1) + @efi_volume.max_size = DiskSize.GiB(1) end @efi_volume end From b06ba1885ef55ced5ee27c2b1e1ba14e9e871684 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 12:30:12 +0200 Subject: [PATCH 31/64] unify BLS --- src/lib/y2storage/boot_requirements_checker.rb | 9 ++++----- test/support/boot_requirements_uefi.rb | 8 +++++--- test/y2storage/boot_requirements_checker_aarch64_test.rb | 7 ++++--- test/y2storage/boot_requirements_checker_x86_test.rb | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_checker.rb b/src/lib/y2storage/boot_requirements_checker.rb index afc99f9e2..21089d44b 100644 --- a/src/lib/y2storage/boot_requirements_checker.rb +++ b/src/lib/y2storage/boot_requirements_checker.rb @@ -19,6 +19,7 @@ require "yast" require "y2storage/boot_requirements_strategies" +require "y2storage/boot_requirements_strategies/bls" require "y2storage/storage_manager" require "y2storage/storage_env" @@ -140,12 +141,10 @@ def strategy_class # @return [BootRequirementsStrategies::Base] def arch_strategy_class if arch.efiboot? - if StorageEnv.instance.no_bls_bootloader || - (!arch.x86? && !Yast::Arch.aarch64) - BootRequirementsStrategies::UEFI - else - # BLS is for x86_64 and aarch64 only + if Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? BootRequirementsStrategies::BLS + else + BootRequirementsStrategies::UEFI end elsif arch.s390? BootRequirementsStrategies::ZIPL diff --git a/test/support/boot_requirements_uefi.rb b/test/support/boot_requirements_uefi.rb index 7c2278541..365b2018c 100755 --- a/test/support/boot_requirements_uefi.rb +++ b/test/support/boot_requirements_uefi.rb @@ -134,10 +134,12 @@ end end -RSpec.shared_context "BLS bootloader not disabled" do - context "and BLS installation is not explicitly disabled" do +RSpec.shared_context "BLS bootloader proposed" do + context "and BLS bootloader is proposed and possible" do before do - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Y2Storage::BootRequirementsStrategies::BLS).to receive( + :bls_bootloader_proposed? + ).and_return(true) end include_examples "EFI partition for BLS bootloaders" diff --git a/test/y2storage/boot_requirements_checker_aarch64_test.rb b/test/y2storage/boot_requirements_checker_aarch64_test.rb index d9238f949..a603ed247 100755 --- a/test/y2storage/boot_requirements_checker_aarch64_test.rb +++ b/test/y2storage/boot_requirements_checker_aarch64_test.rb @@ -52,10 +52,11 @@ let(:efi_part) { find_vol("/boot/efi", checker.needed_partitions(target)) } let(:desired_efi_part) { find_vol("/boot/efi", checker.needed_partitions(:desired)) } - include_examples "BLS bootloader not disabled" - context "and BLS installation is explicitly disabled" do + context "and BLS bootloader is explicitly disabled" do before do - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(true) + allow(Y2Storage::BootRequirementsStrategies::BLS).to receive( + :bls_bootloader_proposed? + ).and_return(false) end include_examples "minimalistic EFI partition" diff --git a/test/y2storage/boot_requirements_checker_x86_test.rb b/test/y2storage/boot_requirements_checker_x86_test.rb index 499f0d895..c3dceb83a 100755 --- a/test/y2storage/boot_requirements_checker_x86_test.rb +++ b/test/y2storage/boot_requirements_checker_x86_test.rb @@ -297,7 +297,7 @@ let(:efi_partitions) { [] } include_examples "proposed EFI partition basics" - include_examples "BLS bootloader not disabled" + include_examples "BLS bootloader proposed" context "and BLS installation is explicitly disabled" do before do From 8aa5c27b9fecaf9e29fb422c4ad2dc595139bbbd Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 17:32:15 +0200 Subject: [PATCH 32/64] error message --- src/lib/y2storage/setup_checker.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 14d698d27..db3900a05 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -78,7 +78,21 @@ def errors # # @return [Array] def warnings - boot_warnings + product_warnings + mount_warnings + security_policy_warnings + boot_warnings + product_warnings + mount_warnings + security_policy_warnings + encryption_warnings + end + + # All encryption warnings detected in the setup + # + # Argion2id needs at least 4GByte momory + # + # @return [Array] + def encryption_warnings + @encryption_warnings ||= @devicegraph.encryptions + .select(&:supports_authentication?) + .map do |e| + SetupError.new(message: format(_("using %s for %s"), e.pbkdf.name, + e.blk_device.name)) + end end # All boot errors detected in the setup From 8c6aa6f4b5c7bea9a52159887b16e8d5302fbcb0 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 17:38:45 +0200 Subject: [PATCH 33/64] error message --- src/lib/y2storage/setup_checker.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index db3900a05..fa9e54b64 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -87,6 +87,8 @@ def warnings # # @return [Array] def encryption_warnings + puts "yyyyyyyyyyy" + @devicegraph.encryptions.each do |e| puts "xxxxx #{e.pbkdf.name}" @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_authentication?) .map do |e| From f9dab4402d3f5120c4968256b11762fcbbdb33a4 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 17:39:59 +0200 Subject: [PATCH 34/64] error message --- src/lib/y2storage/setup_checker.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index fa9e54b64..3c622217d 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -88,7 +88,9 @@ def warnings # @return [Array] def encryption_warnings puts "yyyyyyyyyyy" - @devicegraph.encryptions.each do |e| puts "xxxxx #{e.pbkdf.name}" + @devicegraph.encryptions.each do |e| + puts "xxxxx #{e.pbkdf.name}" + end @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_authentication?) .map do |e| From b32feeb4c3e11d88df6d3a62f66b51f6085ada14 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 17:53:00 +0200 Subject: [PATCH 35/64] error message --- src/lib/y2storage/setup_checker.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 3c622217d..f3e52b3bb 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -87,12 +87,11 @@ def warnings # # @return [Array] def encryption_warnings - puts "yyyyyyyyyyy" @devicegraph.encryptions.each do |e| - puts "xxxxx #{e.pbkdf.name}" + puts "xxxxx #{e.pbkdf.name} #{e.supports_pbkdf?}" end @encryption_warnings ||= @devicegraph.encryptions - .select(&:supports_authentication?) + .select(&:supports_pbkdf?) .map do |e| SetupError.new(message: format(_("using %s for %s"), e.pbkdf.name, e.blk_device.name)) From c0fc933d43f90a12a54e3e48bb33679486d6b18f Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 17:55:30 +0200 Subject: [PATCH 36/64] error message --- src/lib/y2storage/setup_checker.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index f3e52b3bb..0cf9301ef 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -78,6 +78,7 @@ def errors # # @return [Array] def warnings + puts "jjjjjjjjjjj #{encryption_warnings}" boot_warnings + product_warnings + mount_warnings + security_policy_warnings + encryption_warnings end @@ -93,6 +94,7 @@ def encryption_warnings @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| + puts "lllll" SetupError.new(message: format(_("using %s for %s"), e.pbkdf.name, e.blk_device.name)) end From 5c480d519fca25483cc2e40610b6466e350402cc Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 18:12:54 +0200 Subject: [PATCH 37/64] cleanup --- src/lib/y2storage/setup_checker.rb | 8 ++------ src/lib/y2storage/setup_errors_presenter.rb | 13 ++++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 0cf9301ef..e4bb8581e 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -78,7 +78,6 @@ def errors # # @return [Array] def warnings - puts "jjjjjjjjjjj #{encryption_warnings}" boot_warnings + product_warnings + mount_warnings + security_policy_warnings + encryption_warnings end @@ -88,15 +87,12 @@ def warnings # # @return [Array] def encryption_warnings - @devicegraph.encryptions.each do |e| - puts "xxxxx #{e.pbkdf.name} #{e.supports_pbkdf?}" - end @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| puts "lllll" - SetupError.new(message: format(_("using %s for %s"), e.pbkdf.name, - e.blk_device.name)) + SetupError.new(message: format(_("Using %s for %s but this needs 4GByte memory at lease."), + e.pbkdf.name, e.blk_device.name)) end end diff --git a/src/lib/y2storage/setup_errors_presenter.rb b/src/lib/y2storage/setup_errors_presenter.rb index 1aeef96cf..49f05bfec 100644 --- a/src/lib/y2storage/setup_errors_presenter.rb +++ b/src/lib/y2storage/setup_errors_presenter.rb @@ -60,7 +60,8 @@ def warnings_html boot_warnings_html, product_warnings_html, mount_warnings_html, - security_policy_warnings_html + security_policy_warnings_html, + encryption_warnings_html ].compact return nil if warnings.empty? @@ -68,6 +69,16 @@ def warnings_html warnings.join(Yast::HTML.Newline) end + # HTML representation for encryption warnings + # + # @return [String, nil] nil if there is no encryption warning + def encryption_warnings_html + warnings = setup_checker.encryption_warnings + header = _("There could be problems while encrypting devices:\n") + + create_html(header, warnings) + end + # HTML representation for boot warnings # # @return [String, nil] nil if there is no boot warning From d89b8ccefc2f125cd0aed8a103ffe6a3f194fda5 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 18:22:05 +0200 Subject: [PATCH 38/64] cleanup --- src/lib/y2storage/setup_checker.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index e4bb8581e..4a64212a0 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -24,6 +24,8 @@ require "y2storage/boot_requirements_checker" require "y2storage/proposal_settings" require "y2storage/with_security_policies" +# memory size detection +require "yast2/hw_detection" # This 'import' is necessary to load the control file (/etc/YaST/control.xml) # when running in an installed system. During installation, this module @@ -87,11 +89,13 @@ def warnings # # @return [Array] def encryption_warnings + return [] if Yast2::HwDetection.memory >= 4 << 30 + @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| puts "lllll" - SetupError.new(message: format(_("Using %s for %s but this needs 4GByte memory at lease."), + SetupError.new(message: format(_("Using %s for %s but this needs 4GByte memory at least."), e.pbkdf.name, e.blk_device.name)) end end From 36dabcfbead005f76bf25a029cb9989af764fb59 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 22 Jul 2025 18:22:40 +0200 Subject: [PATCH 39/64] cleanup --- src/lib/y2storage/setup_checker.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 4a64212a0..e44157f38 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -94,7 +94,6 @@ def encryption_warnings @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| - puts "lllll" SetupError.new(message: format(_("Using %s for %s but this needs 4GByte memory at least."), e.pbkdf.name, e.blk_device.name)) end From 86b366b41483382dcdbe1f0cdfb1ce812f8dbed0 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 09:51:28 +0200 Subject: [PATCH 40/64] cleanup --- src/lib/y2storage/setup_checker.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index e44157f38..c1d8719a4 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -85,17 +85,21 @@ def warnings # All encryption warnings detected in the setup # - # Argion2id needs at least 4GByte momory + # Argion2* needs at least 4GByte momory # # @return [Array] def encryption_warnings - return [] if Yast2::HwDetection.memory >= 4 << 30 + m = (4 << 20) + puts "xxxxx #{Yast2::HwDetection.memory} : #{m}" + return [] if Yast2::HwDetection.memory >= (4 << 20) @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| - SetupError.new(message: format(_("Using %s for %s but this needs 4GByte memory at least."), - e.pbkdf.name, e.blk_device.name)) + if ["argon2id", "argon2i"].include?(e.pbkdf.name) + SetupError.new(message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), + e.pbkdf.name, e.blk_device.name)) + end end end From 473c6598677b666998eb1a38152af9aed6787e07 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 10:02:43 +0200 Subject: [PATCH 41/64] cleanup --- src/lib/y2storage/setup_checker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index c1d8719a4..0d6b18431 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -89,9 +89,9 @@ def warnings # # @return [Array] def encryption_warnings - m = (4 << 20) + m = ((4000 - 64) << 20) puts "xxxxx #{Yast2::HwDetection.memory} : #{m}" - return [] if Yast2::HwDetection.memory >= (4 << 20) + return [] if Yast2::HwDetection.memory >= ((4000 - 64) << 20) @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) From 94c0f3647d239d6e723481e060f79048f679b64f Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 10:09:45 +0200 Subject: [PATCH 42/64] cleanup --- src/lib/y2storage/setup_checker.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 0d6b18431..23d52f6a5 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -101,6 +101,7 @@ def encryption_warnings e.pbkdf.name, e.blk_device.name)) end end + @encryption_warnings.compact end # All boot errors detected in the setup From 62e78387f290c6b759fd75f6ef5f3ae3bd69ec02 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 10:32:13 +0200 Subject: [PATCH 43/64] cleanup --- src/lib/y2storage/setup_checker.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 23d52f6a5..74d34f3f3 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -96,12 +96,14 @@ def encryption_warnings @encryption_warnings ||= @devicegraph.encryptions .select(&:supports_pbkdf?) .map do |e| + ret = nil if ["argon2id", "argon2i"].include?(e.pbkdf.name) - SetupError.new(message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), + ret = SetupError.new(message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), e.pbkdf.name, e.blk_device.name)) end + ret end - @encryption_warnings.compact + @encryption_warnings.compact! end # All boot errors detected in the setup From 296374371a8849535a20fa1a520ac18dc17b85e2 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 11:20:22 +0200 Subject: [PATCH 44/64] cleanup --- src/lib/y2storage/setup_checker.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 74d34f3f3..069beb2b7 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -93,17 +93,19 @@ def encryption_warnings puts "xxxxx #{Yast2::HwDetection.memory} : #{m}" return [] if Yast2::HwDetection.memory >= ((4000 - 64) << 20) - @encryption_warnings ||= @devicegraph.encryptions - .select(&:supports_pbkdf?) - .map do |e| - ret = nil - if ["argon2id", "argon2i"].include?(e.pbkdf.name) - ret = SetupError.new(message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), - e.pbkdf.name, e.blk_device.name)) + unless @encryption_warnings + @encryption_warnings = [] + @devicegraph.encryptions + .select(&:supports_pbkdf?) + .each do |e| + if ["argon2id", "argon2i"].include?(e.pbkdf.name) + @encryption_warnings << SetupError.new(message: + format(_("Using %s for %s but this needs 4 GByte RAM at least."), + e.pbkdf.name, e.blk_device.name)) + end end - ret end - @encryption_warnings.compact! + @encryption_warnings end # All boot errors detected in the setup From 00af8894b2066a3b0567126a7dee4e179c20e171 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 11:44:55 +0200 Subject: [PATCH 45/64] cleanup --- src/lib/y2storage/setup_checker.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 069beb2b7..b73f3a5e6 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -85,14 +85,12 @@ def warnings # All encryption warnings detected in the setup # - # Argion2* needs at least 4GByte momory + # Argion2* needs at least 4GByte momory. cryptsetup could crash with less than 4GByte + # RAM.(bsc#1246876) # # @return [Array] def encryption_warnings - m = ((4000 - 64) << 20) - puts "xxxxx #{Yast2::HwDetection.memory} : #{m}" return [] if Yast2::HwDetection.memory >= ((4000 - 64) << 20) - unless @encryption_warnings @encryption_warnings = [] @devicegraph.encryptions From 0f9f7b9bd87de49ef508efb8b81dfe102034b044 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 12:25:35 +0200 Subject: [PATCH 46/64] cleanup --- src/lib/y2storage/setup_checker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index b73f3a5e6..3e11d5357 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -96,7 +96,7 @@ def encryption_warnings @devicegraph.encryptions .select(&:supports_pbkdf?) .each do |e| - if ["argon2id", "argon2i"].include?(e.pbkdf.name) + if ["argon2id", "argon2i"].include?(e.pbkdf.value) @encryption_warnings << SetupError.new(message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), e.pbkdf.name, e.blk_device.name)) From 9459a5eea5d9378855a89e1e46b2f09d0af35a08 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 12:55:24 +0200 Subject: [PATCH 47/64] rubocop --- src/lib/y2storage/setup_checker.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 3e11d5357..531c6b161 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -91,16 +91,18 @@ def warnings # @return [Array] def encryption_warnings return [] if Yast2::HwDetection.memory >= ((4000 - 64) << 20) + unless @encryption_warnings @encryption_warnings = [] @devicegraph.encryptions .select(&:supports_pbkdf?) .each do |e| - if ["argon2id", "argon2i"].include?(e.pbkdf.value) - @encryption_warnings << SetupError.new(message: - format(_("Using %s for %s but this needs 4 GByte RAM at least."), - e.pbkdf.name, e.blk_device.name)) - end + next unless ["argon2id", "argon2i"].include?(e.pbkdf.value) + + @encryption_warnings << SetupError.new( + message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), + e.pbkdf.name, e.blk_device.name) + ) end end @encryption_warnings From 824ddf2671167f8c76fb68751d3e74918b06a257 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 14:22:04 +0200 Subject: [PATCH 48/64] fixed testcases --- test/y2storage/setup_errors_presenter_test.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/y2storage/setup_errors_presenter_test.rb b/test/y2storage/setup_errors_presenter_test.rb index fcbe7f5f1..534a4056d 100755 --- a/test/y2storage/setup_errors_presenter_test.rb +++ b/test/y2storage/setup_errors_presenter_test.rb @@ -33,6 +33,7 @@ allow(setup_checker).to receive(:boot_warnings).and_return(boot_errors) allow(setup_checker).to receive(:product_warnings).and_return(product_errors) allow(setup_checker).to receive(:mount_warnings).and_return(mount_errors) + allow(setup_checker).to receive(:encryption_warnings).and_return(encryption_errors) allow(setup_checker).to receive(:security_policy).and_return(policy) allow(setup_checker).to receive(:security_policy_failing_rules).and_return(policy_errors) allow(setup_checker).to receive(:errors).and_return(fatal_errors) @@ -49,6 +50,8 @@ let(:mount_errors) { [] } + let(:encryption_errors) { [] } + let(:policy) { double("Y2Security::SecurityPolicies::DisaStigPolicy", name: "STIG") } let(:policy_errors) { [] } From eba2a3e68e3b597f8ad1a3e2cb67e9f0f13a9ddc Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 23 Jul 2025 15:49:12 +0200 Subject: [PATCH 49/64] updated changes --- package/yast2-storage-ng.changes | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/yast2-storage-ng.changes b/package/yast2-storage-ng.changes index 04fec878d..9c2e4f95f 100644 --- a/package/yast2-storage-ng.changes +++ b/package/yast2-storage-ng.changes @@ -3,7 +3,11 @@ Thu Jul 17 06:39:11 UTC 2025 - Stefan Schubert - Do not generate grub2 error messages and proposals if a BLS bootlaoder (systemd-boot/grub2-bls) bootloader is the preferred - bootloader (bsc#1244755). + bootloader. +- Do not generate subvolumes like @/boot/grub2/x86_64-efi and + @/boot/grub2/i386-pc if a BLS bootloader is suggested. +- Do not generate /boot if a BLS bootloader is suggested. +- (bsc#1244755) - 5.0.34 ------------------------------------------------------------------- From a0847289c6b9e3dac600a1f8223b8a4a1a61f926 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 12:42:50 +0200 Subject: [PATCH 50/64] adapt suggestion --- .../y2storage/boot_requirements_checker.rb | 2 +- .../boot_requirements_strategies/analyzer.rb | 12 ++++++++++++ .../boot_requirements_strategies/base.rb | 10 ++++++++-- .../boot_requirements_strategies/bls.rb | 19 +++++++------------ src/lib/y2storage/setup_checker.rb | 7 +++---- src/lib/y2storage/volume_specification.rb | 2 +- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/lib/y2storage/boot_requirements_checker.rb b/src/lib/y2storage/boot_requirements_checker.rb index 21089d44b..3cb1581a3 100644 --- a/src/lib/y2storage/boot_requirements_checker.rb +++ b/src/lib/y2storage/boot_requirements_checker.rb @@ -141,7 +141,7 @@ def strategy_class # @return [BootRequirementsStrategies::Base] def arch_strategy_class if arch.efiboot? - if Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? + if Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? BootRequirementsStrategies::BLS else BootRequirementsStrategies::UEFI diff --git a/src/lib/y2storage/boot_requirements_strategies/analyzer.rb b/src/lib/y2storage/boot_requirements_strategies/analyzer.rb index 92114861a..9382a896e 100644 --- a/src/lib/y2storage/boot_requirements_strategies/analyzer.rb +++ b/src/lib/y2storage/boot_requirements_strategies/analyzer.rb @@ -22,6 +22,9 @@ require "y2storage/planned" require "y2storage/encryption_type" +Yast.import "ProductFeatures" +Yast.import "Arch" + module Y2Storage module BootRequirementsStrategies # Auxiliary class that takes information from several sources (current @@ -374,6 +377,15 @@ def encrypted_zipl? encrypted?(device_for_zipl) end + def self.bls_bootloader_proposed? + preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", + "preferred_bootloader") + Y2Storage::Arch.new.efiboot? && + (Yast::Arch.x86_64 || Yast::Arch.aarch64) && + !StorageEnv.instance.no_bls_bootloader && + ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) + end + protected attr_reader :devicegraph diff --git a/src/lib/y2storage/boot_requirements_strategies/base.rb b/src/lib/y2storage/boot_requirements_strategies/base.rb index df02ad71b..aa2e82865 100644 --- a/src/lib/y2storage/boot_requirements_strategies/base.rb +++ b/src/lib/y2storage/boot_requirements_strategies/base.rb @@ -85,8 +85,7 @@ def needed_partitions(target) def warnings res = [] - if !boot_readable_by_grub? && - !Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? + if grub_warning? && !boot_readable_by_grub? error_message = _( "The grub boot loader cannot access the file system mounted at /boot. " \ @@ -111,6 +110,13 @@ def warnings res end + # Checks if it makes sense to show grub warnings + # + # @return [Boolean] + def grub_warning? + true + end + # All fatal boot errors detected in the setup, for example, when a / partition # is missing # diff --git a/src/lib/y2storage/boot_requirements_strategies/bls.rb b/src/lib/y2storage/boot_requirements_strategies/bls.rb index 6c4ef8585..d5d1fe9a5 100644 --- a/src/lib/y2storage/boot_requirements_strategies/bls.rb +++ b/src/lib/y2storage/boot_requirements_strategies/bls.rb @@ -19,9 +19,6 @@ require "y2storage/boot_requirements_strategies/uefi" -Yast.import "ProductFeatures" -Yast.import "Arch" - module Y2Storage module BootRequirementsStrategies # Strategy to calculate boot requirements in BLS/UEFI systems @@ -31,15 +28,6 @@ def initialize(*args) super end - def self.bls_bootloader_proposed? - preferred_bootloader = Yast::ProductFeatures.GetStringFeature("globals", - "preferred_bootloader") - Y2Storage::Arch.new.efiboot? && - (Yast::Arch.x86_64 || Yast::Arch.aarch64) && - !StorageEnv.instance.no_bls_bootloader && - ["systemd-boot", "grub2-bls"].include?(preferred_bootloader) - end - # No extra /boot partition which is needed by grub2 only def needed_partitions(target) planned_partitions = [] @@ -47,6 +35,13 @@ def needed_partitions(target) planned_partitions end + # Checks if it makes sense to show grub warnings + # + # @return [Boolean] + def grub_warning? + false + end + protected # @return [VolumeSpecification] diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index 531c6b161..eb317f224 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -24,8 +24,7 @@ require "y2storage/boot_requirements_checker" require "y2storage/proposal_settings" require "y2storage/with_security_policies" -# memory size detection -require "yast2/hw_detection" +require "y2storage/storage_manager" # This 'import' is necessary to load the control file (/etc/YaST/control.xml) # when running in an installed system. During installation, this module @@ -90,7 +89,7 @@ def warnings # # @return [Array] def encryption_warnings - return [] if Yast2::HwDetection.memory >= ((4000 - 64) << 20) + return [] if DiskSize.new(StorageManager.instance.arch.ram_size) >= DiskSize.GiB(4) unless @encryption_warnings @encryption_warnings = [] @@ -100,7 +99,7 @@ def encryption_warnings next unless ["argon2id", "argon2i"].include?(e.pbkdf.value) @encryption_warnings << SetupError.new( - message: format(_("Using %s for %s but this needs 4 GByte RAM at least."), + message: format(_("Using %s for %s but this needs 4 GiB RAM at least."), e.pbkdf.name, e.blk_device.name) ) end diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 2aff1d0ca..2282e0210 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -411,7 +411,7 @@ def load_features(volume_features) def adjust_features self.adjust_by_ram = false if swap? && !resume_supported? - return unless Y2Storage::BootRequirementsStrategies::BLS.bls_bootloader_proposed? + return unless Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? # Removing grub2/grub2-efi specific subvolumes because they are not needed. @subvolumes.delete_if do |subvol| From 44018a1bd1a473402086277537a0865594faf7b3 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 14:03:34 +0200 Subject: [PATCH 51/64] fixed testcase --- test/support/boot_requirements_uefi.rb | 6 +- .../boot_requirements_checker_aarch64_test.rb | 2 +- .../analyzer_test.rb | 87 +++++++++++++++++++ .../boot_requirements_strategies/bls_test.rb | 86 ------------------ 4 files changed, 91 insertions(+), 90 deletions(-) diff --git a/test/support/boot_requirements_uefi.rb b/test/support/boot_requirements_uefi.rb index 365b2018c..fe20b5205 100755 --- a/test/support/boot_requirements_uefi.rb +++ b/test/support/boot_requirements_uefi.rb @@ -137,9 +137,9 @@ RSpec.shared_context "BLS bootloader proposed" do context "and BLS bootloader is proposed and possible" do before do - allow(Y2Storage::BootRequirementsStrategies::BLS).to receive( - :bls_bootloader_proposed? - ).and_return(true) + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(true) end include_examples "EFI partition for BLS bootloaders" diff --git a/test/y2storage/boot_requirements_checker_aarch64_test.rb b/test/y2storage/boot_requirements_checker_aarch64_test.rb index a603ed247..c35162a35 100755 --- a/test/y2storage/boot_requirements_checker_aarch64_test.rb +++ b/test/y2storage/boot_requirements_checker_aarch64_test.rb @@ -54,7 +54,7 @@ context "and BLS bootloader is explicitly disabled" do before do - allow(Y2Storage::BootRequirementsStrategies::BLS).to receive( + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( :bls_bootloader_proposed? ).and_return(false) end diff --git a/test/y2storage/boot_requirements_strategies/analyzer_test.rb b/test/y2storage/boot_requirements_strategies/analyzer_test.rb index 33be6fd5e..4f1babe72 100755 --- a/test/y2storage/boot_requirements_strategies/analyzer_test.rb +++ b/test/y2storage/boot_requirements_strategies/analyzer_test.rb @@ -909,4 +909,91 @@ def create_filesystem(device_name, mount_point) end end end + + describe ".bls_bootloader_proposed?" do + describe "checking suggested bootloader" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:x86_64).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + end + + context "when a none bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-efi") + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when a bls bootloader is suggested" do + before do + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking architecture" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("grub2-bls") + end + + context "when architectue is not x86_64/aarch64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(false) + allow(Yast::Arch).to receive(:aarch64).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when architectue is x86_64" do + before do + allow(Yast::Arch).to receive(:x86_64).and_return(true) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + + describe "checking EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + allow(Yast::Arch).to receive(:aarch64).and_return(true) + allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) + allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", + "preferred_bootloader").and_return("systemd-boot") + end + + context "when not EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) + end + it "returns false" do + expect(subject.bls_bootloader_proposed?).to eq false + end + end + + context "when EFI system" do + before do + allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) + end + it "returns true" do + expect(subject.bls_bootloader_proposed?).to eq true + end + end + end + end end diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb index 3adea7358..c0fb89964 100644 --- a/test/y2storage/boot_requirements_strategies/bls_test.rb +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -23,90 +23,4 @@ describe Y2Storage::BootRequirementsStrategies::BLS do subject { described_class } - describe ".bls_bootloader_proposed?" do - describe "checking suggested bootloader" do - before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) - allow(Yast::Arch).to receive(:x86_64).and_return(true) - allow(Yast::Arch).to receive(:aarch64).and_return(true) - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) - end - - context "when a none bls bootloader is suggested" do - before do - allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("grub2-efi") - end - it "returns false" do - expect(subject.bls_bootloader_proposed?).to eq false - end - end - - context "when a bls bootloader is suggested" do - before do - allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("systemd-boot") - end - it "returns true" do - expect(subject.bls_bootloader_proposed?).to eq true - end - end - end - - describe "checking architecture" do - before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) - allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("grub2-bls") - end - - context "when architectue is not x86_64/aarch64" do - before do - allow(Yast::Arch).to receive(:x86_64).and_return(false) - allow(Yast::Arch).to receive(:aarch64).and_return(false) - end - it "returns false" do - expect(subject.bls_bootloader_proposed?).to eq false - end - end - - context "when architectue is x86_64" do - before do - allow(Yast::Arch).to receive(:x86_64).and_return(true) - end - it "returns true" do - expect(subject.bls_bootloader_proposed?).to eq true - end - end - end - - describe "checking EFI system" do - before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) - allow(Yast::Arch).to receive(:aarch64).and_return(true) - allow(Y2Storage::StorageEnv.instance).to receive(:no_bls_bootloader).and_return(false) - allow(Yast::ProductFeatures).to receive(:GetStringFeature).with("globals", - "preferred_bootloader").and_return("systemd-boot") - end - - context "when not EFI system" do - before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(false) - end - it "returns false" do - expect(subject.bls_bootloader_proposed?).to eq false - end - end - - context "when EFI system" do - before do - allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) - end - it "returns true" do - expect(subject.bls_bootloader_proposed?).to eq true - end - end - end - end end From d238ee06d3054d61c8bf517506a9165471523d1d Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 15:01:05 +0200 Subject: [PATCH 52/64] fixed testsuite --- test/y2storage/setup_checker_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/y2storage/setup_checker_test.rb b/test/y2storage/setup_checker_test.rb index 68e27d9a9..a00f65bec 100755 --- a/test/y2storage/setup_checker_test.rb +++ b/test/y2storage/setup_checker_test.rb @@ -28,6 +28,10 @@ before do fake_scenario(scenario) + + # Let's assume 8 GiB of RAM + allow(Yast::SCR).to receive(:Read).with(path(".proc.meminfo")) + .and_return("memtotal" => 8388608) end let(:scenario) { "empty_hard_disk_gpt_50GiB" } From 1e38d8339632111595f19a8f85e42751cddcd76a Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 15:27:24 +0200 Subject: [PATCH 53/64] fixed testcase --- test/y2storage/boot_requirements_strategies/analyzer_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/y2storage/boot_requirements_strategies/analyzer_test.rb b/test/y2storage/boot_requirements_strategies/analyzer_test.rb index 4f1babe72..cf942770f 100755 --- a/test/y2storage/boot_requirements_strategies/analyzer_test.rb +++ b/test/y2storage/boot_requirements_strategies/analyzer_test.rb @@ -911,6 +911,8 @@ def create_filesystem(device_name, mount_point) end describe ".bls_bootloader_proposed?" do + subject { described_class } + describe "checking suggested bootloader" do before do allow_any_instance_of(Y2Storage::Arch).to receive(:efiboot?).and_return(true) From 8f6828d990bc35deff27f111fc889ddd32a8ebe4 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 16:00:42 +0200 Subject: [PATCH 54/64] fixed testsuite --- test/y2storage/boot_requirements_strategies/analyzer_test.rb | 2 +- test/y2storage/setup_checker_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/y2storage/boot_requirements_strategies/analyzer_test.rb b/test/y2storage/boot_requirements_strategies/analyzer_test.rb index cf942770f..71ef17a00 100755 --- a/test/y2storage/boot_requirements_strategies/analyzer_test.rb +++ b/test/y2storage/boot_requirements_strategies/analyzer_test.rb @@ -911,7 +911,7 @@ def create_filesystem(device_name, mount_point) end describe ".bls_bootloader_proposed?" do - subject { described_class } + subject { Y2Storage::BootRequirementsStrategies::Analyzer } describe "checking suggested bootloader" do before do diff --git a/test/y2storage/setup_checker_test.rb b/test/y2storage/setup_checker_test.rb index a00f65bec..4b5d04c4e 100755 --- a/test/y2storage/setup_checker_test.rb +++ b/test/y2storage/setup_checker_test.rb @@ -29,6 +29,7 @@ before do fake_scenario(scenario) + allow(Yast::SCR).to receive(:Read) # Let's assume 8 GiB of RAM allow(Yast::SCR).to receive(:Read).with(path(".proc.meminfo")) .and_return("memtotal" => 8388608) From b962109f6df08ebe12beccdce82dacdb6eb1213d Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 17:02:47 +0200 Subject: [PATCH 55/64] added testcases for encryption errors --- test/y2storage/setup_errors_presenter_test.rb | 62 ++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/test/y2storage/setup_errors_presenter_test.rb b/test/y2storage/setup_errors_presenter_test.rb index 534a4056d..4c3d35029 100755 --- a/test/y2storage/setup_errors_presenter_test.rb +++ b/test/y2storage/setup_errors_presenter_test.rb @@ -64,6 +64,7 @@ let(:product_errors) { [] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "returns an empty string" do expect(subject.to_html).to be_empty @@ -85,15 +86,19 @@ let(:product_error2) { instance_double(Y2Storage::SetupError, message: "product error 2") } let(:product_error3) { instance_double(Y2Storage::SetupError, message: "product error 3") } let(:mount_error1) { instance_double(Y2Storage::SetupError, message: "missing option 1") } + let(:encryption_error) do + instance_double(Y2Storage::SetupError, message: "encryption error") + end let(:policy_errors) { [] } let(:boot_errors) { [boot_error1, boot_error2] } let(:product_errors) { [product_error1, product_error2, product_error3] } let(:mount_errors) { [mount_error1] } + let(:encryption_errors) { [encryption_error] } it "contains a message for each error" do - expect(subject.to_html.scan(/
  • /).size).to eq(6) + expect(subject.to_html.scan(/
  • /).size).to eq(7) end context "and there are boot errors" do @@ -101,6 +106,7 @@ let(:product_errors) { [] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for boot errors" do expect(subject.to_html).to match(/not be able to boot/) @@ -117,6 +123,10 @@ it "does not contain a general error message for policy errors" do expect(subject.to_html).to_not match(/does not comply with the STIG policy/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end context "and there are product errors" do @@ -124,6 +134,7 @@ let(:product_errors) { [product_error1] } let(:mount_errors) { [] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for product errors" do expect(subject.to_html).to match(/could not work/) @@ -140,6 +151,10 @@ it "does not contain a general error message for policy errors" do expect(subject.to_html).to_not match(/does not comply with the STIG policy/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end context "and there are mount errors" do @@ -147,6 +162,7 @@ let(:product_errors) { [] } let(:mount_errors) { [mount_error1] } let(:policy_errors) { [] } + let(:encryption_errors) { [] } it "contains a general error message for mount errors" do expect(subject.to_html).to match(/mount point during boot/) @@ -169,6 +185,7 @@ let(:boot_errors) { [] } let(:product_errors) { [] } let(:mount_errors) { [] } + let(:encryption_errors) { [] } let(:policy_errors) { [double("Y2Security::SecurityPolicies::Rule")] } it "contains a general error message for the policy" do @@ -186,12 +203,49 @@ it "does not contain a general error message for mount errors" do expect(subject.to_html).to_not match(/mount point during boot/) end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end + end + + context "and there are encryption errors" do + let(:boot_errors) { [] } + let(:product_errors) { [] } + let(:mount_errors) { [] } + let(:encryption_errors) { [encryption_error] } + let(:policy_errors) { [] } + + it "contains a general error message for encryption" do + expect(subject.to_html).to match(/problems while encrypting devices/) + end + + it "contains not a general error message for the policy" do + expect(subject.to_html).to_not match(/does not comply with the STIG policy/) + end + + it "does not contain a general error message for boot errors" do + expect(subject.to_html).to_not match(/not be able to boot/) + end + + it "does not contain a general error message for product errors" do + expect(subject.to_html).to_not match(/could not work/) + end + + it "does not contain a general error message for mount errors" do + expect(subject.to_html).to_not match(/mount point during boot/) + end + + it "does not contain a general error message for encryption errors" do + expect(subject.to_html).to_not match(/problems while encrypting devices/) + end end - context "and there are boot, product, mount errors and policies errors" do + context "and there are boot, product, mount errors, encryption errors and policies errors" do let(:boot_errors) { [boot_error1] } let(:product_errors) { [product_error1] } let(:mount_errors) { [mount_error1] } + let(:encryption_errors) { [encryption_error] } let(:policy_errors) { [instance_double(Y2Storage::SetupError, message: "policy error")] } it "contains a general error message for boot errors" do @@ -209,6 +263,10 @@ it "contains a general error message for the policy" do expect(subject.to_html).to match(/does not comply with the STIG policy/) end + + it "contains a general error message for encryption" do + expect(subject.to_html).to match(/problems while encrypting devices/) + end end end end From ac107e0c8bc325f62c32a43446661945bb351626 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 1 Aug 2025 17:09:34 +0200 Subject: [PATCH 56/64] fixed testsuite --- test/y2storage/setup_errors_presenter_test.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/y2storage/setup_errors_presenter_test.rb b/test/y2storage/setup_errors_presenter_test.rb index 4c3d35029..4e5ddc92c 100755 --- a/test/y2storage/setup_errors_presenter_test.rb +++ b/test/y2storage/setup_errors_presenter_test.rb @@ -235,10 +235,6 @@ it "does not contain a general error message for mount errors" do expect(subject.to_html).to_not match(/mount point during boot/) end - - it "does not contain a general error message for encryption errors" do - expect(subject.to_html).to_not match(/problems while encrypting devices/) - end end context "and there are boot, product, mount errors, encryption errors and policies errors" do From 0f8f67edddcaaf78dbaed2044bd284578ccb64e8 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 4 Aug 2025 16:29:20 +0200 Subject: [PATCH 57/64] added testcase --- test/y2storage/volume_specification_test.rb | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/y2storage/volume_specification_test.rb b/test/y2storage/volume_specification_test.rb index 22ee4185f..de2fd2acb 100755 --- a/test/y2storage/volume_specification_test.rb +++ b/test/y2storage/volume_specification_test.rb @@ -411,6 +411,32 @@ expect(subject.subvolumes).to_not be_empty expect(subject.subvolumes).to all(be_a(Y2Storage::SubvolSpecification)) end + context "and a BLS bootloader is not default" do + before do + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(false) + end + + it "subvolumes contains grub2 specific entries" do + ret = subject.subvolumes.any? { |s| s.path.include?("boot/grub2") } + expect(ret).to eq(true) + end + end + + context "and a BLS bootloader is default" do + before do + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive( + :bls_bootloader_proposed? + ).and_return(true) + end + + it "subvolumes contains grub2 specific entries" do + ret = subject.subvolumes.any? { |s| s.path.include?("boot/grub2") } + expect(ret).to eq(false) + end + end + end end From 22ea526192041f8eda8c3b6e5c84f66e966cf207 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 5 Aug 2025 12:56:06 +0200 Subject: [PATCH 58/64] added testcase --- .../boot_requirements_strategies/bls_test.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/y2storage/boot_requirements_strategies/bls_test.rb b/test/y2storage/boot_requirements_strategies/bls_test.rb index c0fb89964..b4c0fdfb1 100644 --- a/test/y2storage/boot_requirements_strategies/bls_test.rb +++ b/test/y2storage/boot_requirements_strategies/bls_test.rb @@ -21,6 +21,23 @@ require "y2storage" describe Y2Storage::BootRequirementsStrategies::BLS do - subject { described_class } + subject { described_class.new(fake_devicegraph, [], "/dev/sda1") } + before do + fake_scenario("empty_disks") + allow(Y2Storage::BootRequirementsStrategies::Analyzer).to receive(:new).and_return(analyzer) + allow(analyzer).to receive(:free_mountpoint?).and_return(false) + end + + let(:analyzer) do + Y2Storage::BootRequirementsStrategies::Analyzer.new(fake_devicegraph, [], "/dev/sda1") + end + + describe ".needed_partitions" do + let(:target) { :desired } + it "does not return own /boot partition" do + ret = subject.needed_partitions(target) + expect(ret.any? { |p| p.mount_point == "/boot" }).to eq(false) + end + end end From 8bc8d9dd3e646a2170f92703de508a3136dc135b Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 10:53:02 +0200 Subject: [PATCH 59/64] added more comments --- src/lib/y2storage/volume_specification.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 2282e0210..70701f56b 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -414,6 +414,9 @@ def adjust_features return unless Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? # Removing grub2/grub2-efi specific subvolumes because they are not needed. + # Often these subvolumes are defined in the control.xml file. So, currently it makes + # no sense to define it in the SubvolSpecification.fallback_list method because this + # will be called only if no entry is in the control.xml file. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) log.info "Removing grub2/grub2-efi specific subvolumes #{subvol.path} " \ From d37789affaa5c4a15b400c6d10ecc2377c9d231c Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 10:54:05 +0200 Subject: [PATCH 60/64] Update test/y2storage/volume_specification_test.rb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Iván López --- test/y2storage/volume_specification_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/y2storage/volume_specification_test.rb b/test/y2storage/volume_specification_test.rb index de2fd2acb..ade236318 100755 --- a/test/y2storage/volume_specification_test.rb +++ b/test/y2storage/volume_specification_test.rb @@ -431,7 +431,7 @@ ).and_return(true) end - it "subvolumes contains grub2 specific entries" do + it "does not contain grub2 specific subvolumes" do ret = subject.subvolumes.any? { |s| s.path.include?("boot/grub2") } expect(ret).to eq(false) end From 440ceeb4dd80a166681187ff344373b63cb83ca1 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 10:54:16 +0200 Subject: [PATCH 61/64] Update test/y2storage/setup_errors_presenter_test.rb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Iván López --- test/y2storage/setup_errors_presenter_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/y2storage/setup_errors_presenter_test.rb b/test/y2storage/setup_errors_presenter_test.rb index 4e5ddc92c..2e3bf9491 100755 --- a/test/y2storage/setup_errors_presenter_test.rb +++ b/test/y2storage/setup_errors_presenter_test.rb @@ -220,7 +220,7 @@ expect(subject.to_html).to match(/problems while encrypting devices/) end - it "contains not a general error message for the policy" do + it "does not contain a general error message for the policy" do expect(subject.to_html).to_not match(/does not comply with the STIG policy/) end From 66867b3f433c662aceafd6b0d56e93471ddcb4fa Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 10:54:49 +0200 Subject: [PATCH 62/64] Update src/lib/y2storage/setup_checker.rb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Iván López --- src/lib/y2storage/setup_checker.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/y2storage/setup_checker.rb b/src/lib/y2storage/setup_checker.rb index eb317f224..79e5fb521 100644 --- a/src/lib/y2storage/setup_checker.rb +++ b/src/lib/y2storage/setup_checker.rb @@ -84,8 +84,7 @@ def warnings # All encryption warnings detected in the setup # - # Argion2* needs at least 4GByte momory. cryptsetup could crash with less than 4GByte - # RAM.(bsc#1246876) + # Argion2* needs at least 4GiB of memory. Otherwise cryptsetup could crash (bsc#1246876). # # @return [Array] def encryption_warnings From 6c1e4c65e355ccbe8190fa57fdfa0f4d4b16fcb3 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 12:16:38 +0200 Subject: [PATCH 63/64] Update src/lib/y2storage/volume_specification.rb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Iván López --- src/lib/y2storage/volume_specification.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index 70701f56b..f03e2415a 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -414,9 +414,11 @@ def adjust_features return unless Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed? # Removing grub2/grub2-efi specific subvolumes because they are not needed. - # Often these subvolumes are defined in the control.xml file. So, currently it makes - # no sense to define it in the SubvolSpecification.fallback_list method because this - # will be called only if no entry is in the control.xml file. + # Currently, the subvolumes needed for booting are directly defined in the control.xml file (or + # provided by the fallback list). But such subvolumes depend on the selected boot strategy. + # In the future, each strategy could provide its own list of subvolumes (similar to what happens now + # with the required partitions for booting). With that, control files do not have to provide the + # subvolumes for booting and there is no need for removing subvolumes here. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) log.info "Removing grub2/grub2-efi specific subvolumes #{subvol.path} " \ From bb969b0e4f02efd768130779b2b809647c27bd71 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 6 Aug 2025 12:22:22 +0200 Subject: [PATCH 64/64] rubocop --- src/lib/y2storage/volume_specification.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index f03e2415a..6700ef5d2 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -416,9 +416,9 @@ def adjust_features # Removing grub2/grub2-efi specific subvolumes because they are not needed. # Currently, the subvolumes needed for booting are directly defined in the control.xml file (or # provided by the fallback list). But such subvolumes depend on the selected boot strategy. - # In the future, each strategy could provide its own list of subvolumes (similar to what happens now - # with the required partitions for booting). With that, control files do not have to provide the - # subvolumes for booting and there is no need for removing subvolumes here. + # In the future, each strategy could provide its own list of subvolumes (similar to what + # happens now with the required partitions for booting). With that, control files do not have + # to provide the subvolumes for booting and there is no need for removing subvolumes here. @subvolumes.delete_if do |subvol| if SubvolSpecification::SUBVOL_GRUB2_ARCHS.key?(subvol.path) log.info "Removing grub2/grub2-efi specific subvolumes #{subvol.path} " \