[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#806341: zipl-installer: Using standard device names can result in a non-bootable system



Package: zipl-installer
Version: 0.0.28
Severity: normal
Tags: d-i patch

Dear Maintainer,

Currently, the root= statement used by zipl will contain a standard device
name like /dev/dasda1.
This will only work reliable if only one disk device is used while booting.
If more than one disk device is discovered the name of the device used by
the root filesystem might change resulting in a not found root filesystem.
I suggest to use the filesystem UUID of the root filesystem where possible,
similar to what's used in /etc/fstab.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.2.0-1-s390x (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From a29dbc2bc4548b39c1dc340bf2c02f70724b72a1 Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Date: Thu, 26 Nov 2015 17:45:51 +0100
Subject: [PATCH] postinst: use UUID for root device parameter where possible

The approach to use a default device node like /dev/dasdn for
the root= kernel parameter is unsafe if more than one disk
device is brought online during IPL as the device node identifier
could change.

A safer way is to construct the root= parameter to match the
/etc/fstab entry for the root fs.

Here we use block-attr --uuid to find out the root filesystem's
UUID and pass this via kernel parameter. If no UUID is found fall
back to the mapdevfs-determined device.

If the root file system is on a logical volume, it is currently not
possible to mount it by UUID in the initrd. Therefore fall back to
the device mapper path which is unique (enough).

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 debian/zipl-installer.postinst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/debian/zipl-installer.postinst b/debian/zipl-installer.postinst
index c70ab6f..c3b7f31 100755
--- a/debian/zipl-installer.postinst
+++ b/debian/zipl-installer.postinst
@@ -19,6 +19,13 @@ rootfs="$(mapdevfs $rootfs_devfs)"
 log "Root filesystem on ${rootfs} (${rootfs_devfs})"
 
 PARAMETER="root=${rootfs}"
+if rootlvm="$(lvm lvdisplay -C -ovg_name,lv_name --noheadings ${rootfs})"
+then
+    info "Root filesystem is on LV (${rootlvm})"
+elif rootuuid="$(block-attr --uuid ${rootfs})"
+    info "Root filesystem UUID is ${rootuuid}"
+    PARAMETER="root=UUID=${rootuuid}"
+fi
 
 cat > /target/etc/zipl.conf << EOF
 [defaultboot]
-- 
1.9.1


Reply to: