Coding Edgar
Coding Edgar

Reputation: 1465

EventStoreDB v5 Fail to run after using sudo

I normally run eventstore with eventstore --run-projections=System but trying to run queries, macos throw a security complain: “libjs1.dylib” cannot be opened because the developer cannot be verified.

So I ran sudo eventstore --run-projections=System. This did not fix the issue. I wen to system preferences > security > general and gave access to libjs1.dylib and the Query ran and returned no value.

I realized all the data from event store was gone.

I though maybe it becase sudo? I ran without sudo and now I get this error:

[34307,01,18:12:12.463]
“ES VERSION:” “5.0.5.0” (“HEAD”/“b92e517ced0aada066f9f525e02082cdbdb34d7f”, “Fri, 13 Sep 2019 16:29:49 +0200”)
[34307,01,18:12:12.487] “OS:” MacOS (Unix 19.5.0.0)
[34307,01,18:12:12.494] “RUNTIME:” “5.16.0.220 (2018-06/bb3ae37d71a Fri Nov 16 17:12:11 EST 2018)” (64-bit)
[34307,01,18:12:12.494] “GC:” “2 GENERATIONS”
[34307,01,18:12:12.494] “LOGS:” “/var/log/eventstore”
MODIFIED OPTIONS:

    RUN PROJECTIONS:          System (Command Line)
DEFAULT OPTIONS:

    HELP:                     False (<DEFAULT>)
    VERSION:                  False (<DEFAULT>)
    LOG:                      /var/log/eventstore (<DEFAULT>)
    CONFIG:                   <empty> (<DEFAULT>)
    DEFINES:                  <empty> (<DEFAULT>)
    WHAT IF:                  False (<DEFAULT>)
    START STANDARD PROJECTIONS: False (<DEFAULT>)
    DISABLE HTTP CACHING:     False (<DEFAULT>)
    MONO MIN THREADPOOL SIZE: 10 (<DEFAULT>)
    INT IP:                   127.0.0.1 (<DEFAULT>)
    EXT IP:                   127.0.0.1 (<DEFAULT>)
    INT HTTP PORT:            2112 (<DEFAULT>)
    EXT HTTP PORT:            2113 (<DEFAULT>)
    INT TCP PORT:             1112 (<DEFAULT>)
    INT SECURE TCP PORT:      0 (<DEFAULT>)
    EXT TCP PORT:             1113 (<DEFAULT>)
    EXT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    EXT SECURE TCP PORT:      0 (<DEFAULT>)
    EXT IP ADVERTISE AS:      <empty> (<DEFAULT>)
    EXT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    EXT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT IP ADVERTISE AS:      <empty> (<DEFAULT>)
    INT SECURE TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT TCP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT HTTP PORT ADVERTISE AS: 0 (<DEFAULT>)
    INT TCP HEARTBEAT TIMEOUT: 700 (<DEFAULT>)
    EXT TCP HEARTBEAT TIMEOUT: 1000 (<DEFAULT>)
    INT TCP HEARTBEAT INTERVAL: 700 (<DEFAULT>)
    EXT TCP HEARTBEAT INTERVAL: 2000 (<DEFAULT>)
    GOSSIP ON SINGLE NODE:    False (<DEFAULT>)
    CONNECTION PENDING SEND BYTES THRESHOLD: 10485760 (<DEFAULT>)
    CONNECTION QUEUE SIZE THRESHOLD: 50000 (<DEFAULT>)
    FORCE:                    False (<DEFAULT>)
    CLUSTER SIZE:             1 (<DEFAULT>)
    NODE PRIORITY:            0 (<DEFAULT>)
    MIN FLUSH DELAY MS:       2 (<DEFAULT>)
    COMMIT COUNT:             -1 (<DEFAULT>)
    PREPARE COUNT:            -1 (<DEFAULT>)
    ADMIN ON EXT:             True (<DEFAULT>)
    STATS ON EXT:             True (<DEFAULT>)
    GOSSIP ON EXT:            True (<DEFAULT>)
    DISABLE SCAVENGE MERGING: False (<DEFAULT>)
    SCAVENGE HISTORY MAX AGE: 30 (<DEFAULT>)
    DISCOVER VIA DNS:         True (<DEFAULT>)
    CLUSTER DNS:              fake.dns (<DEFAULT>)
    CLUSTER GOSSIP PORT:      30777 (<DEFAULT>)
    GOSSIP SEED:              <empty> (<DEFAULT>)
    STATS PERIOD SEC:         30 (<DEFAULT>)
    CACHED CHUNKS:            -1 (<DEFAULT>)
    READER THREADS COUNT:     4 (<DEFAULT>)
    CHUNKS CACHE SIZE:        536871424 (<DEFAULT>)
    MAX MEM TABLE SIZE:       1000000 (<DEFAULT>)
    HASH COLLISION READ LIMIT: 100 (<DEFAULT>)
    DB:                       /var/lib/eventstore (<DEFAULT>)
    INDEX:                    <empty> (<DEFAULT>)
    MEM DB:                   False (<DEFAULT>)
    SKIP DB VERIFY:           False (<DEFAULT>)
    WRITE THROUGH:            False (<DEFAULT>)
    UNBUFFERED:               False (<DEFAULT>)
    CHUNK INITIAL READER COUNT: 5 (<DEFAULT>)
    PROJECTION THREADS:       3 (<DEFAULT>)
    WORKER THREADS:           5 (<DEFAULT>)
    PROJECTIONS QUERY EXPIRY: 5 (<DEFAULT>)
    FAULT OUT OF ORDER PROJECTIONS: False (<DEFAULT>)
    INT HTTP PREFIXES:        <empty> (<DEFAULT>)
    EXT HTTP PREFIXES:        <empty> (<DEFAULT>)
    ENABLE TRUSTED AUTH:      False (<DEFAULT>)
    ADD INTERFACE PREFIXES:   True (<DEFAULT>)
    CERTIFICATE STORE LOCATION: <empty> (<DEFAULT>)
    CERTIFICATE STORE NAME:   <empty> (<DEFAULT>)
    CERTIFICATE SUBJECT NAME: <empty> (<DEFAULT>)
    CERTIFICATE THUMBPRINT:   <empty> (<DEFAULT>)
    CERTIFICATE FILE:         <empty> (<DEFAULT>)
    CERTIFICATE PASSWORD:     <empty> (<DEFAULT>)
    USE INTERNAL SSL:         False (<DEFAULT>)
    DISABLE INSECURE TCP:     False (<DEFAULT>)
    SSL TARGET HOST:          n/a (<DEFAULT>)
    SSL VALIDATE SERVER:      True (<DEFAULT>)
    AUTHENTICATION TYPE:      internal (<DEFAULT>)
    AUTHENTICATION CONFIG:    <empty> (<DEFAULT>)
    DISABLE FIRST LEVEL HTTP AUTHORIZATION: False (<DEFAULT>)
    PREPARE TIMEOUT MS:       2000 (<DEFAULT>)
    COMMIT TIMEOUT MS:        2000 (<DEFAULT>)
    UNSAFE DISABLE FLUSH TO DISK: False (<DEFAULT>)
    BETTER ORDERING:          False (<DEFAULT>)
    UNSAFE IGNORE HARD DELETE: False (<DEFAULT>)
    SKIP INDEX VERIFY:        False (<DEFAULT>)
    INDEX CACHE DEPTH:        16 (<DEFAULT>)
    OPTIMIZE INDEX MERGE:     False (<DEFAULT>)
    GOSSIP INTERVAL MS:       1000 (<DEFAULT>)
    GOSSIP ALLOWED DIFFERENCE MS: 60000 (<DEFAULT>)
    GOSSIP TIMEOUT MS:        500 (<DEFAULT>)
    ENABLE HISTOGRAMS:        False (<DEFAULT>)
    LOG HTTP REQUESTS:        False (<DEFAULT>)
    LOG FAILED AUTHENTICATION ATTEMPTS: False (<DEFAULT>)
    ALWAYS KEEP SCAVENGED:    False (<DEFAULT>)
    SKIP INDEX SCAN ON READS: False (<DEFAULT>)
    REDUCE FILE CACHE PRESSURE: False (<DEFAULT>)
    INITIALIZATION THREADS:   1 (<DEFAULT>)
    STRUCTURED LOG:           True (<DEFAULT>)
    MAX AUTO MERGE INDEX LEVEL: 2147483647 (<DEFAULT>)
    WRITE STATS TO DB:        True (<DEFAULT>)
[34307,01,18:12:12.508] {“defaults”:{“Help”:“False”,“Version”:“False”,“Log”:"/var/log/eventstore",“Config”:"",“Defines”:“System.String[]”,“WhatIf”:“False”,“StartStandardProjections”:“False”,“DisableHTTPCaching”:“False”,“MonoMinThreadpoolSize”:“10”,“IntIp”:“127.0.0.1”,“ExtIp”:“127.0.0.1”,“IntHttpPort”:“2112”,“ExtHttpPort”:“2113”,“IntTcpPort”:“1112”,“IntSecureTcpPort”:“0”,“ExtTcpPort”:“1113”,“ExtSecureTcpPortAdvertiseAs”:“0”,“ExtSecureTcpPort”:“0”,“ExtIpAdvertiseAs”:null,“ExtTcpPortAdvertiseAs”:“0”,“ExtHttpPortAdvertiseAs”:“0”,“IntIpAdvertiseAs”:null,“IntSecureTcpPortAdvertiseAs”:“0”,“IntTcpPortAdvertiseAs”:“0”,“IntHttpPortAdvertiseAs”:“0”,“IntTcpHeartbeatTimeout”:“700”,“ExtTcpHeartbeatTimeout”:“1000”,“IntTcpHeartbeatInterval”:“700”,“ExtTcpHeartbeatInterval”:“2000”,“GossipOnSingleNode”:“False”,“ConnectionPendingSendBytesThreshold”:“10485760”,“ConnectionQueueSizeThreshold”:“50000”,“Force”:“False”,“ClusterSize”:“1”,“NodePriority”:“0”,“MinFlushDelayMs”:“2”,“CommitCount”:"-1",“PrepareCount”:"-1",“AdminOnExt”:“True”,“StatsOnExt”:“True”,“GossipOnExt”:“True”,“DisableScavengeMerging”:“False”,“ScavengeHistoryMaxAge”:“30”,“DiscoverViaDns”:“True”,“ClusterDns”:“fake.dns”,“ClusterGossipPort”:“30777”,“GossipSeed”:“System.Net.IPEndPoint[]”,“StatsPeriodSec”:“30”,“CachedChunks”:"-1",“ReaderThreadsCount”:“4”,“ChunksCacheSize”:“536871424”,“MaxMemTableSize”:“1000000”,“HashCollisionReadLimit”:“100”,“Db”:"/var/lib/eventstore",“Index”:null,“MemDb”:“False”,“SkipDbVerify”:“False”,“WriteThrough”:“False”,“Unbuffered”:“False”,“ChunkInitialReaderCount”:“5”,“ProjectionThreads”:“3”,“WorkerThreads”:“5”,“ProjectionsQueryExpiry”:“5”,“FaultOutOfOrderProjections”:“False”,“IntHttpPrefixes”:“System.String[]”,“ExtHttpPrefixes”:“System.String[]”,“EnableTrustedAuth”:“False”,“AddInterfacePrefixes”:“True”,“CertificateStoreLocation”:"",“CertificateStoreName”:"",“CertificateSubjectName”:"",“CertificateThumbprint”:"",“CertificateFile”:"",“CertificatePassword”:"",“UseInternalSsl”:“False”,“DisableInsecureTCP”:“False”,“SslTargetHost”:“n/a”,“SslValidateServer”:“True”,“AuthenticationType”:“internal”,“AuthenticationConfig”:"",“DisableFirstLevelHttpAuthorization”:“False”,“PrepareTimeoutMs”:“2000”,“CommitTimeoutMs”:“2000”,“UnsafeDisableFlushToDisk”:“False”,“BetterOrdering”:“False”,“UnsafeIgnoreHardDelete”:“False”,“SkipIndexVerify”:“False”,“IndexCacheDepth”:“16”,“OptimizeIndexMerge”:“False”,“GossipIntervalMs”:“1000”,“GossipAllowedDifferenceMs”:“60000”,“GossipTimeoutMs”:“500”,“EnableHistograms”:“False”,“LogHttpRequests”:“False”,“LogFailedAuthenticationAttempts”:“False”,“AlwaysKeepScavenged”:“False”,“SkipIndexScanOnReads”:“False”,“ReduceFileCachePressure”:“False”,“InitializationThreads”:“1”,“StructuredLog”:“True”,“MaxAutoMergeIndexLevel”:“2147483647”,“WriteStatsToDb”:“True”},“modified”:{“RunProjections”:“System”}}
[34307,01,18:12:12.518] Quorum size set to 1
[34307,01,18:12:12.526] Cannot find plugins path: “/usr/local/share/eventstore/plugins”
[34307,01,18:12:12.558] Unhandled exception while starting application:
EXCEPTION OCCURRED
Access to the path “/var/lib/eventstore/writer.chk” is denied.
[34307,01,18:12:12.572] “Access to the path “/var/lib/eventstore/writer.chk” is denied.”
EXCEPTION OCCURRED
Access to the path “/var/lib/eventstore/writer.chk” is denied.

(I tried to ran with sudo again and the program starts without problem, but with no data)

I’m guessing sudo changes default paths, and doesn’t get reversed without sudo.

Also added this in the forum: https://discuss.eventstore.com/t/fail-to-run-after-using-sudo/2748/2

Upvotes: 1

Views: 581

Answers (1)

Alexey Zimarev
Alexey Zimarev

Reputation: 19630

Have you checked the docs? https://developers.eventstore.com/server/5.0.9/server/server/default-directories.html#macos

The data isn't gone, but the database path for the root user won't match the path for the regular user, so your database has been created elsewhere.

Here is the docs note:

On macOS you will get permissions error if you run eventstore without sudo. We advise changing the configuration file and change the Db option to a place where you have access as the normal user.

When running with sudo, the database is located at /var/lib/eventstore. I suspect then when you run it without sudo, the database was places under /usr/local/Caskroom/eventstore/5.0.8/EventStore-OSS-MacOS-macOS-v5.0.8 somewhere.

Honestly, I avoid running EventStoreDB on macOS from the cask and use Docker instead. It's more predictable, doesn't have issues and allows you to run different versions without issues.

Upvotes: 1

Related Questions