mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-28 13:22:16 +00:00
705d199c4b
An Ubuntu 26.04 diskless node freezes in the initial ramdisk:
systemd[1]: Failed to isolate default target: Unit rescue.service not found.
systemd[1]: Freezing execution.
The netboot dracut.conf names an exclusive module list, "xcat nfs base
network kernel-modules". dracut-ng, which resolute ships as dracut 110,
removed the network-legacy module, so 40network selects systemd-networkd,
which depends on the systemd module. The base module then skips the shell
/init, and systemd becomes /init. The list names neither systemd-initrd nor
dracut-systemd, so the initial ramdisk holds no initrd.target.
Move the list into imgutils::dracut_netboot_modules, which takes the image
module directory and returns the list, and call it from both dracut.conf
writes in the Ubuntu genimage. The new
xCAT-test/unit/imgutils_dracut_netboot_modules.t holds the noble list down
and asks for the systemd modules on a dracut that has no network-legacy.
Three of its six assertions fail on this commit.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
67 lines
2.7 KiB
Perl
67 lines
2.7 KiB
Perl
#!/usr/bin/env perl
|
|
use strict;
|
|
use warnings;
|
|
use FindBin;
|
|
use File::Path qw(make_path);
|
|
use File::Temp qw(tempdir);
|
|
use lib "$FindBin::Bin/../../perl-xCAT";
|
|
use lib "$FindBin::Bin/../../xCAT-server/lib/perl";
|
|
use lib "$FindBin::Bin/../../xCAT-server/share/xcat/netboot/imgutils";
|
|
use Test::More;
|
|
use imgutils;
|
|
|
|
# Builds a modules.d that holds the named dracut modules and nothing else.
|
|
sub modules_dir {
|
|
my (@modules) = @_;
|
|
my $dir = tempdir(CLEANUP => 1);
|
|
make_path("$dir/$_") for @modules;
|
|
return $dir;
|
|
}
|
|
|
|
# dracut 060 on noble. 40network takes network-legacy, so dracut writes the shell /init.
|
|
{
|
|
my $dir = modules_dir(qw(35network-legacy 10systemd 11systemd-initrd 77dracut-systemd 97xcat));
|
|
is(imgutils::dracut_netboot_modules($dir, 0), 'xcat nfs base network-legacy kernel-modules',
|
|
'a dracut that holds network-legacy keeps the module list it had');
|
|
}
|
|
|
|
# dracut 110 on resolute. network-legacy is gone, so 40network takes systemd-networkd and dracut
|
|
# writes systemd as /init. systemd needs initrd.target, which the systemd-initrd module installs.
|
|
{
|
|
my $dir = modules_dir(qw(10systemd 11systemd-initrd 77dracut-systemd 40network 74nfs 97xcat));
|
|
is(imgutils::dracut_netboot_modules($dir, 0),
|
|
'xcat nfs base network kernel-modules systemd systemd-initrd dracut-systemd',
|
|
'a dracut without network-legacy gets the systemd modules its initial ramdisk needs');
|
|
}
|
|
|
|
# The module names carry no version prefix, so a number the next dracut picks must not matter.
|
|
{
|
|
my $dir = modules_dir(qw(00systemd 01systemd-initrd 98dracut-systemd 97xcat));
|
|
is(imgutils::dracut_netboot_modules($dir, 0),
|
|
'xcat nfs base network kernel-modules systemd systemd-initrd dracut-systemd',
|
|
'the systemd modules are found under the numbers an older dracut uses');
|
|
}
|
|
|
|
# A module that is not in the image cannot be put in the list.
|
|
{
|
|
my $dir = modules_dir(qw(10systemd 97xcat));
|
|
is(imgutils::dracut_netboot_modules($dir, 0), 'xcat nfs base network kernel-modules systemd',
|
|
'only the systemd modules the image holds are named');
|
|
}
|
|
|
|
# 35network-legacy requires wicked, which a Debian image does not have.
|
|
{
|
|
my $dir = modules_dir(qw(35network-legacy 10systemd 11systemd-initrd 77dracut-systemd 97xcat));
|
|
is(imgutils::dracut_netboot_modules($dir, 1), 'xcat nfs base network kernel-modules',
|
|
'an image with wicked keeps the network module and the list it had');
|
|
}
|
|
|
|
# genimage calls this before dracut runs, and the path comes from the image.
|
|
{
|
|
my $dir = tempdir(CLEANUP => 1);
|
|
is(imgutils::dracut_netboot_modules("$dir/absent", 0), 'xcat nfs base network kernel-modules',
|
|
'a modules directory that does not exist returns the plain list');
|
|
}
|
|
|
|
done_testing();
|