Sync_gateway illegal user name


#1

When I try to install sync gateway using the command, $ sudo ./sync_gateway_service_install.sh
as per following this URL, https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html

I am getting the following illegal user name error in Terminal. I am installing on MacBook. What does this error mean? I have sync_gateway folder created under ‘users’ and there are folders like ‘data’, ‘logs’ and sync_gateway.json file there.
What does this sync_gateway folder mean? Does this a bucket name similar to given in server? Why does this error ‘illegal user name’ come?

MyMacbook:service administrator$ sudo ./sync_gateway_service_install.sh
Password:
chown: sync_gateway: illegal user name
chown: sync_gateway: illegal user name
MyMacbook:service administrator$


#2

I’m not sure why this is happening (attn @traun ) .

In the mean time, you can start it from the command prompt instead of as a service. From the directory where you unzipped Sync Gateway, run:

~/Downloads/couchbase-sync-gateway/bin/sync_gateway <path_to_optional_sync_gateway_config.json>

#3

Sure, I’ll try. I am using MacBook. Path to sync gateway config.json is the one I have it in “Users/sync_gateway/sync_gateway.json” ? or It might be somewhere else?


#4

Users/sync_gateway/sync_gateway.json: contains the following data.
{
“log”: [“HTTP+”],
“adminInterface”: “127.0.0.1:4985”,
“interface”: “0.0.0.0:4984”,
“databases”: {
“db”: {
“server”: “walrus:data”,
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”: ["*"] }
}
}
}
}
Do I need to modify this with my server bucket DB name, server?


#5

Sure, I’ll try. Path to sync gateway config.json is the one I have it in Users/sync_gateway/sync_gateway.json ?

No, in this case it’s the relative path. Create the sync-gateway-config.json file in the bin directory and then run ~/Downloads/couchbase-sync-gateway/bin/sync_gateway sync-gateway-config.json.


#7

I created a empty “sync-gateway-config.json” in " ~/Downloads/couchbase-sync-gateway/bin". and run this command. Here is the result,

2017-04-25T10:30:42.476-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:30:45.043-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:30:50.166-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:31:00.412-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:31:20.897-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:31:20.899-05:00 WARNING: RetryLoop for Attempt to connect to bucket : db giving up after 14 attempts – base.RetryLoop() at util.go:301
2017-04-25T10:31:20.899-05:00 FATAL: Error opening database: 502 Unable to connect to Couchbase Server (connection refused). Please ensure it is running and reachable at the configured host and port. Detailed error: HTTP error 401 Unauthorized getting “http://localhost:8091/pools”: – rest.RunServer() at config.go:758
MyMacbook:Downloads administrator$

Bucket name may be causing with this error? Where Can I change bucket name? I don’t have bucket name like “db” in Couchbase server. I have default bucket names “travel-sample” etc.
Couchbase server is running fine.


#8

you can follow this section to connect Sync Gateway to Couchbase Server


#9

Thanks, but I followed the same. Here is my “sync-gateway-config.json” in " ~/Downloads/couchbase-sync-gateway/bin"

{
“log”: [“HTTP+”],
“adminInterface”: “127.0.0.1:4985”,
“interface”: “0.0.0.0:4984”,
“databases”: {
“db”: {
“server”: “http://localhost:8091”,
“bucket”: “travel-sample”,
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”: ["*"] }
}
}
}
}

2017-04-25T10:46:56.019-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:47:16.568-05:00 Opening Couchbase database db on http://localhost:8091 as user "db"
2017-04-25T10:47:16.570-05:00 WARNING: RetryLoop for Attempt to connect to bucket : db giving up after 14 attempts – base.RetryLoop() at util.go:301
2017-04-25T10:47:16.570-05:00 FATAL: Error opening database: 502 Unable to connect to Couchbase Server (connection refused). Please ensure it is running and reachable at the configured host and port. Detailed error: HTTP error 401 Unauthorized getting “http://localhost:8091/pools”: – rest.RunServer() at config.go:758
MyMacbook:Downloads administrator$

Attached reference screenshot is for couchbase server and buckets,


#10

Please ignore my previous comments. Now I got ‘server starting …’ message,

MyMacbook:Downloads administrator$ ~/Downloads/couchbase-sync-gateway/bin/sync_gateway sync-gateway-config.json
2017-04-25T10:56:31.715-05:00 Enabling logging: [HTTP+]
2017-04-25T10:56:31.716-05:00 ==== Couchbase Sync Gateway/1.4.1(3;ddffd85) ====
2017-04-25T10:56:31.716-05:00 Configured process to allow 5000 open file descriptors
2017-04-25T10:56:31.716-05:00 Opening db /db as bucket “travel-sample”, pool “default”, server http://localhost:8091
2017-04-25T10:56:31.716-05:00 Opening Couchbase database travel-sample on http://localhost:8091 as user “travel-sample”
_time=2017-04-25T10:56:31.737-05:00 _level=INFO _msg= Trying with http://127.0.0.1:8091/pools/default/bucketsStreaming/travel-sample
_time=2017-04-25T10:56:31.737-05:00 _level=INFO _msg= Trying with selected node 0
_time=2017-04-25T10:56:31.741-05:00 _level=INFO _msg=Got new configuration for bucket travel-sample
_time=2017-04-25T10:56:32.145-05:00 _level=INFO _msg= Trying with selected node 0
2017-04-25T10:56:32.523-05:00 Using default sync function ‘channel(doc.channels)’ for database "db"
2017-04-25T10:56:32.524-05:00 Reset guest user to config
2017-04-25T10:56:32.525-05:00 Starting admin server on 127.0.0.1:4985
2017-04-25T10:56:32.533-05:00 Starting server on 0.0.0.0:4984 …


#11

I think the sync gateway and server is running fine. I am trying to run sample project > GrocerySync. In the sample > GrocerySync iOS project, i modified like below,
#define kDatabaseName @“travel-sample”
#define kServerDbURL @“http://localhost:4984/travel-sample/

and, also modified “sync_gateway_config.json” which is inside this project,

{
“log”: [“HTTP+”],
“databases”: {
“db”: {
“server”: “http://localhost:8091”,
“bucket”: “travel-sample”,
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”: ["*"] }
}
}
}
}

**> But i see the log as , **
> 2017-04-25T11:47:09.184-05:00 HTTP: #002: POST /travel-sample/_revs_diff
> 2017-04-25T11:47:09.184-05:00 HTTP: #002: --> 404 no such database “travel-sample” (0.3 ms)


#12

In case you haven’t figured this out already -
The “db” under “databases” in the sync_gateway_config.json file refers to the name of the database. So, you will have to replace “db” with “travel-sample” (the name of your new database) and restart the Sync Gateway.

regards
-Priya


#13

Thank you, I’ll try changing the DB name instead of “db”


#14

Running into the same problem SG 1.5. Pointing to Couchbase-Server 5.0 with travel-sample bucket. Tried just the bucket as travel-sample, and then also the db as travel-sample.

The sync_gateway.json looks like this now:

{
“log”: [“HTTP+”],
“adminInterface”: “127.0.0.1:4985”,
“interface”: “0.0.0.0:4984”,
“databases”: {
“travel-sample”: {
“server”:“http://localhost:8091”,
“bucket”:“travel-sample”,
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”: ["*"] }
}
}
}
}

Still get the following:
chown: sync_gateway: illegal user name
chown: sync_gateway: illegal user name


#15

Assumed you configured a user on the Couchbase server to access the travel-sample bucket, specify that in your Sync GW config file …

"server": "http://localhost:8091",
"username": "<replace_with_username>",
"password": "<replace_with_password>",

#16

Thanks Priya. I am using the out-of-box Docker-based sample, for which I added default admin credentials into the travel-sample db. Same results. Do I need to create a different user and grant access to the bucket?


#17

OK, for my clarification -

  • You have this admin user configured under Settings->users tab on Couchbase server admin console
  • And you specified that user name/credentials in the Sync Gateway config file as well (as indicated earlier)

And you are still seeing issues?


#18

I uninstalled the Docker instance of Couchbase-Server 5.0, and installed it just as an app. Noticed that each bucket now requires a user. The default admin account did not show up under Users, so I created one, and gave full bucket access to the travel-sample bucket.That is the only permission I gave the new user.

Then I restarted sync gateway with the new user’s credentials. The admin port started, but it hasn’t connected to Couchbase Server. The new error is:

go-couchbase: TAP connection lost; reconnecting to bucket “travel-sample” in 1s

Thanks for helping me out, Priya.


#19

I am running into the same issue. I just followed the instructions at https://developer.couchbase.com/documentation/mobile/2.0/installation/sync-gateway/index.html
and when running the *install.sh script I get:

chown: sync_gateway: illegal group name
chown: sync_gateway: illegal user name
chown: sync_gateway: illegal user name

I’m also OSX High Sierra.


#20

This is an issue with accounts on your system. By default, the install script expects to set everything up to run as user “sync_gateway”, but it doesn’t create the actual user account for you.

You can either create an account to run under, or just run it as yourself. Specify the account with the --runas option.


#21

I created a gist showing how to set up a user dedicated to running Sync Gateway here