X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=proxinstall;h=f8bef528ce09bd520aa7e9fb57a5abfeb07fdb5b;hb=5ea943cf82901e77acb66661f636ba03ce771404;hp=956661d5e3f3fca81e8c63cddebdbdfdb2588120;hpb=cd2d2a275d6fbfb7a821e4a6e79b5ece19e13e05;p=pve-installer.git diff --git a/proxinstall b/proxinstall index 956661d..f8bef52 100755 --- a/proxinstall +++ b/proxinstall @@ -18,6 +18,7 @@ use Encode; use String::ShellQuote; use Data::Dumper; use File::Basename; +use File::Path; use Time::HiRes; use ProxmoxInstallerSetup; @@ -39,6 +40,11 @@ my $zfstestpool = "test_rpool"; my $zfspoolname = $opt_testmode ? $zfstestpool : 'rpool'; my $zfsrootvolname = "$setup->{product}-1"; +my $product_fullname = { + pve => 'Proxmox VE', + pmg => 'Proxmox MailGateway', +}; + my $storage_cfg_zfs = <<__EOD__; dir: local path /var/lib/vz @@ -96,9 +102,7 @@ my $proxmox_libdir = $opt_testmode ? my $proxmox_cddir = $opt_testmode ? "../pve-cd-builder/tmp/data-gz/" : "/cdrom"; my $proxmox_pkgdir = "${proxmox_cddir}/proxmox/packages/"; -my $grub_plattform = "pc"; # pc, efi-amd64 or efi-ia32 - -$grub_plattform = "efi-amd64" if -d "/sys/firmware/efi"; +my $boot_type = -d '/sys/firmware/efi' ? 'efi' : 'bios'; my $IPV4OCTET = "(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9])?[0-9])"; my $IPV4RE = "(?:(?:$IPV4OCTET\\.){3}$IPV4OCTET)"; @@ -324,6 +328,8 @@ mynetworks = 127.0.0.0/8 inet_interfaces = loopback-only recipient_delimiter = + +compatibility_level = 2 + _EOD sub shellquote { @@ -562,7 +568,7 @@ sub hd_list { my @disks = split /,/, $opt_testmode; for my $disk (@disks) { - push @$res, [-1, $disk, int((-s $disk)/512), "TESTDISK"]; + push @$res, [-1, $disk, int((-s $disk)/512), "TESTDISK", 512]; } return $res; } @@ -588,6 +594,7 @@ sub hd_list { next if $info !~ m/^E: DEVTYPE=disk$/m; next if $info =~ m/^E: ID_CDROM/m; + next if $info =~ m/^E: ID_FS_TYPE=iso9660/m; my ($name) = $info =~ m/^N: (\S+)$/m; @@ -604,7 +611,12 @@ sub hd_list { if (length ($model) > 30) { $model = substr ($model, 0, 30); } - push @$res, [$count++, $real_name, $size, $model] if $size; + + my $logical_bsize = file_read_firstline("$bd/queue/logical_block_size") // ''; + chomp $logical_bsize; + $logical_bsize = undef if !($logical_bsize && $logical_bsize =~ m/^\d+$/); + + push @$res, [$count++, $real_name, $size, $model, $logical_bsize] if $size; } else { print STDERR "ERROR: unable to map device $dev ($bd)\n"; } @@ -615,7 +627,7 @@ sub hd_list { sub read_cmap { my $countryfn = "${proxmox_libdir}/country.dat"; - open (TMP, "<$countryfn") || die "unable to open '$countryfn' - $!\n"; + open (TMP, "<:encoding(utf8)", "$countryfn") || die "unable to open '$countryfn' - $!\n"; my $line; my $country = {}; my $countryhash = {}; @@ -678,14 +690,25 @@ sub hd_size { my ($dev) = @_; foreach my $hd (@$hds) { - my ($disk, $devname, $size, $model) = @$hd; - # size is always in 512B "sectors"! convert to KB + my ($disk, $devname, $size, $model, $logical_bsize) = @$hd; + # size is always (also for 4kn disks) in 512B "sectors"! convert to KB return int($size/2) if $devname eq $dev; } die "no such device '$dev'\n"; } +sub logical_blocksize { + my ($dev) = @_; + + foreach my $hd (@$hds) { + my ($disk, $devname, $size, $model, $logical_bsize) = @$hd; + return $logical_bsize if $devname eq $dev; + } + + die "no such device '$dev'\n"; +} + sub get_partition_dev { my ($dev, $partnum) = @_; @@ -901,6 +924,7 @@ my $clean_disk = sub { next if $part eq $disk; next if $part !~ /^\Q$disk\E/; eval { syscmd("pvremove -ff -y $part"); }; + eval { syscmd("zpool labelclear -f $part"); }; eval { syscmd("dd if=/dev/zero of=$part bs=1M count=16"); }; } }; @@ -951,11 +975,15 @@ sub partition_bootable_disk { syscmd($pcmd) == 0 || die "unable to partition harddisk '${target_dev}'\n"; - $pnum = 1; - $pcmd = ['sgdisk', '-a1', "-n$pnum:34:2047", "-t$pnum:EF02" , $target_dev]; + my $blocksize = logical_blocksize($target_dev); - syscmd($pcmd) == 0 || - die "unable to create bios_boot partition '${target_dev}'\n"; + if ($blocksize != 4096) { + $pnum = 1; + $pcmd = ['sgdisk', '-a1', "-n$pnum:34:2047", "-t$pnum:EF02" , $target_dev]; + + syscmd($pcmd) == 0 || + die "unable to create bios_boot partition '${target_dev}'\n"; + } &$udevadm_trigger_block(); @@ -966,11 +994,78 @@ sub partition_bootable_disk { return ($os_size, $osdev, $efibootdev); } +sub get_pv_list_from_vgname { + my ($vgname) = @_; + + my $res; + + my $parser = sub { + my $line = shift; + $line =~ s/^\s+//; + $line =~ s/\s+$//; + return if !$line; + my ($pv, $vg_uuid) = split(/\s+/, $line); + + if (!defined($res->{$vg_uuid}->{pvs})) { + $res->{$vg_uuid}->{pvs} = "$pv"; + } else { + $res->{$vg_uuid}->{pvs} .= ", $pv"; + } + }; + run_command("pvs --noheadings -o pv_name,vg_uuid -S vg_name='$vgname'", $parser, undef, 1); + + return $res; +} + +sub ask_existing_vg_rename_or_abort { + my ($vgname) = @_; + + # this normally only happens if one put a disk with a PVE installation in + # this server and that disk is not the installation target. + my $duplicate_vgs = get_pv_list_from_vgname($vgname); + return if !$duplicate_vgs; + + my $message = "Detected existing '$vgname' Volume Group(s)! Do you want to:\n"; + + for my $vg_uuid (keys %$duplicate_vgs) { + my $vg = $duplicate_vgs->{$vg_uuid}; + + # no high randomnes properties, but this is only for the cases where + # we either have multiple "$vgname" vgs from multiple old PVE disks, or + # we have a disk with both a "$vgname" and "$vgname-old"... + my $short_uid = sprintf "%08X", rand(0xffffffff); + $vg->{new_vgname} = "$vgname-OLD-$short_uid"; + + $message .= "rename VG backed by PV '$vg->{pvs}' to '$vg->{new_vgname}'\n"; + } + $message .= "or cancel the installation?"; + + my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'question', 'ok-cancel', $message); + my $response = $dialog->run(); + $dialog->destroy(); + + if ($response eq 'ok') { + for my $vg_uuid (keys %$duplicate_vgs) { + my $vg = $duplicate_vgs->{$vg_uuid}; + my $new_vgname = $vg->{new_vgname}; + + syscmd("vgrename $vg_uuid $new_vgname") == 0 || + die "could not rename VG from '$vg->{pvs}' ($vg_uuid) to '$new_vgname'!\n"; + } + } else { + set_next("_Reboot", sub { exit (0); } ); + display_html("fail.htm"); + die "Cancled installation by user, due to already existing volume group '$vgname'\n"; + } +} + sub create_lvm_volumes { my ($lvmdev, $os_size, $swap_size) = @_; my $vgname = $setup->{product}; + ask_existing_vg_rename_or_abort($vgname); + my $rootdev = "/dev/$vgname/root"; my $datadev = "/dev/$vgname/data"; my $swapfile; @@ -1078,6 +1173,43 @@ sub compute_swapsize { return $swapsize; } +sub prepare_systemd_boot_esp { + my ($espdev, $targetdir) = @_; + + syscmd("chroot $targetdir pve-efiboot-tool init $espdev") == 0 || + die "unable to init ESP and install systemd-boot loader on '$espdev'\n"; +} + +sub prepare_grub_efi_boot_esp { + my ($dev, $espdev, $targetdir) = @_; + + syscmd("mount -n $espdev -t vfat $targetdir/boot/efi") == 0 || + die "unable to mount $espdev\n"; + + eval { + my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target x86_64-efi --no-floppy --bootloader-id='proxmox' $dev"); + if ($rc != 0) { + if ($boot_type eq 'efi') { + die "unable to install the EFI boot loader on '$dev'\n"; + } else { + warn "unable to install the EFI boot loader on '$dev', ignoring (not booted using UEFI)\n"; + } + } + # also install fallback boot file (OVMF does not boot without) + mkdir("$targetdir/boot/efi/EFI/BOOT"); + syscmd("cp $targetdir/boot/efi/EFI/proxmox/grubx64.efi $targetdir/boot/efi/EFI/BOOT/BOOTx64.EFI") == 0 || + die "unable to copy efi boot loader\n"; + }; + my $err = $@; + + eval { + syscmd("umount $targetdir/boot/efi") == 0 || + die "unable to umount $targetdir/boot/efi\n"; + }; + warn $@ if $@; + + die "failed to prepare EFI boot using Grub on '$espdev': $err" if $err; +} sub extract_data { my ($basefile, $targetdir) = @_; @@ -1117,6 +1249,8 @@ sub extract_data { die "unable to load zfs kernel module\n" if !$i; } + my $bootloader_err; + eval { @@ -1159,13 +1293,20 @@ sub extract_data { my $disksize; foreach my $hd (@$devlist) { my $devname = @$hd[1]; + my $logical_bsize = @$hd[4]; + &$clean_disk($devname); my ($size, $osdev, $efidev) = partition_bootable_disk($devname, undef, '8300'); $rootdev = $osdev if !defined($rootdev); # simply point to first disk my $by_id = find_stable_path("/dev/disk/by-id", $devname); - push @$bootdevinfo, { esp => $efidev, devname => $devname, - osdev => $osdev, by_id => $by_id }; + push @$bootdevinfo, { + esp => $efidev, + devname => $devname, + osdev => $osdev, + by_id => $by_id, + logical_bsize => $logical_bsize, + }; push @$btrfs_partitions, $osdev; $disksize = $size; } @@ -1178,17 +1319,26 @@ sub extract_data { my ($devlist, $bootdevlist, $vdev) = get_zfs_raid_setup(); - my $disksize; foreach my $hd (@$devlist) { &$clean_disk(@$hd[1]); } + + my $disksize; foreach my $hd (@$bootdevlist) { my $devname = @$hd[1]; + my $logical_bsize = @$hd[4]; - my ($size, $osdev) = + my ($size, $osdev, $efidev) = partition_bootable_disk($devname, $config_options->{hdsize}, 'BF01'); + zfs_mirror_size_check($disksize, $size) if $disksize; - push @$bootdevinfo, { devname => $devname, osdev => $osdev}; + + push @$bootdevinfo, { + esp => $efidev, + devname => $devname, + osdev => $osdev, + logical_bsize => $logical_bsize, + }; $disksize = $size; } @@ -1198,11 +1348,8 @@ sub extract_data { my $devname = $di->{devname}; $di->{by_id} = find_stable_path ("/dev/disk/by-id", $devname); - # Note: using /dev/disk/by-id/ does not work for unknown reason, we get - # cannot create 'rpool': no such pool or dataset - #my $osdev = find_stable_path ("/dev/disk/by-id", $di->{osdev}) || $di->{osdev}; + my $osdev = find_stable_path ("/dev/disk/by-id", $di->{osdev}) || $di->{osdev}; - my $osdev = $di->{osdev}; $vdev =~ s/ $devname/ $osdev/; } @@ -1214,6 +1361,8 @@ sub extract_data { &$clean_disk($target_hd); + my $logical_bsize = logical_blocksize($target_hd); + my ($os_size, $osdev, $efidev); ($os_size, $osdev, $efidev) = partition_bootable_disk($target_hd, $config_options->{hdsize}, '8E00'); @@ -1221,8 +1370,13 @@ sub extract_data { &$udevadm_trigger_block(); my $by_id = find_stable_path ("/dev/disk/by-id", $target_hd); - push @$bootdevinfo, { esp => $efidev, devname => $target_hd, - osdev => $osdev, by_id => $by_id }; + push @$bootdevinfo, { + esp => $efidev, + devname => $target_hd, + osdev => $osdev, + by_id => $by_id, + logical_bsize => $logical_bsize, + }; my $swap_size = compute_swapsize($os_size); ($rootdev, $swapfile, $datadev) = @@ -1248,7 +1402,8 @@ sub extract_data { foreach my $di (@$bootdevinfo) { next if !$di->{esp}; - syscmd("mkfs.vfat -F32 $di->{esp}") == 0 || + my $vfat_extra_opts = ($di->{logical_bsize} == 4096) ? '-s1' : ''; + syscmd("mkfs.vfat $vfat_extra_opts -F32 $di->{esp}") == 0 || die "unable to initialize EFI ESP on device $di->{esp}\n"; } @@ -1323,6 +1478,10 @@ sub extract_data { die "unable to mount proc on $targetdir/proc\n"; syscmd("mount -n -t sysfs sysfs $targetdir/sys") == 0 || die "unable to mount sysfs on $targetdir/sys\n"; + if ($boot_type eq 'efi') { + syscmd("mount -n -t efivarfs efivarfs $targetdir/sys/firmware/efi/efivars") == 0 || + die "unable to mount efivarfs on $targetdir/sys/firmware/efi/efivars: $!\n"; + } syscmd("chroot $targetdir mount --bind /mnt/hostrun /run") == 0 || die "unable to re-bindmount hostrun on /run in chroot\n"; @@ -1417,9 +1576,10 @@ sub extract_data { # Note: this is required by current grub, but really dangerous, because # vfat does not have journaling, so it triggers manual fsck after each crash # so we only mount /boot/efi if really required (efi systems). - if ($grub_plattform =~ m/^efi-/) { + if ($boot_type eq 'efi' && !$use_zfs) { if (scalar(@$bootdevinfo)) { my $di = @$bootdevinfo[0]; # simply use first disk + if ($di->{esp}) { my $efi_boot_uuid = $di->{esp}; if (my $uuid = find_dev_by_uuid ($di->{esp})) { @@ -1450,6 +1610,13 @@ sub extract_data { diversion_add($targetdir, "/usr/sbin/update-grub", "/bin/true"); diversion_add($targetdir, "/usr/sbin/update-initramfs", "/bin/true"); + my $machine_id = run_command("systemd-id128 new"); + die "unable to create a new machine-id\n" if ! $machine_id; + write_config($machine_id, "$targetdir/etc/machine-id"); + + syscmd("cp /etc/hostid $targetdir/etc/") == 0 || + die "unable to copy hostid\n"; + syscmd("touch $targetdir/proxmox_install_mode"); my $grub_install_devices_txt = ''; @@ -1483,10 +1650,6 @@ _EOD chomp; my $path = $_; my ($deb) = $path =~ m/${proxmox_pkgdir}\/(.*\.deb)/; -# if ($deb =~ m/^grub-efi-/ && $deb !~ m/^grub-${grub_plattform}/) { -# $count++; -# next; -# } update_progress($count/$pkg_count, 0.5, 0.75, "extracting $deb"); print "extracting: $deb\n"; syscmd("cp $path $targetdir/tmp/$deb") == 0 || @@ -1517,6 +1680,8 @@ _EOD syscmd("chroot $targetdir /usr/sbin/postfix check"); # cleanup mail queue syscmd("chroot $targetdir /usr/sbin/postsuper -d ALL"); + # create /etc/aliases.db (/etc/aliases is shipped in the base squashfs) + syscmd("chroot $targetdir /usr/bin/newaliases"); # enable NTP (timedatectl set-ntp true does not work without DBUS) syscmd("chroot $targetdir /bin/systemctl enable systemd-timesyncd.service"); @@ -1564,6 +1729,10 @@ _EOD syscmd("sed -i -e 's/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"root=ZFS=$zfspoolname\\/ROOT\\/$zfsrootvolname boot=zfs\"/' $targetdir/etc/default/grub") == 0 || die "unable to update /etc/default/grub\n"; + if ($boot_type eq 'efi') { + write_config("root=ZFS=$zfspoolname/ROOT/$zfsrootvolname boot=zfs", "$targetdir/etc/kernel/cmdline"); + } + } diversion_remove($targetdir, "/usr/sbin/update-grub"); @@ -1584,37 +1753,48 @@ _EOD symlink ("/proc/mounts", "$targetdir/etc/mtab"); syscmd("mount -n --bind /dev $targetdir/dev"); - syscmd("chroot $targetdir /usr/sbin/update-initramfs -c -k $kapi") == 0 || - die "unable to install initramfs\n"; + my $bootloader_err_list = []; + eval { + syscmd("chroot $targetdir /usr/sbin/update-initramfs -c -k $kapi") == 0 || + die "unable to install initramfs\n"; - foreach my $di (@$bootdevinfo) { - my $dev = $di->{devname}; - syscmd("chroot $targetdir /usr/sbin/grub-install --target i386-pc --no-floppy --bootloader-id='proxmox' $dev") == 0 || - die "unable to install the i386-pc boot loader on '$dev'\n"; + my $native_4k_disk_bootable = 0; + foreach my $di (@$bootdevinfo) { + $native_4k_disk_bootable |= ($di->{logical_bsize} == 4096); + } - if ($di->{esp}) { - syscmd("mount -n $di->{esp} -t vfat $targetdir/boot/efi") == 0 || - die "unable to mount $di->{esp}\n"; - my $rc = syscmd("chroot $targetdir /usr/sbin/grub-install --target x86_64-efi --no-floppy --bootloader-id='proxmox' $dev"); - if ($rc != 0) { - if (-d '/sys/firmware/efi') { - die "unable to install the EFI boot loader on '$dev'\n"; - } else { - warn "unable to install the EFI boot loader on '$dev', ignoring (not booted using UEFI)\n"; - } + foreach my $di (@$bootdevinfo) { + my $dev = $di->{devname}; + if (!$native_4k_disk_bootable) { + eval { + syscmd("chroot $targetdir /usr/sbin/grub-install --target i386-pc --no-floppy --bootloader-id='proxmox' $dev") == 0 || + die "unable to install the i386-pc boot loader on '$dev'\n"; + }; + push @$bootloader_err_list, $@ if $@; } - # also install fallback boot file (OVMF does not boot without) - mkdir("$targetdir/boot/efi/EFI/BOOT"); - syscmd("cp $targetdir/boot/efi/EFI/proxmox/grubx64.efi $targetdir/boot/efi/EFI/BOOT/BOOTx64.EFI") == 0 || - die "unable to copy efi boot loader\n"; - syscmd("umount $targetdir/boot/efi") == 0 || - die "unable to umount $targetdir/boot/efi\n"; + eval { + if (my $esp = $di->{esp}) { + if ($use_zfs) { + prepare_systemd_boot_esp($esp, $targetdir); + } else { + prepare_grub_efi_boot_esp($dev, $esp, $targetdir); + } + } + }; + push @$bootloader_err_list, $@ if $@; } - } - syscmd("chroot $targetdir /usr/sbin/update-grub") == 0 || - die "unable to update boot loader config\n"; + syscmd("chroot $targetdir /usr/sbin/update-grub") == 0 || + die "unable to update boot loader config\n"; + }; + push @$bootloader_err_list, $@ if $@; + + if (scalar(@$bootloader_err_list) > 0) { + $bootloader_err = "bootloader setup errors:\n"; + map { $bootloader_err .= "- $_" } @$bootloader_err_list; + warn $bootloader_err; + } syscmd("umount $targetdir/dev"); } @@ -1686,6 +1866,7 @@ _EOD syscmd("umount $targetdir/mnt/hostrun"); syscmd("umount $targetdir/tmp"); syscmd("umount $targetdir/proc"); + syscmd("umount $targetdir/sys/firmware/efi/efivars"); syscmd("umount $targetdir/sys"); if ($use_zfs) { @@ -1707,6 +1888,10 @@ _EOD syscmd("zpool export $zfspoolname"); } + if ($bootloader_err) { + $err = $err ? "$err\n$bootloader_err" : $bootloader_err; + } + die $err if $err; } @@ -1756,6 +1941,9 @@ sub display_html { my $title = "END USER LICENSE AGREEMENT (EULA)"; $data =~ s/__LICENSE__/$license/; $data =~ s/__LICENSE_TITLE__/$title/; + } elsif ($filename eq 'success.htm') { + my $addr = $ipversion == 6 ? "[${ipaddress}]" : "$ipaddress"; + $data =~ s/\@IPADDR\@/$addr/; } $htmlview->load_html($data, $url); @@ -2617,7 +2805,7 @@ my $create_raid_disk_grid = sub { $disk_selector->set_active(0); $disk_selector->set_visible(1); foreach my $hd (@$hds) { - my ($disk, $devname, $size, $model) = @$hd; + my ($disk, $devname, $size, $model, $logical_bsize) = @$hd; $disk_selector->append_text(get_device_desc ($devname, $size, $model)); $disk_selector->{pve_disk_id} = $i; $disk_selector->signal_connect (changed => sub { @@ -2793,6 +2981,12 @@ sub create_hdoption_view { $grid->attach($sep, 0, $row, 2, 1); $row++; + my $hw_raid_note = Gtk3::Label->new("Note: ZFS is not compatible with disks backed by a hardware RAID controller. For details see the reference documentation."); + $hw_raid_note->set_line_wrap(1); + $hw_raid_note->set_max_width_chars(30); + $hw_raid_note->set_visible(0); + $grid->attach($hw_raid_note, 0, $row++, 2, 1); + my $hdsize_labeled_widgets = []; # size compute @@ -2860,6 +3054,7 @@ sub create_hdoption_view { $target_hd_combo->set_visible(!$raid); $options_stack->get_child_by_name("hdsize")->set_visible(!$raid); $options_stack->get_child_by_name("raiddisk")->set_visible($raid); + $hw_raid_note->set_visible($raid); $options_stack_switcher->set_visible($enable_zfs_opts); $options_stack->get_child_by_name("raidzfsadvanced")->set_visible($enable_zfs_opts); if ($raid) { @@ -2881,6 +3076,10 @@ sub create_hdoption_view { &$switch_view(); }); + my $sep2 = Gtk3::HSeparator->new(); + $sep2->set_visible(1); + $contarea->pack_end($sep2, 1, 1, 10); + $dialog->show(); $dialog->run(); @@ -2941,7 +3140,7 @@ my $get_raid_devlist = sub { my $devlist = []; for (my $i = 0; $i < @$hds; $i++) { if (my $hd = $config_options->{"disksel$i"}) { - my ($disk, $devname, $size, $model) = @$hd; + my ($disk, $devname, $size, $model, $logical_bsize) = @$hd; die "device '$devname' is used more than once\n" if $dev_name_hash->{$devname}; $dev_name_hash->{$devname} = $hd; @@ -2959,6 +3158,12 @@ sub zfs_mirror_size_check { if abs($expected - $actual) > $expected / 10; } +sub legacy_bios_4k_check { + my ($lbs) = @_; + die "Booting from 4kn drive in legacy BIOS mode is not supported.\n" + if (($boot_type ne 'efi') && ($lbs == 4096)); +} + sub get_zfs_raid_setup { my $filesys = $config_options->{filesys}; @@ -2974,6 +3179,7 @@ sub get_zfs_raid_setup { if ($filesys eq 'zfs (RAID0)') { push @$bootdevlist, @$devlist[0]; foreach my $hd (@$devlist) { + legacy_bios_4k_check(@$hd[4]); $cmd .= " @$hd[1]"; } } elsif ($filesys eq 'zfs (RAID1)') { @@ -2983,6 +3189,7 @@ sub get_zfs_raid_setup { my $expected_size = @$hd[2]; # all disks need approximately same size foreach $hd (@$devlist) { zfs_mirror_size_check($expected_size, @$hd[2]); + legacy_bios_4k_check(@$hd[4]); $cmd .= " @$hd[1]"; push @$bootdevlist, $hd; } @@ -2996,6 +3203,8 @@ sub get_zfs_raid_setup { my $hd1 = @$devlist[$i]; my $hd2 = @$devlist[$i+1]; zfs_mirror_size_check(@$hd1[2], @$hd2[2]); # pairs need approximately same size + legacy_bios_4k_check(@$hd1[4]); + legacy_bios_4k_check(@$hd2[4]); $cmd .= ' mirror ' . @$hd1[1] . ' ' . @$hd2[1]; } @@ -3008,6 +3217,7 @@ sub get_zfs_raid_setup { $cmd .= " raidz$level"; foreach $hd (@$devlist) { zfs_mirror_size_check($expected_size, @$hd[2]); + legacy_bios_4k_check(@$hd[4]); $cmd .= " @$hd[1]"; push @$bootdevlist, $hd; } @@ -3060,7 +3270,7 @@ sub create_hdsel_view { my $hbox = Gtk3::HBox->new(0, 0); $vbox->pack_start($hbox, 0, 0, 10); - my ($disk, $devname, $size, $model) = @{@$hds[0]}; + my ($disk, $devname, $size, $model, $logical_bsize) = @{@$hds[0]}; $target_hd = $devname if !defined($target_hd); $target_hd_label = Gtk3::Label->new("Target Harddisk: "); @@ -3069,7 +3279,7 @@ sub create_hdsel_view { $target_hd_combo = Gtk3::ComboBoxText->new(); foreach my $hd (@$hds) { - ($disk, $devname, $size, $model) = @$hd; + ($disk, $devname, $size, $model, $logical_bsize) = @$hd; $target_hd_combo->append_text (get_device_desc($devname, $size, $model)); } @@ -3115,6 +3325,11 @@ sub create_hdsel_view { } $config_options->{target_hds} = [ map { $_->[1] } @$devlist ]; } else { + eval { legacy_bios_4k_check(logical_blocksize($target_hd)) }; + if (my $err = $@) { + display_message("Warning: $err\n"); + return; + } $config_options->{target_hds} = [ $target_hd ]; } @@ -3178,11 +3393,18 @@ sub create_intro_view { cleanup_view(); + if (int($total_memory) < 1024) { + my $fullname = $product_fullname->{$setup->{product}}; + + display_error("Less than 1 GiB of usable memory detected, installation will probably fail.\n\n". + "See 'System Requirements' in the $fullname documentation."); + } + if ($setup->{product} eq 'pve') { eval { my $cpuinfo = file_get_contents('/proc/cpuinfo'); if ($cpuinfo && !($cpuinfo =~ /^flags\s*:.*(vmx|svm)/m)) { - display_error("No support for KVM virtualisation detected.\n\n" . + display_error("No support for KVM virtualization detected.\n\n" . "Check BIOS settings for Intel VT / AMD-V / SVM.") } };