M2: improve error messages with actionable suggestions
udisks2 connection and device listing errors now suggest checking the service. Device-not-found errors suggest 'arca status' or 'arca init'. Failed cryptsetup token unlock hints at missing FIDO2/TPM2 key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ func (u *Unlocker) Unlock(dev *udisks.BlockDevice, methods []string) (*Result, e
|
||||
}
|
||||
errs = append(errs, fmt.Errorf("%s: %w", method, err))
|
||||
}
|
||||
return nil, fmt.Errorf("all unlock methods failed:\n%w", errors.Join(errs...))
|
||||
return nil, fmt.Errorf("all unlock methods failed for %s:\n%w", dev.DevicePath, errors.Join(errs...))
|
||||
}
|
||||
|
||||
func (u *Unlocker) tryMethod(dev *udisks.BlockDevice, method string) (*Result, error) {
|
||||
@@ -96,7 +96,7 @@ func (u *Unlocker) unlockKeyfile(dev *udisks.BlockDevice) (*udisks.BlockDevice,
|
||||
func (u *Unlocker) unlockCryptsetup(dev *udisks.BlockDevice) (*udisks.BlockDevice, error) {
|
||||
name := cryptsetup.MapperName(dev.DevicePath)
|
||||
if err := cryptsetup.Open(dev.DevicePath, name); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("%w (is the FIDO2/TPM2 key plugged in?)", err)
|
||||
}
|
||||
|
||||
// Wait for udisks2 to pick up the new dm device.
|
||||
|
||||
Reference in New Issue
Block a user