Mounting Mac APFS drives

It looks as if it can be done under Ubuntu. Is it possible from a live 15.4 XFCE USB booted on a 2015 MacBook Pro? What do I need to install? I only need read permission.

@ionmich It’s there;

zypper in libfsapfs
/usr/bin/fsapfsinfo
/usr/bin/fsapfsmount

Many thanks. I will try them out.

After booting XFCE Live, I can execute fsapfsinfo. But I’m not getting any output. Can you give me an example of the options needed to view the whole Apple hard drive? I am trying to have access to a specific directory to back it up under XFCE so I can save it to an ext4 drive.
Thanks in advance.

@ionmich did you mount the partition?

When I used fdisk to identify the hd it didn’t show up. But since you asked I believe I should have used gdisk. Old habits of old people. In the meantime I formatted an exfat drive and I am copying under macOS. Slowly.

Moving on, but not quite there.

localhost:/home/linux # gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 977105060 sectors, 465.9 GiB
Model: APPLE SSD SM0512
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 46877AB2-D7A7-467E-936F-E92D64A2F4D6
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 977105026
Partitions will be aligned on 8-sector boundaries
Total free space is 9 sectors (4.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       977105023   465.7 GiB   AF0A  Customer

Command (? for help): 


localhost:/home/linux # /usr/bin/fsapfsmount -p userspassword /dev/sda2 /mnt
fsapfsmount 20210513

Unable to open source container
libcaes_crypt_xts: unable to initialize cipher with error: error:060CF0B7:digital envelope routines:aesni_xts_init_key:xts duplicated keys.
libfsapfs_encryption_context_crypt: unable to decrypt data.
libfsapfs_container_key_bag_read_file_io_handle: unable to decrypt data.
libfsapfs_internal_container_open_read: unable to read container key bag at offset: 188576931840 (0x2be80fa000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
mount_handle_open: unable to open container.

When I add the -o option the decryption error disappears.

# /usr/bin/fsapfsmount -p xxxxx42 -o 20210513 /dev/sda2 /mnt
fsapfsmount 20210513

Unable to open source container
libfsapfs_container_superblock_read_data: invalid object type: 0xb3b51b72.
libfsapfs_container_superblock_read_file_io_handle: unable to read container superblock data.
libfsapfs_internal_container_open_read: unable to read container superblock at offset: 0 (0x00000000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
mount_handle_open: unable to open container.

and if I invoke

# /usr/bin/fsapfsmount -p xxxxx42 -o 0x00000000 /dev/sda2 /mnt
fsapfsmount 20210513

Unable to set container offset.
mount_handle_system_string_copy_from_64_bit_in_decimal: unsupported character value: x at index: 1.
mount_handle_set_offset: unable to copy string to 64-bit decimal.

I get even fewer errors, but using a decimal value of 0 returns the previous errors.