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

Bug#1012298: linux-image-5.17.0-1-amd64: New partition doesn't appear in /dev anymore with kernel 5.17 (repro script included)



Package: src:linux
Version: 5.17.3-1
Severity: normal
X-Debbugs-Cc: misch@google.com

Dear Maintainer,

We're using an image build setup to create raw disk images that contain an EFI System Partition (ESP) with a small live Linux system.
The image build process started to fail after upgrading to kernel 5.17 as the newly created ESP (created with parted) doesn't appear automatically in /dev anymore.
We've added a partscan run to our image build setup but that didn't fix the issue. So far only downgrading to kernel 5.16 fixes the issue.

So we would kindly ask for help with troubleshooting this issue.
Please see the attached repro.sh for a minimal Bash script the reproduces the issue.

Best,

Michael Schaller 


Reproduction instructions:
--------------------------
1) Install Debian testing (I did a fresh install in a VM)
2) apt install parted dosfstools
3) Edit /etc/apt/sources.list and add this new source to be able to install the last 5.16 kernel:
   deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20220407T025351Z/ testing main
4) apt install linux-image-5.16.0-6-amd64  (and headers if you need them on your system)
5) Reboot into the 5.16 and 5.17 kernel respectively and run repro.sh.


Results:
--------

Kernel 5.17:
------------

$ uname -r
5.17.0-1-amd64


$ sudo ./repro.sh
...
+ parted -s /dev/loop0 mklabel gpt
+ parted -s /dev/loop0 mkpart primary fat32 1MiB 100%
+ parted -s /dev/loop0 set 1 boot on
+ partprobe /dev/loop0
+ mkfs.vfat /dev/loop0p1
mkfs.fat 4.2 (2021-01-31)
mkfs.vfat: unable to open /dev/loop0p1: No such file or directory
...


Kernel 5.16:
------------

$ uname -r
5.16.0-6-amd64


$ sudo ./repro.sh
...
+ parted -s /dev/loop0 mklabel gpt
+ parted -s /dev/loop0 mkpart primary fat32 1MiB 100%
+ parted -s /dev/loop0 set 1 boot on
+ partprobe /dev/loop0
+ mkfs.vfat /dev/loop0p1
mkfs.fat 4.2 (2021-01-31)
...



-- Package-specific info:
** Version:
Linux version 5.17.0-1-amd64 (debian-kernel@lists.debian.org) (gcc-11 (Debian 11.2.0-20) 11.2.0, GNU ld (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.17.3-1 (2022-04-18)

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
#!/bin/bash

set -ex

if [[ "${EUID}" != 0 ]]; then
  >&2 echo "root rights required"
  exit 2
fi

img='/tmp/raw.img'  # Raw disk image file.
dev=''  # Loop device associated with the raw disk image file.
cfg='/tmp/setup-storage-disk-config'  # setup-storage disk config file.
res='/tmp/setup-storage-results'  # setup-storage results directory.

function cleanup {
  set +e
  rm -rf "${res}"
  rm -f "${cfg}"
  if [ -n "${dev}" ]; then
    # Free loop device.
    losetup --detach "${dev}"
  fi
  rm -f "${img}"
}
trap cleanup EXIT

# Create sparse file for a raw disk image.
dd if=/dev/zero status=none of="${img}" bs=1 count=0 seek=16MiB

# Associate a loop device with the raw disk image.
losetup --find "${img}"

# Get the associated loop device.
dev=$(losetup --associated "${img}" | cut -d ':' -f 1)
if [ -z "${dev}" ]; then
  >&2 echo 'failed to find associated loop device'
  exit 1
fi

# Create GPT partition table with an ESP.
parted -s "${dev}" mklabel gpt
parted -s "${dev}" mkpart primary "fat32" 1MiB 100%
parted -s "${dev}" set 1 boot on
partprobe "${dev}"  # For good measure but not needed on kernel 5.16
mkfs.vfat  "${dev}p1"  # This command fails with kernel 5.17

Reply to: