Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
90db0c7
Remove /boot/grub2/x86_64-efi and @/boot/grub2/i386-pc for BLS systems
schubi2 Jul 8, 2025
aef99bb
test
schubi2 Jul 8, 2025
376605e
test
schubi2 Jul 8, 2025
a7ed9c8
test
schubi2 Jul 8, 2025
715f4b1
test
schubi2 Jul 8, 2025
e3f5125
test
schubi2 Jul 8, 2025
de208fc
test
schubi2 Jul 9, 2025
031ea24
test
schubi2 Jul 14, 2025
8436432
test
schubi2 Jul 14, 2025
23b3107
test
schubi2 Jul 15, 2025
bea409e
test
schubi2 Jul 15, 2025
ffe1e55
test
schubi2 Jul 15, 2025
29ff5ce
test
schubi2 Jul 15, 2025
fc29554
test
schubi2 Jul 15, 2025
007570b
test
schubi2 Jul 15, 2025
31d3ced
test
schubi2 Jul 15, 2025
8fc1b60
cleanup
schubi2 Jul 16, 2025
7b1f486
cleanup
schubi2 Jul 16, 2025
902e8f9
cleanup
schubi2 Jul 16, 2025
e900841
rubocop
schubi2 Jul 16, 2025
0d9512e
Merge branch 'master' into boot_grub2
schubi2 Jul 16, 2025
0c44f9a
packaging
schubi2 Jul 17, 2025
9e51afa
fixed testcase
schubi2 Jul 17, 2025
772c9a2
fixed testsuite
schubi2 Jul 17, 2025
3d084d5
tests
schubi2 Jul 17, 2025
01eff17
tests
schubi2 Jul 17, 2025
690f3e8
tests
schubi2 Jul 17, 2025
6557862
adapted changes
schubi2 Jul 18, 2025
703b0e8
test
schubi2 Jul 21, 2025
0128ce8
test
schubi2 Jul 21, 2025
81ce455
cleanup
schubi2 Jul 21, 2025
b06ba18
unify BLS
schubi2 Jul 22, 2025
8aa5c27
error message
schubi2 Jul 22, 2025
8c6aa6f
error message
schubi2 Jul 22, 2025
f9dab44
error message
schubi2 Jul 22, 2025
b32feeb
error message
schubi2 Jul 22, 2025
c0fc933
error message
schubi2 Jul 22, 2025
5c480d5
cleanup
schubi2 Jul 22, 2025
d89b8cc
cleanup
schubi2 Jul 22, 2025
36dabcf
cleanup
schubi2 Jul 22, 2025
86b366b
cleanup
schubi2 Jul 23, 2025
473c659
cleanup
schubi2 Jul 23, 2025
94c0f36
cleanup
schubi2 Jul 23, 2025
62e7838
cleanup
schubi2 Jul 23, 2025
2963743
cleanup
schubi2 Jul 23, 2025
00af889
cleanup
schubi2 Jul 23, 2025
0f9f7b9
cleanup
schubi2 Jul 23, 2025
9459a5e
rubocop
schubi2 Jul 23, 2025
824ddf2
fixed testcases
schubi2 Jul 23, 2025
eba2a3e
updated changes
schubi2 Jul 23, 2025
93467f9
merged with master
schubi2 Jul 28, 2025
a084728
adapt suggestion
schubi2 Aug 1, 2025
44018a1
fixed testcase
schubi2 Aug 1, 2025
d238ee0
fixed testsuite
schubi2 Aug 1, 2025
1e38d83
fixed testcase
schubi2 Aug 1, 2025
8f6828d
fixed testsuite
schubi2 Aug 1, 2025
b962109
added testcases for encryption errors
schubi2 Aug 1, 2025
ac107e0
fixed testsuite
schubi2 Aug 1, 2025
0f8f67e
added testcase
schubi2 Aug 4, 2025
22ea526
added testcase
schubi2 Aug 5, 2025
8bc8d9d
added more comments
schubi2 Aug 6, 2025
d37789a
Update test/y2storage/volume_specification_test.rb
schubi2 Aug 6, 2025
440ceeb
Update test/y2storage/setup_errors_presenter_test.rb
schubi2 Aug 6, 2025
66867b3
Update src/lib/y2storage/setup_checker.rb
schubi2 Aug 6, 2025
6c1e4c6
Update src/lib/y2storage/volume_specification.rb
schubi2 Aug 6, 2025
bb969b0
rubocop
schubi2 Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Jul 28 10:59:39 UTC 2025 - Stefan Schubert <schubi@suse.de>

- Do not generate grub2 error messages and proposals if a BLS
bootlaoder (systemd-boot/grub2-bls) bootloader is the preferred
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.35

-------------------------------------------------------------------
Thu Jul 24 10:59:19 UTC 2025 - Ancor Gonzalez Sosa <ancor@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 5.0.34
Version: 5.0.35
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
9 changes: 4 additions & 5 deletions src/lib/y2storage/boot_requirements_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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::Analyzer.bls_bootloader_proposed?
BootRequirementsStrategies::BLS
else
BootRequirementsStrategies::UEFI
end
elsif arch.s390?
BootRequirementsStrategies::ZIPL
Expand Down
12 changes: 12 additions & 0 deletions src/lib/y2storage/boot_requirements_strategies/analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/lib/y2storage/boot_requirements_strategies/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -84,7 +85,7 @@ def needed_partitions(target)
def warnings
res = []

if !boot_readable_by_grub?
if grub_warning? && !boot_readable_by_grub?
error_message =
_(
"The grub boot loader cannot access the file system mounted at /boot. " \
Expand All @@ -109,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
#
Expand Down
14 changes: 14 additions & 0 deletions src/lib/y2storage/boot_requirements_strategies/bls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ def initialize(*args)
super
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

# Checks if it makes sense to show grub warnings
#
# @return [Boolean]
def grub_warning?
false
end

protected

# @return [VolumeSpecification]
Expand Down
27 changes: 26 additions & 1 deletion src/lib/y2storage/setup_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
require "y2storage/boot_requirements_checker"
require "y2storage/proposal_settings"
require "y2storage/with_security_policies"
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
Expand Down Expand Up @@ -78,7 +79,31 @@ def errors
#
# @return [Array<SetupError>]
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
#
# Argion2* needs at least 4GiB of memory. Otherwise cryptsetup could crash (bsc#1246876).
#
# @return [Array<SetupError>]
def encryption_warnings
return [] if DiskSize.new(StorageManager.instance.arch.ram_size) >= DiskSize.GiB(4)

unless @encryption_warnings
@encryption_warnings = []
@devicegraph.encryptions
.select(&:supports_pbkdf?)
.each do |e|
next unless ["argon2id", "argon2i"].include?(e.pbkdf.value)

@encryption_warnings << SetupError.new(
message: format(_("Using %s for %s but this needs 4 GiB RAM at least."),
e.pbkdf.name, e.blk_device.name)
)
end
end
@encryption_warnings
end

# All boot errors detected in the setup
Expand Down
13 changes: 12 additions & 1 deletion src/lib/y2storage/setup_errors_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,25 @@ 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?

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
Expand Down
7 changes: 4 additions & 3 deletions src/lib/y2storage/subvol_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -244,7 +244,8 @@ 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 { |subvol| subvol.archs = SUBVOL_GRUB2_ARCHS[subvol.path] }
subvols.sort!
end

Expand Down
20 changes: 20 additions & 0 deletions src/lib/y2storage/volume_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require "y2storage/partitioning_features"
require "y2storage/subvol_specification"
require "y2storage/equal_by_instance_variables"
require "y2storage/boot_requirements_strategies/bls"

Yast.import "Kernel"

Expand All @@ -29,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
Expand Down Expand Up @@ -408,6 +410,24 @@ 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?

return unless Y2Storage::BootRequirementsStrategies::Analyzer.bls_bootloader_proposed?

# 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.
@subvolumes.delete_if do |subvol|
Comment thread
schubi2 marked this conversation as resolved.
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

def validated_fs_type(type)
Expand Down
8 changes: 5 additions & 3 deletions test/support/boot_requirements_uefi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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::Analyzer).to receive(
:bls_bootloader_proposed?
).and_return(true)
end

include_examples "EFI partition for BLS bootloaders"
Expand Down
7 changes: 4 additions & 3 deletions test/y2storage/boot_requirements_checker_aarch64_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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::Analyzer).to receive(
:bls_bootloader_proposed?
).and_return(false)
end

include_examples "minimalistic EFI partition"
Expand Down
4 changes: 4 additions & 0 deletions test/y2storage/boot_requirements_checker_raspi_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/y2storage/boot_requirements_checker_x86_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading