Bug 1217816 - partx is unable to read partition table
Summary: partx is unable to read partition table
Status: RESOLVED FIXED
Alias: None
Product: PUBLIC SUSE Linux Enterprise Micro 6.0
Classification: openSUSE
Component: Image-based Installation (show other bugs)
Version: unspecified
Hardware: S/390-64 Other
: P1 - Urgent : Major
Target Milestone: Beta 1
Assignee: Prokop Vlasin
QA Contact: Jose Lausuch
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 1220907
  Show dependency treegraph
 
Reported: 2023-12-05 10:26 UTC by Giacomo Leidi
Modified: 2024-03-05 00:38 UTC (History)
11 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: Yes
Marketing QA Status: ---
IT Deployment: ---


Attachments
kvm_image_s390x.log (960.95 KB, text/x-log)
2023-12-05 10:26 UTC, Giacomo Leidi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Giacomo Leidi 2023-12-05 10:26:51 UTC
Created attachment 871160 [details]
kvm_image_s390x.log

Both on Marble and Dolomite s390x KVM and DASD images partx (included in the parted package) is unable to parse the partition table. I'm attaching one of the logs as an example.

This does not happen on SLE, we were wondering if there are patches on the SLE version of the package that were not included in Factory and hence in ALP.

Could you please have a look?
Comment 1 Giacomo Leidi 2023-12-05 10:27:39 UTC
I'm also adding that the current ALP parted comes from Factory
Comment 3 Ihno Krumreich 2023-12-05 10:37:25 UTC
The important lines in the log are:

[  217s] [ DEBUG   ]: 10:28:18 | EXEC: [partx --add /dev/loop0]
[  217s] [ DEBUG   ]: 10:28:18 | EXEC: Failed with stderr: partx: /dev/loop0: failed to read partition table
[  217s] , stdout: (no output on stdout)

partx is failing and there are two possible reasons for it:

- partx has been changed
- kernel 6.4 has a change

Please Arvin and Hannes comment on this.
Comment 4 Arvin Schnell 2023-12-05 11:08:39 UTC
You seem to have another log. I do not see the error above but:

[  424s] [ DEBUG   ]: 08:08:32 | EXEC: [bash -c cat /var/tmp/kiwi_truhknlo | fdisk /dev/loop0]
[  425s] [ DEBUG   ]: 08:08:32 | EXEC: Failed with stderr: Re-reading the partition table failed.: Invalid argument
[...]

So here fdisk is reporting the error.

Anyway, partx is not part of parted but util-linux.

When was the last time this worked (to narrow down the changes)?
Comment 5 Marcela Maslanova 2023-12-05 11:30:53 UTC
Ihno went offline, so stepping in. The image wasn't build successfully for Micro6 for s390 at all.

There is also a log from the image DASD, which contains the message about partx: https://build.suse.de/build/SUSE:ALP:Products:Dolomite:1.0/images/s390x/ALP-Dolomite:Default-dasd/_log
Comment 6 Arvin Schnell 2023-12-05 12:52:08 UTC
So I can reproduce the problem with fdisk on Tumbleweed. There
fdisk tries BLKRRPART on /dev/loop0 and the ioctl returns EINVAL.

In general the kernel does support partitions on loop devices.
E.g. removing the loop device and setting it up with the -P
option I get /dev/loop0p1.
Comment 7 Arvin Schnell 2023-12-05 14:27:09 UTC
OK, the errors from fdisk are ignored and likely not the problem
since partx is called later and works (in the logs attached here).

In the logs from comment #5 partx fails on a loop device after
using fdasd. In the util-linux sources I found this:

- (!) add support for dasd PT (used for example on s390)

https://github.com/util-linux/util-linux/blob/master/Documentation/TODO#L163

So maybe partx simply does not support DASD PTs and never did.
Comment 8 Marcela Maslanova 2023-12-05 16:03:14 UTC
Dasd should be configured via parted (or fdasd from s390-utils).
Comment 11 Marcus Schäfer 2023-12-06 14:08:19 UTC
Hi, let me share my thoughts on this issue:

1. I can reproduce the problem that partx does not really work for partition mapping under several conditions. However kpartx does work and is usually the recommendation I give to people to use kpartx as the mapper. In order to do this you need to provide an /etc/kiwi.yml with the following content:

```yaml
mapper:
  - part_mapper: kpartx
```

To provide it in obs context a simple package that is put into prjconf as
support: package-name does the trick.

2. We have integration tests for s390 image builds here:

* https://build.opensuse.org/package/show/Virtualization:Appliances:Images:Testing_s390:tumbleweed/test-image-disk

The Virtual profile builds for a KVM target the Phyical profile builds for a DASD target in CDL mode. You need to tell kiwi what it should do. So I read one comment that says why is kiwi not using fdasd, well it does if you tell it the target. The target specification can be set via targettype="CDL" Please find the image description for this integration test here:

* https://github.com/OSInside/kiwi/blob/master/build-tests/s390/tumbleweed/test-image-disk/appliance.kiwi

As a summary I believe the non working partx is not something kiwi can fix. The available settings on the kiwi side should provide a way to overcome the hurdle as the integration tests shows.

Hope this helps
Comment 12 Gustavo Yokoyama Ribeiro 2023-12-07 13:16:00 UTC
Thanks Marcus for helping.

Jiri submitted https://build.suse.de/request/show/314878 and SLE Micro 6.0 prjconf was modified accordingly.

The failed s390x images will be available on next SLE Micro 6.0 release.
Comment 13 Hannes Reinecke 2023-12-08 08:01:13 UTC
So, here's the gist:

- parted contains support for DASDs
- kpartx (from multipath-tools) contains support for DASDs
- partx (from util-linux) does _not_ contain support for DASDs

We sure can spend time on implementing DASD support in partx.
But that means updating util-linux, upstreaming it, fighting with maintainers, yadda yadda. In short: won't be upstream before easter next year.

So faster approach is to tell Kiwi not to use partx.
Comment 14 Arvin Schnell 2023-12-08 08:24:30 UTC
Additionally the BLKRRPART ioctl does not work on loop devices.

Also see bug #896485 for missing support for DASD PT in util-linux.
Comment 15 Marcela Maslanova 2023-12-08 08:27:39 UTC
What's the right solution here? Can you put into docs for creating images, that s390 must use kpartx?