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

Snap 3.3.3 breaks previous version (3.1.1) functionality #4945

Closed
SteffenBrinckmann opened this issue Jan 4, 2024 · 11 comments
Closed

Snap 3.3.3 breaks previous version (3.1.1) functionality #4945

SteffenBrinckmann opened this issue Jan 4, 2024 · 11 comments
Labels

Comments

@SteffenBrinckmann
Copy link

Snap automatically pushes new versions to its users, after having run with couchdb 3.1.1 successfully; the new 3.3.3 snap that was uploaded on Jan 2nd breaks because of setcookie=monsters

Description

(I know I can revert snaps but that does not fix the issue going forward and for new installations)

Linux/Ubuntu: single node installation:
If one installed 3.1.1 couchdb via snap, the installation was "sudo snap set couchdb admin={password}". After the new 3.3.3 version was pushed to the snap server, the new versions are automatically installed on the users computers. However, with 3.3.3 a cookie is required (installation documentation: "sudo snap set couchdb admin={password} setcookie={cookie}"), since the old configuration does not have a cookie, couchdb stops with "Monster detected ohno!, aborting startup."

Even if I use the new install command "sudo snap set couchdb admin=[your-password] setcookie=[your-cookie]" the installation does not succeed, as I get
"""
error: cannot perform the following tasks:

  • Run configure hook of "couchdb" snap (snap "couchdb" has no "configure" hook)
    """

Also snap set setcookie does not succeed.

Therefore, I went into /var/snap/couchdb/current/etc/vm.args and add a random cookie there. Still no success:
as the initialize_nodelist(line 110) fails to initialize.

Steps to Reproduce

sudo snap set couchdb admin=[your-password] setcookie=[your-cookie]

Expected Behaviour

ability to load http:https://127.0.0.1:5984/_utils/ or curl http:https://127.0.0.1:5984

Your Environment

  • CouchDB version used: 3.3.3
  • Browser name and version: -
  • Operating system and version: Ubuntu 22.04

Additional Context

@big-r81
Copy link
Contributor

big-r81 commented Jan 4, 2024

Hi,

However, with 3.3.3 a cookie is required (installation documentation: "sudo snap set couchdb admin={password} setcookie={cookie}"), since the old configuration does not have a cookie, couchdb stops with "Monster detected ohno!, aborting startup."

The cookie value with this message is "monster", which isn't allowed anymore. Can you look into your vm.args file and change it to another value and try to restart your server?

@SteffenBrinckmann
Copy link
Author

Hey,
I changed it to a custom value. But then I get "initialize_nodelist(line 110) fails to initialize" which I tried to explain in the issue.
To verify: the user is expected to change vm.args and then it should work?
Why is the documentation stating something else (it should be set with "snap set ..."?
Best, Steffen

@sklassen
Copy link
Contributor

sklassen commented Jan 4, 2024

The snap hook should be found here.

ls -l /snap/couchdb/current/snap/hooks/configure 
-rwxr-xr-x 1 root root 1672 Nov 17 18:05 /snap/couchdb/current/snap/hooks/configure

You can try this to see if the script is working for you

$ cd /var/snap/couchdb/current/etc
$ grep setcookie vm.args 
-setcookie dOAAd8fWUua3Ca8cmaSdGU3gAn35gPH0z7Xmi4GLx4Q8E9Os
$ sudo snap set couchdb  setcookie=`echo $(dd if=/dev/random bs=1 count=38 status=none | base64 | tr -cd '[:alnum:]')`
$ grep setcookie vm.args 
-setcookie ySKMODxwg8qeY6OmtaTVe7LfFtSaQAZ4Z0UQVIXlIDtRu3E

But you can also edit the file by hand and restart the snap.

initialize_nodelist(line 110) fails to initialize sounds like a different issue. What else is in the logs?

@SteffenBrinckmann
Copy link
Author

SteffenBrinckmann commented Jan 4, 2024

Hey,
When I run it:

$ ls -l /snap/couchdb/current/snap/hooks/configure 
ls: cannot access '/snap/couchdb/current/snap/hooks/configure': No such file or directory

That might be the reason why 'sudo snap set' does not work.

Manual setting:

$  grep setcookie vm.args 
-setcookie UNX4319uTTWLyhyEl6WC0H2v492WFO5kGZAYzsh8cj1WIBvMU8
$ sudo snap restart couchdb
$ curl http:https://127.0.0.1:5984/
curl: (7) Failed to connect to 127.0.0.1 port 5984 after 0 ms: Connection refused

also does not work.

Here the log

$ tail -n 20 /var/log/syslog
Jan  4 10:51:57 abcde kernel: [ 7945.270124] audit: type=1400 audit(1704361917.930:6492): apparmor="DENIED" operation="open" profile="snap.couchdb.server" name="/sys/fs/cgroup/cgroup.controllers" pid=322552 comm="beam.smp" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan  4 10:51:57 abcde kernel: [ 7945.271858] audit: type=1400 audit(1704361917.934:6493): apparmor="DENIED" operation="open" profile="snap.couchdb.server" name="/sys/fs/cgroup/cgroup.controllers" pid=322552 comm="beam.smp" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.429844Z [email protected] <0.254.0> -------- Preflight check: Checking For Monsters
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.429920Z [email protected] <0.254.0> -------- Preflight check: Asserting Admin Account
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.432461Z [email protected] <0.254.0> -------- Apache CouchDB 3.3.3 is starting.
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.432512Z [email protected] <0.255.0> -------- Starting couch_sup
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.469990Z [email protected] <0.254.0> -------- Apache CouchDB has started. Time to relax.
Jan  4 10:51:58 abcde couchdb.server[322552]: [notice] 2024-01-04T09:51:58.474650Z [email protected] <0.377.0> -------- rexi_server : started servers
Jan  4 10:51:58 abcde couchdb.server[322552]: [notice] 2024-01-04T09:51:58.475527Z [email protected] <0.381.0> -------- rexi_buffer : started servers
Jan  4 10:51:58 abcde couchdb.server[322552]: [warning] 2024-01-04T09:51:58.495393Z [email protected] <0.389.0> -------- creating missing database: _nodes
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.495437Z [email protected] <0.390.0> -------- open_result error {not_found,no_db_file} for _nodes
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.496611Z [email protected] <0.394.0> -------- open_result error {not_found,no_db_file} for _nodes
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.496863Z [email protected] <0.387.0> -------- Supervisor mem3_sup had child mem3_nodes started with mem3_nodes:start_link() at undefined exit with reason no case clause matching {not_found,no_db_file} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226) in context start_error
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.497016Z [email protected] <0.387.0> -------- Supervisor mem3_sup had child mem3_nodes started with mem3_nodes:start_link() at undefined exit with reason no case clause matching {not_found,no_db_file} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226) in context start_error
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.497147Z [email protected] <0.389.0> -------- CRASH REPORT Process  (<0.389.0>) with 0 neighbors crashed with reason: no case clause matching {not_found,no_db_file} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {mem3_nodes,init,['Argument__1']}, ancestors: [mem3_sup,<0.386.0>], message_queue_len: 0, links: [<0.387.0>], dictionary: [{io_priority,{system,<<"_nodes">>}}], trap_exit: false, status: running, heap_size: 987, stack_size: 29, reductions: 48397
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.497251Z [email protected] <0.389.0> -------- CRASH REPORT Process  (<0.389.0>) with 0 neighbors crashed with reason: no case clause matching {not_found,no_db_file} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {mem3_nodes,init,['Argument__1']}, ancestors: [mem3_sup,<0.386.0>], message_queue_len: 0, links: [<0.387.0>], dictionary: [{io_priority,{system,<<"_nodes">>}}], trap_exit: false, status: running, heap_size: 987, stack_size: 29, reductions: 48397
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.497387Z [email protected] <0.385.0> -------- CRASH REPORT Process  (<0.385.0>) with 0 neighbors exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{not_found,no_db_file}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,...]}} at application_master:init/4(line:142) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {application_master,init,['Argument__1','Argument__2',...]}, ancestors: [<0.384.0>], message_queue_len: 1, links: [<0.384.0>,<0.16.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 29, reductions: 205
Jan  4 10:51:58 abcde couchdb.server[322552]: [error] 2024-01-04T09:51:58.497624Z [email protected] <0.385.0> -------- CRASH REPORT Process  (<0.385.0>) with 0 neighbors exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{not_found,no_db_file}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,...]}} at application_master:init/4(line:142) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {application_master,init,['Argument__1','Argument__2',...]}, ancestors: [<0.384.0>], message_queue_len: 1, links: [<0.384.0>,<0.16.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 29, reductions: 205
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.497814Z [email protected] <0.16.0> -------- Application mem3 exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{not_found,no_db_file}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,...]}}
Jan  4 10:51:58 abcde couchdb.server[322552]: [info] 2024-01-04T09:51:58.497919Z [email protected] <0.16.0> -------- Application mem3 exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{not_found,no_db_file}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,...]}}

Thanks for your help!
Best, SB

@SteffenBrinckmann
Copy link
Author

For additional information

$ snap info couchdb
name:      couchdb
summary:   RESTful document oriented database - Apache CouchDB has started. Time to relax.
publisher: Apache CouchDB
store-url: https://snapcraft.io/couchdb
license:   unset
description: |
  Apache CouchDB ™ lets you access your data where you need it. The Couch Replication Protocol is [...]                                                                                                                                
  https://github.com/apache/couchdb-pkg/blob/main/README-SNAP.md                                                                                                                                                                                             
commands:                                                                                                                                                                                                                                                    
  - couchdb                                                                                                                                                                                                                                                  
  - couchdb.couchjs                                                                                                                                                                                                                                          
  - couchdb.remsh                                                                                                                                                                                                                                            
services:                                                                                                                                                                                                                                                    
  couchdb.server: simple, enabled, active                                                                                                                                                                                                                    
snap-id:      i06N6KdQXS4HwhSkymgGClpopBOojRAt
tracking:     latest/stable
refresh-date: today at 08:43 CET
channels:
  latest/stable:    3.3.3 2024-01-02 (15) 47MB -
  latest/candidate: 3.3.3 2024-01-02 (15) 47MB -
  latest/beta:      ↑                          
  latest/edge:      ↑                          
  2.x/stable:       2.3.1 2020-03-18  (5) 46MB -
  2.x/candidate:    ↑                          
  2.x/beta:         ↑                          
  2.x/edge:         ↑                          
installed:          3.3.3            (15) 47MB -

@sklassen
Copy link
Contributor

sklassen commented Jan 4, 2024

Okay, those hooks are missing. You'll need to change by hand for the moment.

cd /var/snap/couchdb/current/etc

edit local.ini

Ensure that you have this stanza

[couchdb]
database_dir = /var/snap/couchdb/common/data
view_index_dir = /var/snap/couchdb/common/data
.
.

then snap restart and check the logs again.

@SteffenBrinckmann
Copy link
Author

That fixes the issue for me

$ curl http:https://127.0.0.1:5984/
{"couchdb":"Welcome","version":"3.3.3","git_sha":....

Thank you!

How will this issue continue: will there be a fix to do things automatically or should the user do things manually?

@sklassen
Copy link
Contributor

sklassen commented Jan 4, 2024

Good. The next snap revision will include the hooks.

@SteffenBrinckmann
Copy link
Author

Great

@big-r81
Copy link
Contributor

big-r81 commented Jan 4, 2024

Recreated and uploaded the snap packages!

@SteffenBrinckmann
Copy link
Author

Thanks! The new snap works like a charm.

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

3 participants