mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
Merge pull request #13340 from mkenigs/better-error
Improve error when can't acquire db lock
This commit is contained in:
commit
dc2478fe79
2 changed files with 12 additions and 2 deletions
|
|
@ -228,7 +228,16 @@ LocalStore::LocalStore(ref<const Config> config)
|
|||
schema upgrade is in progress. */
|
||||
if (!config->readOnly) {
|
||||
Path globalLockPath = dbDir + "/big-lock";
|
||||
globalLock = openLockFile(globalLockPath.c_str(), true);
|
||||
try {
|
||||
globalLock = openLockFile(globalLockPath.c_str(), true);
|
||||
} catch (SysError & e) {
|
||||
if (e.errNo == EACCES || e.errNo == EPERM) {
|
||||
e.addTrace({},
|
||||
"This command may have been run as non-root in a single-user Nix installation,\n"
|
||||
"or the Nix daemon may have crashed.");
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
if (!config->readOnly && !lockFile(globalLock.get(), ltRead, false)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue