Skip to content
  • rgaudin's avatar
    Loop device permission (mode) change on Linux · 7f65944e
    rgaudin authored
    On Linux, loop-device setup, mount, unmount and removal is done in userspace thanks to udisks2.
    Now that we format the third partition on the host (before copying large files into it),
    we need to have the permission to mkfs on the loop device.
    
    At this step, the following now applies:
    
    	check wether we can write on loop device (Sys requirements advises user to be member of the `disk` group)
    	change mode if we can't (requesting elevation)
    	restore mode after we've formatted (requesting elevation – usually before previous elevation expiration)
    
    Additionaly, to prevent unexpected request for elevation at the format step (usually 30-90mn into the process), on startup:
    	attempt to guess loop device path on start. This might fail or be wrong (another app uses the guessed loop before the format step) but that should be rare.
    	change mode of guessed loop device (along with SD card, so a single request right on startup)
    	restore mode at end of process (along with SD card)
    
    	if we could not properly guess, elevation will be requested at format step.
    
    Also enforcing usage of logger everywhere (subprocess calls for mount) as missing logger leads to painful diagnostics
    7f65944e