Bug 425319 - Mounting an ISO with multiple partitions always mounts the wrong partition
Summary: Mounting an ISO with multiple partitions always mounts the wrong partition
Status: RESOLVED UPSTREAM
Alias: None
Product: dolphin
Classification: Applications
Component: plugins: ISO mounting (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Kwon-Young Choi
URL: https://github.com/storaged-project/u...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-13 18:33 UTC by Oded Arbel
Modified: 2020-08-16 16:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oded Arbel 2020-08-13 18:33:52 UTC
SUMMARY
I have an ISO of a "multi-partition ISO" images (dual use for Windows and Mac). When mounting it using Dolphin (clicking on the device in the "Devices" list), it mounts the HFS partition.

STEPS TO REPRODUCE
1. Setup a loop device for a multi-partition ISO image (using losetup, udisksctl or Dolphin's new "Mount ISO" service). 
2. Double click the new device that appears in the "Devices" list.

OBSERVED RESULT
The HFS filesystem on the ISO is shown with the Mac specific files. The Joliet file system is not shown.

EXPECTED RESULT
The Joliet file system should be shown.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.74.0
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Dolphin is version 20.11.70 installed from neon unstable repositories.

The Joliet file system can be accessed by using the FuseISO tools on the loop device setup by losetup/udisksctl/Dolphin by executing something like this on a terminal:

fuseiso /dev/loop28 ~/mnt/tmp/

Using `solid-hardware5 list details`, the relevant output looks like this:

udi = '/org/freedesktop/UDisks2/block_devices/loop28'
  parent = '/'  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = 'INSTALL'  (string)
  icon = 'application-x-cd-image'  (string)
  Block.major = 7  (0x7)  (int)
  Block.minor = 28  (0x1c)  (int)
  Block.device = '/dev/loop28'  (string)
  StorageVolume.ignored = true  (bool)
  StorageVolume.usage = 'PartitionTable'  (0x3)  (enum)
  StorageVolume.fsType = 'iso9660'  (string)
  StorageVolume.label = 'INSTALL'  (string)
  StorageVolume.uuid = '2004-08-12-14-36-55-00'  (string)
  StorageVolume.size = 654561280  (0x2703d000)  (qulonglong)

udi = '/org/freedesktop/UDisks2/block_devices/loop28p2'
  parent = '/'  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = 'XXXXXXXXXXX'  (string)
  icon = 'drive-harddisk'  (string)
  Block.major = 259  (0x103)  (int)
  Block.minor = 10  (0xa)  (int)
  Block.device = '/dev/loop28p2'  (string)
  StorageAccess.accessible = false  (bool)
  StorageAccess.filePath = ''  (string)
  StorageAccess.ignored = true  (bool)
  StorageVolume.ignored = false  (bool)
  StorageVolume.usage = 'FileSystem'  (0x2)  (enum)
  StorageVolume.fsType = 'hfs'  (string)
  StorageVolume.label = 'XXXXXXXXXXX'  (string)
  StorageVolume.uuid = 'dbd5a3ea-5614-384e-8d15-045117946523'  (string)
  StorageVolume.size = 628582400  (0x25776800)  (qulonglong)

udi = '/org/freedesktop/UDisks2/block_devices/loop28p1'
  parent = '/'  (string)
  vendor = ''  (string)
  product = ''  (string)
  description = 'MRKS'  (string)
  icon = 'drive-harddisk'  (string)
  Block.major = 259  (0x103)  (int)
  Block.minor = 9  (0x9)  (int)
  Block.device = '/dev/loop28p1'  (string)
  StorageVolume.ignored = true  (bool)
  StorageVolume.usage = 'Unused'  (0x1)  (enum)
  StorageVolume.fsType = ''  (string)
  StorageVolume.label = 'MRKS'  (string)
  StorageVolume.uuid = ''  (string)
  StorageVolume.size = 1024  (0x400)  (qulonglong)

While the specific ISO image I'm using was created by a commercial software for a commercial product, according to the mkisofs man page, that can also be used to generate multi-partition ISO images with different HFS and Joliet views.

`isoinfo -d` shows:

CD-ROM is in ISO 9660 format
System id: APPLE COMPUTER, INC., TYPE: 0002
Volume id: INSTALL
Volume set id: NOT_SET
Publisher id: 
Data preparer id: 
Application id: TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997-2002 ROXIO, INC. - HAVE A NICE DAY
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 319610
Joliet with UCS level 1 found
NO Rock Ridge present

Isolyzer output is as follows:

<?xml version="1.0" ?>
<isolyzer>
    <toolInfo>
        <toolName>isolyzer</toolName>
        <toolVersion>1.3.1</toolVersion>
    </toolInfo>
    <image>
        <fileInfo>
            <fileName>XXXXXXXXXXX.iso</fileName>
            <filePath>/home/odeda/Documents/XXXXXXXXXXX.iso</filePath>
            <fileSizeInBytes>654561280</fileSizeInBytes>
            <fileLastModified>Fri May  1 20:21:13 2020</fileLastModified>
        </fileInfo>
        <statusInfo>
            <success>True</success>
        </statusInfo>
        <sectorOffset>0</sectorOffset>
        <tests>
            <containsKnownFileSystem>True</containsKnownFileSystem>
            <sizeExpected>654561280</sizeExpected>
            <sizeActual>654561280</sizeActual>
            <sizeDifference>0</sizeDifference>
            <sizeDifferenceSectors>0.0</sizeDifferenceSectors>
            <sizeAsExpected>True</sizeAsExpected>
            <smallerThanExpected>False</smallerThanExpected>
        </tests>
        <fileSystems>
            <fileSystem TYPE="ISO 9660">
                <primaryVolumeDescriptor>
                    <typeCode>1</typeCode>
                    <standardIdentifier>CD001</standardIdentifier>
                    <version>1</version>
                    <systemIdentifier>APPLE COMPUTER, INC., TYPE: 0002</systemIdentifier>
                    <volumeIdentifier>INSTALL</volumeIdentifier>
                    <volumeSpaceSize>319610</volumeSpaceSize>
                    <volumeSetSize>1</volumeSetSize>
                    <volumeSequenceNumber>1</volumeSequenceNumber>
                    <logicalBlockSize>2048</logicalBlockSize>
                    <pathTableSize>238</pathTableSize>
                    <typeLPathTableLocation>19</typeLPathTableLocation>
                    <optionalTypeLPathTableLocation>0</optionalTypeLPathTableLocation>
                    <typeMPathTableLocation>20</typeMPathTableLocation>
                    <optionalTypeMPathTableLocation>0</optionalTypeMPathTableLocation>
                    <volumeSetIdentifier>NOT_SET</volumeSetIdentifier>
                    <publisherIdentifier/>
                    <dataPreparerIdentifier/>
                    <applicationIdentifier>TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997-2002 ROXIO, INC. - HAVE A NICE DAY</applicationIdentifier>
                    <copyrightFileIdentifier/>
                    <abstractFileIdentifier/>
                    <bibliographicFileIdentifier/>
                    <volumeCreationDateAndTime>2004/08/12, 14:34:59</volumeCreationDateAndTime>
                    <volumeModificationDateAndTime>2004/08/12, 14:36:55</volumeModificationDateAndTime>
                    <volumeExpirationDateAndTime/>
                    <volumeEffectiveDateAndTime/>
                    <fileStructureVersion>1</fileStructureVersion>
                </primaryVolumeDescriptor>
            </fileSystem>
            <fileSystem TYPE="HFS">
                <appleZeroBlock>
                    <signature>ER</signature>
                    <blockSize>512</blockSize>
                    <blockCount>1278438</blockCount>
                    <deviceType>1</deviceType>
                    <deviceID>1</deviceID>
                    <driverData>0</driverData>
                    <driverDescriptorCount>0</driverDescriptorCount>
                    <driverDescriptorBlockStart>0</driverDescriptorBlockStart>
                    <driverDescriptorBlockCount>0</driverDescriptorBlockCount>
                    <driverDescriptorSystemType>0</driverDescriptorSystemType>
                </appleZeroBlock>
                <applePartitionMap>
                    <signature>PM</signature>
                    <numberOfPartitionEntries>2</numberOfPartitionEntries>
                    <partitionBlockStart>1</partitionBlockStart>
                    <partitionBlockCount>2</partitionBlockCount>
                    <partitionName>MRKS</partitionName>
                    <partitionType>Apple_partition_map</partitionType>
                    <partitionLogicalBlockStart>0</partitionLogicalBlockStart>
                    <partitionLogicalBlockCount>2</partitionLogicalBlockCount>
                    <partitionFlags>51</partitionFlags>
                    <bootCodeBlockStart>0</bootCodeBlockStart>
                    <bootCodeSizeInBytes>0</bootCodeSizeInBytes>
                    <bootCodeLoadAddress>0</bootCodeLoadAddress>
                    <bootCodeJumpAddress>0</bootCodeJumpAddress>
                    <bootCodeChecksum>0</bootCodeChecksum>
                    <processorType/>
                </applePartitionMap>
                <applePartitionMap>
                    <signature>PM</signature>
                    <numberOfPartitionEntries>2</numberOfPartitionEntries>
                    <partitionBlockStart>50738</partitionBlockStart>
                    <partitionBlockCount>1227700</partitionBlockCount>
                    <partitionName>Toast 5.2 HFS Optimizer</partitionName>
                    <partitionType>Apple_HFS</partitionType>
                    <partitionLogicalBlockStart>0</partitionLogicalBlockStart>
                    <partitionLogicalBlockCount>1227700</partitionLogicalBlockCount>
                    <partitionFlags>51</partitionFlags>
                    <bootCodeBlockStart>0</bootCodeBlockStart>
                    <bootCodeSizeInBytes>0</bootCodeSizeInBytes>
                    <bootCodeLoadAddress>0</bootCodeLoadAddress>
                    <bootCodeJumpAddress>0</bootCodeJumpAddress>
                    <bootCodeChecksum>0</bootCodeChecksum>
                    <processorType/>
                </applePartitionMap>
                <masterDirectoryBlock>
                    <signature>BD</signature>
                    <blockSize>61384</blockSize>
                    <blockCount>10240</blockCount>
                    <volumeName>XXXXXXXXXXX</volumeName>
                </masterDirectoryBlock>
            </fileSystem>
        </fileSystems>
    </image>
</isolyzer>
Comment 1 Kwon-Young Choi 2020-08-13 22:29:48 UTC
Hello,

First of all, the mountiso is just a frontend to `udisksctl` which means that if the iso is not mounted correctly, it is probably because of `udisksctl`.

On my machine, I tried to create an HFS/Joliet iso image using `mkisofs`:

```
$ mkisofs -o test.iso -R -J -hfs test
```

where the `test` directory contains a single file.
But I was not able to mount this iso using `udisksctl` (but `fuseiso` and `mount` worked).

So I have the following questions:

* Can you mount your iso file using only `udisksctl` commands? (you can use `udisksctl loop-setup -f image.iso` to create a loop device and `udisksctl mount --block-device /dev/loop1` to mount the loop device)
* Could you provide an iso file with which I could reproduce your results? You can mail it to me directly at my email address if you want (kwon-young.choi@hotmail.fr)
Comment 2 Oded Arbel 2020-08-14 13:37:40 UTC
(In reply to Kwon-Young Choi from comment #1)
> First of all, the mountiso is just a frontend to `udisksctl` which means
> that if the iso is not mounted correctly, it is probably because of
> `udisksctl`.

The issue is not with the "mount iso" feature - sorry about the confusion, specifically about the component chosen, I just don't know which other component to choose. The issue is what happens after "mount iso" completes its work - i.e. when clicking the newly attached device. As mentioned in the report - the same behavior is observed with other methods of "mounting an iso".

> On my machine, I tried to create an HFS/Joliet iso image using `mkisofs`:
...
> But I was not able to mount this iso using `udisksctl` (but `fuseiso` and
> `mount` worked).

I have the same issue as well - I have yet to manage to use mkisofs to create an ISO that `udisksctl` and/or Dolphin can successfully mount - i.e. make it appear in the "Devices" list in Dolphin, even though `solid-hardware5 list` does show a device (though it doesn't look correct in some ways, compared to a commercial ISO). I can mount the ISO manually using mount or fuseiso after using udisksctl (or Dolphin) but it is not the same behavior and even if I make a hybrid HFS ISO, mounting manually always goes for the Joliet/RockRdige file system.

None the less, the problem I reported reproduces 100% with commercial ISOs that I have.

> * Can you mount your iso file using only `udisksctl` commands?

Yes, but only the second partition: after `loop-setup`, I have /dev/loop24, /dev/loop24p1 and /dev/loop24p2. with `sudo mount` I can mount either /dev/loop24 (Joliet/ISO9660 file system) or /dev/loop24p2 (HFS filesystem). I'm not sure what /dev/loop24p1 is - maybe the isolyzer or solid-hardware output from above has some clues. When using `udisksctl mount`, only /dev/loop24p2 successfully mounts. So I have a feeling this is indeed not a Dolphin problem but a udisks2 problem.

> * Could you provide an iso file with which I could reproduce your results?
> You can mail it to me directly at my email address if you want
> (kwon-young.choi@hotmail.fr)

It is commercial software, so I'm not sure that is a good idea, and it is also very large. I'll email you privately and we can discuss there.
Comment 3 Kwon-Young Choi 2020-08-14 14:11:49 UTC
(In reply to Oded Arbel from comment #2)
> 
> > * Can you mount your iso file using only `udisksctl` commands?
> 
> Yes, but only the second partition: after `loop-setup`, I have /dev/loop24,
> /dev/loop24p1 and /dev/loop24p2. with `sudo mount` I can mount either
> /dev/loop24 (Joliet/ISO9660 file system) or /dev/loop24p2 (HFS filesystem).
> I'm not sure what /dev/loop24p1 is - maybe the isolyzer or solid-hardware
> output from above has some clues. When using `udisksctl mount`, only
> /dev/loop24p2 successfully mounts. So I have a feeling this is indeed not a
> Dolphin problem but a udisks2 problem.

Could you share the output of the following commands:

```
$ udisksctl info --block-device /dev/loop24

$ udisksctl info --block-device /dev/loop24p1

$ udisksctl info --block-device /dev/loop24p2
```

`udisksctl` has often more detailed informations than `solid-hardware`.
From what I understand of `udisksctl`, /dev/loop24 represent the partition table of the image and each additional loop device loop24p1, loop24p2 represent an different partition.

I found this issue at the udisks project page: https://github.com/storaged-project/udisks/issues/725 but I am not sure if it is the exact same problem.

For now, I think it is fair to say that this is a problem coming from udisks and maybe you could add a comment on that udisks issue thread.

> > * Could you provide an iso file with which I could reproduce your results?
> > You can mail it to me directly at my email address if you want
> > (kwon-young.choi@hotmail.fr)
> 
> It is commercial software, so I'm not sure that is a good idea, and it is
> also very large. I'll email you privately and we can discuss there.

Since I'm a new contributor and you do not know me, I 100% understand that.
Moreover, I might not be the best person to help you since I don't know a lot about this stuff.

I guess the other solution would be to switch to from udisks to another tool like fuseiso, but that would be a enormous amount of work.
Comment 4 Oded Arbel 2020-08-16 08:38:14 UTC
(In reply to Kwon-Young Choi from comment #3)
> Could you share the output of the following commands:

$ udisksctl loop-setup -r -f 'XXXXXXXX.iso'
Mapped file XXXXXXXX.iso as /dev/loop36.
$ udisksctl info --block-device /dev/loop36
/org/freedesktop/UDisks2/block_devices/loop36:
  org.freedesktop.UDisks2.Block:
    Configuration:              []
    CryptoBackingDevice:        '/'
    Device:                     /dev/loop36
    DeviceNumber:               1828
    Drive:                      '/'
    HintAuto:                   false
    HintIconName:               
    HintIgnore:                 false
    HintName:                   
    HintPartitionable:          true
    HintSymbolicIconName:       
    HintSystem:                 true
    Id:                         
    IdLabel:                    INSTALL
    IdType:                     iso9660
    IdUUID:                     2004-08-12-14-36-55-00
    IdUsage:                    filesystem
    IdVersion:                  Joliet Extension
    MDRaid:                     '/'
    MDRaidMember:               '/'
    PreferredDevice:            /dev/loop36
    ReadOnly:                   true
    Size:                       654561280
    Symlinks:                   /dev/disk/by-label/INSTALL
                                /dev/disk/by-uuid/2004-08-12-14-36-55-00
    UserspaceMountOptions:      
  org.freedesktop.UDisks2.Loop:
    Autoclear:          false
    BackingFile:        /home/odeda/XXXXXXXX/XXXXXXXX.iso
    SetupByUID:         1000
  org.freedesktop.UDisks2.PartitionTable:
    Partitions:         ['/org/freedesktop/UDisks2/block_devices/loop36p1', '/org/freedesktop/UDisks2/block_devices/loop36p2']
    Type:               mac
$ udisksctl info --block-device /dev/loop36p1
/org/freedesktop/UDisks2/block_devices/loop36p1:
  org.freedesktop.UDisks2.Block:
    Configuration:              []
    CryptoBackingDevice:        '/'
    Device:                     /dev/loop36p1
    DeviceNumber:               66313
    Drive:                      '/'
    HintAuto:                   false
    HintIconName:               
    HintIgnore:                 false
    HintName:                   
    HintPartitionable:          true
    HintSymbolicIconName:       
    HintSystem:                 true
    Id:                         
    IdLabel:                    
    IdType:                     
    IdUUID:                     
    IdUsage:                    
    IdVersion:                  
    MDRaid:                     '/'
    MDRaidMember:               '/'
    PreferredDevice:            /dev/loop36p1
    ReadOnly:                   true
    Size:                       1024
    Symlinks:                   
    UserspaceMountOptions:      
  org.freedesktop.UDisks2.Partition:
    Flags:              0
    IsContained:        false
    IsContainer:        false
    Name:               MRKS
    Number:             1
    Offset:             512
    Size:               1024
    Table:              '/org/freedesktop/UDisks2/block_devices/loop36'
    Type:               Apple_partition_map
    UUID:               
$ udisksctl info --block-device /dev/loop36p2
/org/freedesktop/UDisks2/block_devices/loop36p2:
  org.freedesktop.UDisks2.Block:
    Configuration:              []
    CryptoBackingDevice:        '/'
    Device:                     /dev/loop36p2
    DeviceNumber:               66314
    Drive:                      '/'
    HintAuto:                   false
    HintIconName:               
    HintIgnore:                 false
    HintName:                   
    HintPartitionable:          true
    HintSymbolicIconName:       
    HintSystem:                 true
    Id:                         
    IdLabel:                    XXXXXXXX Install
    IdType:                     hfs
    IdUUID:                     dbd5a3ea-5614-384e-8d15-045117946523
    IdUsage:                    filesystem
    IdVersion:                  
    MDRaid:                     '/'
    MDRaidMember:               '/'
    PreferredDevice:            /dev/loop36p2
    ReadOnly:                   true
    Size:                       628582400
    Symlinks:                   /dev/disk/by-label/XXXXXXXX\x20Install
                                /dev/disk/by-uuid/dbd5a3ea-5614-384e-8d15-045117946523
    UserspaceMountOptions:      
  org.freedesktop.UDisks2.Filesystem:
    MountPoints:        
    Size:               0
  org.freedesktop.UDisks2.Partition:
    Flags:              0
    IsContained:        false
    IsContainer:        false
    Name:               Toast 5.2 HFS Optimizer
    Number:             2
    Offset:             25977856
    Size:               628582400
    Table:              '/org/freedesktop/UDisks2/block_devices/loop36'
    Type:               Apple_HFS
    UUID:               


> I found this issue at the udisks project page:
> https://github.com/storaged-project/udisks/issues/725 but I am not sure if
> it is the exact same problem.

I will review. Thank you.

> I guess the other solution would be to switch to from udisks to another tool
> like fuseiso, but that would be a enormous amount of work.

yea, that does not seem very feasible. IMO fixing udisks is the way to go. If the above linked issue is not relevant, I'll open a new ticket there.

Do you think this bug report should be closed? or would you rather have it open and blocking on a possible update from udisks?
Comment 5 Kwon-Young Choi 2020-08-16 16:09:02 UTC
Thanks for your additional input.
For now, I'll mark this bug as resolved and add a link to the udisks issue.
If you happen to open a new issue, let me know so that I can update the url.