From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <c.heiss@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id AAF82BAB0
 for <pve-devel@lists.proxmox.com>; Thu, 10 Aug 2023 12:33:25 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 96F6F1F9FE
 for <pve-devel@lists.proxmox.com>; Thu, 10 Aug 2023 12:33:25 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu, 10 Aug 2023 12:33:24 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9A69843EA8
 for <pve-devel@lists.proxmox.com>; Thu, 10 Aug 2023 12:33:24 +0200 (CEST)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu, 10 Aug 2023 12:31:55 +0200
Message-ID: <20230810103158.436341-1-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.044 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [setup.rs, proxmox.com, install.pm, main.rs, bootdisk.rs]
Subject: [pve-devel] [PATCH installer 0/2] add stricter checks w.r.t. BIOS
 boot on 4Kn disks
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 10 Aug 2023 10:33:25 -0000

Booting in legacy BIOS mode on 4Kn disks is generally unsupported, or
rather, simply does not work. The GUI installer already checks that
properly for LVM and ZFS, but is missing it for Btrfs, so extend the
check appropriately.

Further, the TUI installer only checked it for ZFS RAIDs, but not for
LVM and Btrfs. Add proper checks there as well, such that the user gets
immediate feedback early than during the install process.

Seems nobody noticed yet, but apparently 4Kn disks are pretty rare these
days anyway.

Prerequisites
-------------
This series is based on top of

  [PATCH installer 0/6] some small, assorted fixes & cleanups
  https://lists.proxmox.com/pipermail/pve-devel/2023-August/058708.html

which fixes another 4Kn disk issue.

Testing
-------
Tested by creating a block device with 4K sectorsize using
the following QEMU args:
  -device virtio-blk,drive=testdrive4k,logical_block_size=4096,physical_block_size=4096
  -drive file=/path/to/4k-testdisk.img,if=none,id=testdrive4k

The 4k-testdisk.img was created with:
  qemu-img create -f qcow2 /path/to/4k-testdisk.img 16G

Christoph Heiss (2):
  raid setup: btrfs: do not allow legacy BIOS boot on 4Kn disks
  tui: disallow legacy BIOS boot from 4Kn disks for all filesystems

 Proxmox/Install.pm                          |   4 +
 proxmox-tui-installer/src/main.rs           |   2 +-
 proxmox-tui-installer/src/setup.rs          |   2 +-
 proxmox-tui-installer/src/views/bootdisk.rs | 171 ++++++++------------
 4 files changed, 74 insertions(+), 105 deletions(-)

--
2.41.0