Package: fai-setup-storage
Version: 6.0.3
Severity: important
(setup-storage identifies itself as 6.0.3; to be precise it's the
version pre-installed in the faicd64-ubuntu-only_6.0.3.iso
CD image. The bug was also present in 5.10.1/faicd64-ubuntu-only_5.10.1+3.iso
but we were too harried back then to remember to report the problem;
sorry about that.)
Setup-storage expects a numeric /dev/mdN device to have at least
three digits: /dev/md123 or /dev/md000 is expected, /dev/md0 or
/dev/md12 is not. It's mistaken: /dev/md0 and /dev/md12 (and any
md device with one or two digits) are valid to Linux.
The effect is that if told to partition /dev/md0, setup-storage
doesn't understand that partition 1 on that device is /dev/md0p1;
it tries /dev/md01. That in turn is diagnosed as an invalid
device name; setup-storage aborts; so does the install.
The problem seems to be in two regexps in setup-storage/Init.pm,
which use md\d{3,} (i.e. match three or more digits). I worked
around the problem by changing it to md\d+ (i.e. one or more digits).
Maybe what was originally intended was md\d{1,3} (at least one digit,
at most three), and that would work for now because (as I understand
it) the current md implementation can't handle more than 512 arrays;
but it seems wiser to lift the limit as future-proofing.
Here's a diff -c showing what I did to get our installs working:
*** Init.pm.stock Wed Aug 23 13:51:21 2023
--- Init.pm Wed Aug 23 13:52:14 2023
***
*** 207,213
return (1, "/dev/$1", $2);
}
elsif ($dev =~
!
m{^/dev/(loop\d+|cciss/c\d+d\d+|ida/c\d+d\d+|md\d{3,}|md/\w+\d*|rd/c\d+d\d+|ataraid/d\d+|etherd/e\d+\.\d+|nvme\d+n\d+|mmcblk\d+)(p(\d+))?$})
{
defined($2) or return (1, "/dev/$1", -1);
return (1, "/dev/$1", $3);
--- 207,213
return (1, "/dev/$1", $2);
}
elsif ($dev =~
!
m{^/dev/(loop\d+|cciss/c\d+d\d+|ida/c\d+d\d+|md\d+|md/\w+\d*|rd/c\d+d\d+|ataraid/d\d+|etherd/e\d+\.\d+|nvme\d+n\d+|mmcblk\d+)(p(\d+))?$})
{
defined($2) or return (1, "/dev/$1", -1);
return (1, "/dev/$1", $3);
***
*** 289,295
sub make_device_name {
my ($dev, $p) = @_;
$dev .= "p" if ($dev =~
!
m{^/dev/(loop\d+|cciss/c\d+d\d+|ida/c\d+d\d+|md\d{3,}|md/\w+\d*|rd/c\d+d\d+|ataraid/d\d+|etherd/e\d+\.\d+|nvme\d+n1|mmcblk\d+)$});
$dev .= $p;
internal_error("Invalid device $dev") unless (::phys_dev($dev))[0];
return $dev;
--- 289,295
sub make_device_name {
my ($dev, $p) = @_;
$dev .= "p" if ($dev =~
!
m{^/dev/(loop\d+|cciss/c\d+d\d+|ida/c\d+d\d+|md\d+|md/\w+\d*|rd/c\d+d\d+|ataraid/d\d+|etherd/e\d+\.\d+|nvme\d+n1|mmcblk\d+)$});
$dev .= $p;
internal_error("Invalid device $dev") unless (::phys_dev($dev))[0];
return $dev;
And here's a snippet from fai.log showing the original error.
We have a hooks/partition.CLASS that initializes the md (after
using some local heuristics to decide which disks may be used
safely), then sets disklist=/dev/md, then returns to task_partition
which (with the original Init.pm) complaints and aborts:
Starting setup-storage 3.0
Using config file: /var/lib/fai/config/disk_config/UBUNTU_22_04
INTERNAL ERROR in setup-storage:
Invalid device /dev/md01
Please report this error to the Debian Bug Tracking System.
at /usr/share/fai/setup-storage/Init.pm line 294, <$config_file> line 1.
FAI::make_device_name("/dev/md0", 1) called at
/usr/share/fai/setup-storage/Parser.pm line 318
FAI::init_part_config("primary") called at (eval 86) line 7624
Parse::RecDescent::namespace01::type(Parse::RecDescent=HASH(0x560538a6c6c8),
"primary\x{9}/\x{9}72000\x{9}ext4\x{9}rw,errors=remount-ro\x{9}createopts=\"-m3\"\x{a}pr"...,
1, undef, CODE(0x5605393d1048), undef) called at (eval 86) line 9569
Parse::RecDescent::namespace01::volume(Parse::RecDescent=HASH(0x560538a6c6c8),
"primary\x{9}/\x{9}72000\x{9}ext4\x{9}rw,errors=remount-ro\x{9}createopts=\"-m3\"\x{a}pr"...,
1, undef, CODE(0x5605393e24b0), undef) called at (eval 86) line 716
Parse::RecDescent::namespace01::config(Parse::RecDescent=HASH(0x560538a6c6c8),
"primary\x{9}/\x{9}72000\x{9}ext4\x{9}rw,errors=remount-ro\x{9}createopts=\"-m3\"\x{a}pr"...,
1, undef, CODE(0x5605393d0030), undef) called at (eval 86) line 3373
Parse::RecDescent::namespace01::line(Parse::RecDescent=HASH(0x560538a6c6c8),
"primary\x{9}/\x{9}72000\x{9}ext4\x{9}rw,errors=remount-ro\x{9}createopts=\"-m3\"\x{a}pr"...,
1, undef, CODE(0x5605392109a0), undef) called at
/usr/share/perl5/Parse/RecDescent.pm line 3275
Parse::RecDescent::_parserepeat(Parse::RecDescent=HASH(0x560538a6c6c8),
"# \$Header: /admin/cvsroot/debian/FAI/fai/disk_config/UBUNTU_2"...,
CODE(0x560538bc8920), 0, 1, undef,
Parse::RecDescent::Expectation=HASH(0x5605393d1f70), CODE(0x5605392109a0), ...)
called at (eval 86) line 2621