microsoftarchive / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes
http://redis.io
Other
20.78k stars 5.37k forks source link

Runtime error when installing as service with insufficient priviledges from Chocolatey #365

Open Wirone opened 8 years ago

Wirone commented 8 years ago

I have business laptop without admin account access, but with Chocolatey installed with admin priviledges (yeah, weird). When I run choco install redis-64 it's installed properly, but when I run redis-server --service-install I got HandleServiceCommands: runtime error caught. message=invalid handle passed to constructor.

Problem exists both in Windows' command line and Cygwin's console.

I ended up with installation from msi package with company admins' support, so service is already installed, running and working properly. But I think in that first case message should be different.

enricogior commented 8 years ago

Hi @Wirone thank you for posting the issue. I agree, the error message is not user friendly at all, it should give a better indication of the problem that, as you said, it's caused by not having the admin privileges. Thank you.

BigBlueHat commented 8 years ago

@enricogior I just tried using the redis-server --service-install command, but hit the same issue...while in a "Run as Administrator" cmd instance--the same one I used to run the choco install redis-64 account in.

Not sure how to get around it. :confused:

mattwoberts commented 8 years ago

Same here- running in a admin command prompt I get this error

C:\Windows\system32>redis-server --service-install [10960] 29 Jan 10:50:58.807 # HandleServiceCommands: system error caught. error code=1073, message = CreateService failed: unknown error

enricogior commented 8 years ago

@BigBlueHat @mattwoberts if you call the redis-server --service-install command without passing a configuration file (i.e redis-server --service-install redis-windows-service.conf) the working directory by default is the folder where the binaries are, therefore the NETWORK SERVICE account needs to have read and write access to the that folder. Since it doesn't have access to the chocolatey lib folder, the command fails. In general, if you need to run redis as a service, is preferable to use the MSI installer.

colltoaction commented 7 years ago

@enricogior yeah but Chocolatey is great and we'd like to use it! Is there any other way to workaround this?

E.g. I can make it work with:

choco install redis-64
cd C:\ProgramData\chocolatey\lib\redis-64\
redis-server --service-install .\redis.windows-service.conf
enricogior commented 7 years ago

Hi @tinchou sorry, I'm not working on this project anymore.

DevMostafa commented 5 years ago

The same error when running it out with the full command containing the config file path:

redis-server --service-install .\redis.windows-service.conf

Anybody knew the solution to this error?

JesusPuga commented 4 years ago

The same error when running it out with the full command containing the config file path:

redis-server --service-install .\redis.windows-service.conf

Anybody knew the solution to this error?

@DevMostafa Did u solve it? I have the same error executing the command