mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Linux/udisks2/image customization: fix issue with mounting NVMe drives
When using image customization with an NVMe drive under RPI OS on a CM4, the system will prompt non-root users for password when mounting the FAT file system. (Passwordless mounting does is available for removable storage, but the NVMe drive qualifies as internal storage instead). - The mount command we send to udisks2 over dbus2 may timeout before the user completed the password prompt. Raise timeout to counter this. - Print mount error details to console - On mount error report error mounting in GUI instead of "/config.txt does not exist" (which happened when mountDevice() returned empty string)
This commit is contained in:
parent
8b25991537
commit
b42342d0ac
2 changed files with 25 additions and 1 deletions
|
@ -156,6 +156,8 @@ bool UDisks2Api::formatDrive(const QString &device, bool mountAfterwards)
|
|||
for (int attempt = 0; attempt < 10; attempt++)
|
||||
{
|
||||
qDebug() << "Mounting partition";
|
||||
// User may need to enter password in authentication dialog if non-removable storage, so set long timeout
|
||||
filesystem.setTimeout(3600 * 1000);
|
||||
QDBusReply<QString> mp = filesystem.call("Mount", mountOptions);
|
||||
|
||||
if (mp.isValid())
|
||||
|
@ -172,6 +174,10 @@ bool UDisks2Api::formatDrive(const QString &device, bool mountAfterwards)
|
|||
qDebug() << "Was already auto-mounted at:" << mps;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Error mounting:" << mp.error().message();
|
||||
}
|
||||
}
|
||||
|
||||
QThread::sleep(1);
|
||||
|
@ -197,6 +203,8 @@ QString UDisks2Api::mountDevice(const QString &device)
|
|||
for (int attempt = 0; attempt < 10; attempt++)
|
||||
{
|
||||
qDebug() << "Mounting partition";
|
||||
// User may need to enter password in authentication dialog if non-removable storage, so set long timeout
|
||||
filesystem.setTimeout(3600 * 1000);
|
||||
QDBusReply<QString> mp = filesystem.call("Mount", mountOptions);
|
||||
|
||||
if (mp.isValid())
|
||||
|
@ -204,6 +212,20 @@ QString UDisks2Api::mountDevice(const QString &device)
|
|||
qDebug() << "Mounted file system at:" << mp;
|
||||
return mp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check if already auto-mounted */
|
||||
auto mps = mountPoints(filesystem);
|
||||
if (!mps.isEmpty())
|
||||
{
|
||||
qDebug() << "Was already auto-mounted at:" << mps;
|
||||
return mps.first();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Error mounting:" << mp.error().message();
|
||||
}
|
||||
}
|
||||
|
||||
QThread::sleep(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue