Classic confinement request for diskrescue

Snap: diskrescue (GitHub - Dhiva-Labs/DiskRescue: Recover photos and videos from failing hard disks, SSDs, USB drives and SD cards, and repair damaged JPEG, PNG, MP4/MOV and AVI files. Command line, terminal app and desktop app. · GitHub, MIT)

What it is: a data recovery tool for photos and videos. It makes a careful, resumable copy of a failing hard disk, SSD, USB drive or SD card (like GNU ddrescue), recovers existing and deleted files from FAT, exFAT, NTFS and ext4, carves photos and videos from raw space, and repairs damaged JPEG, PNG, MP4/MOV and AVI files. It ships a command line, a terminal app and a desktop app.

Why classic: the tool falls into the “tools that need to access arbitrary block devices and run privileged operations on them” category:

  • It must read any raw block device the user picks (/dev/sd*, /dev/mmcblk*, /dev/nvme*n*, USB card readers, loop devices over disk images), including devices that re-enumerate under a new name when a failing USB drive drops off the bus; it finds them again by serial number through sysfs and udev data.
  • The desktop app runs as the user and asks for administrator rights only for the copy step, by running its own command-line program through pkexec. A strictly confined snap cannot do this; with only the block-devices interface users would have to run the whole desktop app as root, which does not work on Wayland.
  • Recovered files and disk images (often hundreds of GB) must be written to wherever the user has space: any mounted disk, /mnt, /srv, NAS mounts, not only $HOME and /media. The tool refuses to write to the device being recovered, which requires reading /proc/self/mountinfo, sysfs holders/slaves and /run/udev/data.
  • It reads device health with smartctl when the host has it installed.

It never writes to the source device: every device is opened read-only. Comparable tools (GNU ddrescue, TestDisk/PhotoRec, GParted) are distributed unconfined for the same reasons.

This request has been added to the queue for review by the @reviewers team.

Please see:

Your application must fit into one of the supported categories to be considered for classic confinement.

Please also pay particular attention to the last paragraph, packaging classic confined applications is a very advanced task and way harder than strict packaging, you need to know a lot about binary patching, RPATH handling and should be very familiar with the patchelf tool.

There is a block-devices interface for strict snaps that should give you full access to the respective device nodes.

The removable-media interface would grant access to /mnt and external disks mounted in /media to store recovered data to external media and if you split your special backend copy tool into a daemon that you can talk to through dbus you wouldn’t need the pkexec call…

1 Like

Hello @Dhiva-Labs,

As @ogra mentions above, an application must fit into a supported-category in order to be considered for classic confinement. Classic is also restricted to mature, well-known applications, and based on the upstream github, this application seems very fresh. As such, diskrescue does not currently qualify for classic confinement, this is a -1 from me. I also encourage you to look into the suggestions above to attempt to get diskrescue working under strict. Thank you for your time!