[Parted-maintainers] Bug#911273: d-i does not display NVMe model strings

dann frazier dannf at debian.org
Wed Oct 17 23:42:45 BST 2018


Package: parted
Version: 3.2-22
Severity: normal
Tags: patch, d-i

parted currently exposes the same generic model name for all NVMe devices:

  # parted /dev/nvme0n1 -s print | grep Model
  Model: NVMe Device (nvme)

That can make it difficult to distinguish devices in your system,
especially at install-time.

This is fixed upstream in the following commit, which applies to Debian's
package with only minor offset adjustments:

  279bd554 Read NVMe model names from sysfs

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-rc3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages parted depends on:
ii  libc6         2.27-6
ii  libparted2    3.2-22
ii  libreadline7  7.0-5
ii  libtinfo6     6.1+20180714-1

parted recommends no packages.

Versions of packages parted suggests:
pn  parted-doc  <none>

-- no debconf information
-------------- next part --------------
>From 279bd5540a59e3bdc4e3702ff062f87fd842c0e9 Mon Sep 17 00:00:00 2001
From: dann frazier <dann.frazier at canonical.com>
Date: Fri, 7 Sep 2018 13:31:15 -0600
Subject: [PATCH] Read NVMe model names from sysfs

parted currently shows the same generic model name for all NVMe devices:

  # parted /dev/nvme0n1 -s print | grep Model
  Model: NVMe Device (nvme)

If the model information is available in sysfs, display that instead:

  # parted /dev/nvme0n1 -s print | grep Model
  Model: THNSN5512GPU7 NVMe TOSHIBA 512GB (nvme)

Signed-off-by: Brian C. Lane <bcl at redhat.com>
---
 libparted/arch/linux.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 02d7a52c..7d83dfbb 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1405,6 +1405,22 @@ init_sdmmc (PedDevice* dev)
         return init_generic(dev, id);
 }
 
+static int
+init_nvme (PedDevice* dev)
+{
+        int ret;
+        char *model = read_device_sysfs_file (dev, "model");
+
+        if (!model)
+                ret = init_generic (dev, _("NVMe Device"));
+        else {
+                ret = init_generic (dev, model);
+                free (model);
+        }
+
+        return ret;
+}
+
 static PedDevice*
 linux_new (const char* path)
 {
@@ -1489,7 +1505,7 @@ linux_new (const char* path)
                 break;
 
         case PED_DEVICE_NVME:
-                if (!init_generic (dev, _("NVMe Device")))
+                if (!init_nvme (dev))
                         goto error_free_arch_specific;
                 break;
 
-- 
2.19.1



More information about the Parted-maintainers mailing list