MiKTeX / miktex

the MiKTeX source code
https://miktex.org
Other
804 stars 95 forks source link

Sorry, but: The package database is locked and cannot be accessed. #1497

Closed tps800 closed 6 months ago

tps800 commented 6 months ago
ReportDate: 2024-05-27 22:45:41
CurrentVersion: 24.4
SetupDate: 2023-11-13 23:05:00
SetupVersion: 22.10
Configuration: Regular
GitInfo: e3580c6 / 2024-04-27 18:01:25
OS: Windows 10.0.17763
SharedSetup: yes
LinkTargetDirectory: C:\PRGS\MiKTeX\miktex\bin\x64
PathOkay: yes
LastUpdateCheckAdmin: 2024-05-27 22:26:33
LastUpdateAdmin: 2024-05-27 22:21:07
LastUpdateDbAdmin: 2024-05-27 22:26:16
SystemAdmin: yes
RootPrivileges: no
AdminMode: no
Root0: C:\Users\xxxxxx\AppData\Roaming\MiKTeX
Root1: C:\Users\xxxxxx\AppData\Local\MiKTeX
Root2: C:\ProgramData\MiKTeX
Root3: C:\PRGS\MiKTeX
UserInstall: C:\Users\xxxxxx\AppData\Roaming\MiKTeX
UserConfig: C:\Users\xxxxxx\AppData\Roaming\MiKTeX
UserData: C:\Users\xxxxxxAppData\Local\MiKTeX
CommonInstall: C:\PRGS\MiKTeX
CommonConfig: C:\ProgramData\MiKTeX
CommonData: C:\ProgramData\MiKTeX

After doing miktex --admin pagages upgrade with admin privileges the next time I tried to do the same I got: Sorry, but: The package database is locked and cannot be accessed. But that is wrong: the package database is not locked, but because of incorrect acls inaccessible. The database is created from an elevated account, but without granting rights to access this database from this elevated account. acls are created only for system and local administrators, not for administrators of a domain. This is ok, if there are local administrators and domain administrators are part of the local administrators group, but if there are no local administrators the domain administrators have, after upgrading once, no access any more on the just created database. The first update succeeds, the second and all later will fail.

What is wrong with miktex --admin? Simple: this command has to check if it is run as admin with elevation rights, not assume it is run as admin with elevation rights.

Within C:\ProgramData\ everyone has rights to create new files. These files may or may not be accessible to others -- even administrators may not have access rights for files created by users. It is the creating partys tune to make sure access rights are set properly to have all necessary accounts access these files!

You are just leaving access rights as they are. And if a log or database is created by one this one may be the only one having access to this database in future. Windows sets acls this way. If you need something else make sure you chage what windows does -- especially in a locked down environment.

edocevoli commented 6 months ago

closing because no log files