Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin mode required but not accessible #419

Closed
1 task done
projekter opened this issue Nov 15, 2019 · 18 comments
Closed
1 task done

Admin mode required but not accessible #419

projekter opened this issue Nov 15, 2019 · 18 comments
Assignees
Labels
Milestone

Comments

@projekter
Copy link

I tried to run updates via the MikTeX console. Since the last time I updated is already past a couple of week, I believe there must be quite a few. However (as it was in pre-console times with the two-stage update process), the console reports only three of them (miktex-harftex-bin-x64-2.9, ifetex and ifxetex) which are all about to be removed. All three of them have a comment in the last column: removal only possible in admin mode. I can't check them and can't run those updates.
Previously, I had a shared MikTeX installation and did every update in admin mode, but recently, I noted that updating the formats (due to this issue) did not increase the version number. I thought that this might be a shared/single user related problem and chose "Reset personal MikTeX configuration" in the Cleanup section of the console, as I really don't need a shared installation. After that, obviously my installation was set to be user-mode only, as I was never again asked to enter admin mode and indeed every packaged changed its "Installed by" entry to "User".
So now the problem is that I don't have an admin mode (starting the console with --admin parameter confirms this: It aborts saying Option --admin only makes sense for a shared MiKTeX setup.), but in order to uninstall those three packages and subsequently (I hope) being able to do updates again, I need to enter the admin mode.
It looks like the "Reset personal MikTeX configuration" has somehow put my installation in an inconsistent state. Rebuilding the FNDB before the update did not help.

initexmf --report:

initexmf: warning: Option --admin should be specified when running this program with administrator privileges
Date: 2019-11-15 08:44:12
MiKTeX: 2.9.7200 NEXT
OS: Windows 10 Pro, 64-bit, build 18362
SharedSetup: no
LinkTargetDirectory: C:\Program Files\MiKTeX 2.9\miktex\bin\x64
PathOkay: yes
LastUpdateCheck: 2019-11-15 08:33:09
LastUpdate: not yet
SystemAdmin: yes
RootPrivileges: yes
AdminMode: no
Root0: C:\Users\Benni\AppData\Roaming\MiKTeX\2.9
Root1: C:\Users\Benni\AppData\Local\MiKTeX\2.9
Root2: D:\Dokumente\TeX
Root3: C:\ProgramData\MiKTeX\2.9
Root4: C:\Program Files\MiKTeX 2.9
UserInstall: C:\Users\Benni\AppData\Roaming\MiKTeX\2.9
UserConfig: C:\Users\Benni\AppData\Roaming\MiKTeX\2.9
UserData: C:\Users\Benni\AppData\Local\MiKTeX\2.9
CommonInstall: C:\Program Files\MiKTeX 2.9
CommonConfig: C:\ProgramData\MiKTeX\2.9
CommonData: C:\ProgramData\MiKTeX\2.9
@edocevoli
Copy link
Member

Seems that there are some relicts from the previous installation. To find out:

reg export HKLM\Software\MiKTeX.org hklm.txt
reg export HKCU\Software\MiKTeX.org hkcu.txt
dir /s "C:\Program Files\MiKTeX 2.9" > common-install.txt
dir /s "C:\ProgramData\MiKTeX\2.9" > common-config.txt

@projekter
Copy link
Author

On this system, there were no previous installations. The HKLM keys do not exist.
exports.zip

@edocevoli
Copy link
Member

Sorry, I was a little bit confused. Please attach the relevant package manager files:

%APPDATA%\MiKTeX\2.9\miktex\config\mpm.ini
%APPDATA%\MiKTeX\2.9\miktex\config\packages.ini
%APPDATA%\MiKTeX\2.9\miktex\config\package-manifests.ini

@projekter
Copy link
Author

config.zip

@edocevoli
Copy link
Member

The config file packages.ini is almost empty which means that no packages are installed and the updater has nothing to do,

It should be possible to manually install missing packages. This seems to be the only work-around for this broken MiKTeX installation.

@projekter
Copy link
Author

Actually, I have almost the complete CTAN installed. However, they all reside in the Program Files\...\config instead of the %APPDATA% section (this packages.ini has about 15000 lines). I would say this means they are all admin-mode installed packages, quite in contrast to what the MikTeX console say, which reports them all as user mode. And in fact, I installed them in admin mode.
My point in reporting this was not so much my installation which out of all sudden seems to be broken, but that probably the "Reset personal MikTeX configuration" option in the console is buggy: To me, it seems to reset all user-mode configuration options (good) while at the same time tells MikTeX that actually, there is no admin configuration, i.e. no admin-mode installed packages, ... (bad). Still, all packages were installed in admin mode and remain in the programs folder. But now, no MikTeX tool will ever start again in admin mode, and hence it is no longer possible to make any changes (or perhaps only removals are disallowed) to the packages. At least this is my reasoning so far.

@edocevoli
Copy link
Member

Since you said

On this system, there were no previous installations. The HKLM keys do not exist.

I was under the impression that you have a pure user installation. It turns out that you once had a shared setup. Correct?

Somehow the HKLM key has been deleted and now the MiKTeX installation is broken.

@projekter
Copy link
Author

Exactly. When I installed some years ago, this was a shared setup. I never deliberatly made any non-admin changes, but I suppose I at least once forgot these, so that the format files were in fact user-managed. Hence, they were not affected by my usual system-level changes. I thought I could simply remove the few user-based entries using the "Reset personal MikTeX configuration" function, but it rather looks like it deleted anything that made MikTeX know it was a shared setup in the first place.

@edocevoli
Copy link
Member

I will try to reproduce the issue ("Reset personal MikTeX configuration" is broken).

It should be possible to restore the HKLM key. I will later post a .reg file.

@edocevoli
Copy link
Member

There is no problem with the latest MiKTeX version: Reset personal MikTeX configuration does not delete the HKLM key: the issue has been fixed with one of the latest MiKTeX updates.

You can restore the the HKLM key as follows:

reg add HKLM\Software\MiKTeX.org\MiKTeX\2.9\Core /v SharedSetup /d 1
reg add HKLM\Software\MiKTeX.org\MiKTeX\2.9\Core /v LastAdminMaintenance /d 1573824075

@projekter
Copy link
Author

Great, thanks! This looks a lot better.

@projekter
Copy link
Author

After I experienced a problem that MikTeX for some reason re-built format files in user mode (though I only performed package updates in admin mode), I again selected Reset personal MikTeX configuration and ended up again with precisely the same issue as before. Again, adding the registry keys solved the problems, but it looks like the button still deletes those keys. My MikTeX distribution was up-to-date (dated by today) before I performed the reset.

@projekter projekter reopened this Feb 10, 2020
@edocevoli
Copy link
Member

If you run MiKTeX Console as MiKTeX user, it should not be possible to delete HKLM keys. You simply don't have the permissions.

@projekter
Copy link
Author

The Console itself has the permissions (from the OS perspective), as I don't use UAC restrictions. It is an application with administrator privileges, but runs in MikTeX user mode.

@edocevoli
Copy link
Member

Okay, thank you. Indeed, if you run elevated, then these HKLM keys will be deleted. It's a bug.

@edocevoli edocevoli self-assigned this Feb 10, 2020
@edocevoli edocevoli added this to the 2.9.7300 milestone Feb 10, 2020
@projekter
Copy link
Author

The perhaps this is also related to another message (which I don't know whether it does any harm or not): All compilers give a warning, e.g., lualatex-dev: warning: running with elevated privileges (they themselves do not have an --admin switch). However, when some changes to the package repsitory, FNDB, ... occurred, the compiler calls initexmf, which then warns that Option --admin should be specified when running this program with administrator privileges. I now wonder if maybe at this stage initexmf might create some user-level configuration, although it could (should?) only modify the system-wide configuration. Perhaps introducing an --admin switch for the compilers that does nothing than passing it on to initexmf might give some control of this to the user, if you see the possibility of an issue.

@edocevoli
Copy link
Member

It is possible to run tools like pdflatex automatically in admin mode (if elevated):

initexmf --admin --set-config-value=[Core]AutoAdmin=t

@edocevoli
Copy link
Member

This has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants