all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* weird errors
@ 2018-01-13 17:00 Catonano
  2018-01-13 21:13 ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-13 17:00 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 5780 bytes --]

Ok, I'm trying to build this tryton service

In running a VM like this

/gnu/store/9qcwl2vl8lnfbiid31irj92ffcagrc45-run-vm.sh --serial stdio -m 2G

I run into this error:

...
In execvp of TRYTONPASSFILE =
/gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin:
No such file or directory
ERROR: In procedure scm-error:
ERROR: program "TRYTONPASSFILE =
/gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin"
exited with non-zero code 32512

I read on a random page in the internet that the code 32512 is given when
sh doesn't find an executable

So, inspecting
/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin

this is what I find:

~$ cat
/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin
#!/gnu/store/f8k940vy9gck66m9r4id5m098w3hxgka-bash-minimal-4.4.12/bin/bash
export
PYTHONPATH="/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/lib/python3.5/site-packages:/gnu/store/284w0ylkn07d2wi452wdlzi6r7jc7lgh-python-mock-1.0.1/lib/python3.5/site-packages:/gnu/store/pd791yb95476z517rvh178hhk58n8c7f-python-dateutil-2.6.0/lib/python3.5/site-packages:/gnu/store/b4m2rv4nr88i69wjp8hshc0wc36hzv8b-python-genshi-0.7/lib/python3.5/site-packages:/gnu/store/ggxg8igwls4zvwy2mn85m1cd7f8iw6ls-python-polib-1.0.8/lib/python3.5/site-packages:/gnu/store/b8k8jzjd7yi3fwk0bpq6iwfg8i0ph68b-python-magic-0.4.15/lib/python3.5/site-packages:/gnu/store/5h2bscbxf1iy56rad731ynqb6gi2a45f-python-psycopg2-2.7.3.1/lib/python3.5/site-packages:/gnu/store/zx6x4f0rap8ks7yfglvqq349agrkjbpd-python-relatorio-0.8.0/lib/python3.5/site-packages:/gnu/store/a2awr40fbbhi7ala2wip8j4nw6nhz85x-python-lxml-3.8.0/lib/python3.5/site-packages:/gnu/store/q3330wrmdj1vhfzrvz0w1hws7wbhn40q-python-sql-0.9/lib/python3.5/site-packages:/gnu/store/nch06kxa2y9czp7wwz4fbyp1s8c1g4in-python-werkzeug-0.11.15/lib/python3.5/site-packages:/gnu/store/4walcharyljdhyj1bfg5002i84cmzmxp-python-wrapt-1.10.8/lib/python3.5/site-packages:/gnu/store/jb3n0bsdpkhvyb8y70jyr8fcx8fqssr9-python-3.5.3/lib/python3.5/site-packages:/gnu/store/8f72v1ngblndikg9pf8ig0p3r5gc0gi7-python-six-1.10.0/lib/python3.5/site-packages${PYTHONPATH:+:}$PYTHONPATH"
exec -a "$0"
"/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/.trytond-admin-real"
"$@"

Logging into the VM I see this

root@antelope ~# ls
/gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/
trytond  trytond-admin  trytond-cron
root@antelope ~#

So, the file being called is ".trytond-admin-real" but that doesn't exist

Insted trytond-admin exist



Also, when I quit the Guile repl (like this: ",q") I see several of these
messages

Backtrace:
           3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
In ice-9/eval.scm:
   182:19  2 (proc #(#<directory (guile-user) 1fbb140> #("tryt?" ?) ?))
   142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
In unknown file:
           0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)

ERROR: In procedure %resolve-variable:
ERROR: Unbound variable: invoke
13 Jan 17:41:54 ntpd[387]: Listen normally on 5 eth0
[fe80::f4dc:1d61:f230:f197%2]:123
13 Jan 17:41:54 ntpd[387]: new interface(s) found: waking up resolver
Respawning trytond.
Service trytond has been started.
Backtrace:
           3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
In ice-9/eval.scm:
   182:19  2 (proc #(#<directory (guile-user) 1edb140> #("tryt?" ?) ?))
   142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
In unknown file:
           0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)

ERROR: In procedure %resolve-variable:
ERROR: Unbound variable: invoke
Respawning trytond.
Service trytond has been started.
Backtrace:
           3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
In ice-9/eval.scm:
   182:19  2 (proc #(#<directory (guile-user) 2236140> #("tryt?" ?) ?))
   142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
In unknown file:
           0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)

ERROR: In procedure %resolve-variable:
ERROR: Unbound variable: invoke
Respawning trytond.
Service trytond has been started.
Backtrace:
           3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
In ice-9/eval.scm:
   182:19  2 (proc #(#<directory (guile-user) 2767140> #("tryt?" ?) ?))
   142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
In unknown file:
           0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)

ERROR: In procedure %resolve-variable:
ERROR: Unbound variable: invoke
Service trytond has been disabled.
  (Respawning too fast.)


This is the GNU system.  Welcome.
antelope login: root
New session c1 of user root.
This is the GNU operating system, welcome!

invoke can't be found ?

How so ?
(guix build utils) is correctly imported as far as I can see

here's the relevant file
https://gitlab.com/humanitiesNerd/guix-hacks/blob/trytonservice/gnu/services/trytond.scm


Stangely, this command succeeds
make check-system TESTS="trytond"

It runs the only test thhaht I managed to write: it checks if trytond is
running

the failed invoke call is used in the activation, so trytond is running
without a postgres role and database having being created

It won't work

But it this case the VM can be created.

warning: failed to load '(gnu tests install)':
In procedure allocate-struct: Wrong type argument in position 2: 13
Running 1 system tests...
TOTAL: 1
PASS: /gnu/store/7x9dnx3z5amywyvll9cyxrqfwcij4hki-trytond-test

[-- Attachment #2: Type: text/html, Size: 6693 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-13 17:00 weird errors Catonano
@ 2018-01-13 21:13 ` Ludovic Courtès
  2018-01-14  7:21   ` Catonano
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2018-01-13 21:13 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

Heya,

Catonano <catonano@gmail.com> skribis:

> In execvp of TRYTONPASSFILE =
> /gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
> /gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin:
> No such file or directory
> ERROR: In procedure scm-error:
> ERROR: program "TRYTONPASSFILE =
> /gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
> /gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-admin"
> exited with non-zero code 32512

It’s trying to execute a program named “TRYTONPASSFILE = …/…”.  This
initial “TRYTONPASSFILE =” string is bogus, it’s not the name of the
program.

> Respawning trytond.
> Service trytond has been started.
> Backtrace:
>            3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
> In ice-9/eval.scm:
>    182:19  2 (proc #(#<directory (guile-user) 2767140> #("tryt?" ?) ?))
>    142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
> In unknown file:
>            0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)
>
> ERROR: In procedure %resolve-variable:
> ERROR: Unbound variable: invoke

‘invoke’ is in (guix build utils), so you need (use-modules (guix build
utils)) somewhere.

Specifically, in the ‘tryton-shepherd-service’ procedure you posted, you
need to define ‘start-script’ like this:

  (program-file "start-trytond"
                (with-imported-modules '((guix build utils))
                  #~(begin
                      (use-modules (guix build utils))

                      (let ((user …))
                        ;; …
                        (invoke …)))))

> warning: failed to load '(gnu tests install)':
> In procedure allocate-struct: Wrong type argument in position 2: 13

This suggests an ABI mismatch; run ‘make clean-go && make’.

HTH, looks like you’re almost there!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-13 21:13 ` Ludovic Courtès
@ 2018-01-14  7:21   ` Catonano
  2018-01-14 10:43     ` Danny Milosavljevic
  0 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-14  7:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2838 bytes --]

2018-01-13 22:13 GMT+01:00 Ludovic Courtès <ludo@gnu.org>:

> Heya,
>
> Catonano <catonano@gmail.com> skribis:
>
> > In execvp of TRYTONPASSFILE =
> > /gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
> > /gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-
> admin:
> > No such file or directory
> > ERROR: In procedure scm-error:
> > ERROR: program "TRYTONPASSFILE =
> > /gnu/store/3qpvdgkagkqyzpaw65c0plzd9zqp44v6-passfile
> > /gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/trytond-
> admin"
> > exited with non-zero code 32512
>
> It’s trying to execute a program named “TRYTONPASSFILE = …/…”.  This
> initial “TRYTONPASSFILE =” string is bogus, it’s not the name of the
> program.
>

TRYTONPASSFILE is supposed to be an environment variable forr trytond-admin
to consume

If TRYTONPASSFILE isn't set, tytond-admin will prompt the user and require
some interaction

the line is supposed to be like

TRYTOPASSILE = /path/to/some/passfile trytond-admin -c
trytond-conf-file.conf

that is

TRYTOPASSILE = /gnu/store/some-hash-passfile
/gnu/store/some-hash-trytond-admin -c
/gnu/stor/some-hash-trytond-conf-file.conf

The problem seesm to be that a call to some .trytond-admin-real can't be
satisfied

> Respawning trytond.
> > Service trytond has been started.
> > Backtrace:
> >            3 (primitive-load "/gnu/store/dh2mm0hk37q4cr4g390psp5y7jl?")
> > In ice-9/eval.scm:
> >    182:19  2 (proc #(#<directory (guile-user) 2767140> #("tryt?" ?) ?))
> >    142:16  1 (compile-top-call _ (7 . invoke) ((11 0 . 1) (10 # # ?)))
> > In unknown file:
> >            0 (%resolve-variable (7 . invoke) #<directory (guile-user?>)
> >
> > ERROR: In procedure %resolve-variable:
> > ERROR: Unbound variable: invoke
>
> ‘invoke’ is in (guix build utils), so you need (use-modules (guix build
> utils)) somewhere.
>
> Specifically, in the ‘tryton-shepherd-service’ procedure you posted, you
> need to define ‘start-script’ like this:
>
>   (program-file "start-trytond"
>                 (with-imported-modules '((guix build utils))
>                   #~(begin
>                       (use-modules (guix build utils))
>
>                       (let ((user …))
>                         ;; …
>                         (invoke …)))))
>

Ah, ok, I missed this



>
> > warning: failed to load '(gnu tests install)':
> > In procedure allocate-struct: Wrong type argument in position 2: 13
>
> This suggests an ABI mismatch; run ‘make clean-go && make’.
>
>
Ok


> HTH, looks like you’re almost there!  :-)
>

Thankks you Ludo !

Admittedly I'm a bit tired ;-)

I'll do this last turn of tries

If it doesn't work afer this, I'll abandon it and move on

I'll keep you posted !

[-- Attachment #2: Type: text/html, Size: 4236 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14  7:21   ` Catonano
@ 2018-01-14 10:43     ` Danny Milosavljevic
  2018-01-14 10:57       ` Danny Milosavljevic
  2018-01-14 11:00       ` Catonano
  0 siblings, 2 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-14 10:43 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

Hi Catonano,

On Sun, 14 Jan 2018 08:21:10 +0100
Catonano <catonano@gmail.com> wrote:

> the line is supposed to be like
> 
> TRYTOPASSILE = /path/to/some/passfile trytond-admin -c
> trytond-conf-file.conf
> 
> that is
> 
> TRYTOPASSILE = /gnu/store/some-hash-passfile
> /gnu/store/some-hash-trytond-admin -c
> /gnu/stor/some-hash-trytond-conf-file.conf

That only works with a shell - and the spaces marked below break it:

TRYTOPASSILE = /gnu/store/some-hash-passfile
            ^ ^

You'd need to remove those.  But even better instead do the following:

I'd just call (setenv "/gnu/store/some-hash-passfile") instead of starting a whole shell (it's a waste and increases the attach surface for no reason to use a shell here).

> The problem seesm to be that a call to some .trytond-admin-real can't be
> satisfied

I don't think so.  Did you check via "ls -a" ? (files whose names start with a dot are otherwise hidden from output)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 10:43     ` Danny Milosavljevic
@ 2018-01-14 10:57       ` Danny Milosavljevic
  2018-01-14 11:00       ` Catonano
  1 sibling, 0 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-14 10:57 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

On Sun, 14 Jan 2018 11:43:46 +0100
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> Hi Catonano,
> 
> On Sun, 14 Jan 2018 08:21:10 +0100
> Catonano <catonano@gmail.com> wrote:
> 
> > the line is supposed to be like
> > 
> > TRYTOPASSILE = /path/to/some/passfile trytond-admin -c
> > trytond-conf-file.conf
> > 
> > that is
> > 
> > TRYTOPASSILE = /gnu/store/some-hash-passfile
> > /gnu/store/some-hash-trytond-admin -c
> > /gnu/stor/some-hash-trytond-conf-file.conf  
> 
> That only works with a shell - and the spaces marked below break it:
> 
> TRYTOPASSILE = /gnu/store/some-hash-passfile
>             ^ ^
> 
> You'd need to remove those.  But even better instead do the following:
> 

Fixed typo:

I'd just call (setenv "TRYTOPASSILE" "/gnu/store/some-hash-passfile") instead of starting a whole shell (it's a waste and increases the attack surface for no reason to use a shell here).


> > The problem seesm to be that a call to some .trytond-admin-real can't be
> > satisfied  
> 
> I don't think so.  Did you check via "ls -a" ? (files whose names start with a dot are otherwise hidden from output)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 10:43     ` Danny Milosavljevic
  2018-01-14 10:57       ` Danny Milosavljevic
@ 2018-01-14 11:00       ` Catonano
  2018-01-14 16:38         ` Ricardo Wurmus
                           ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Catonano @ 2018-01-14 11:00 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Danny,

thanks for your help

2018-01-14 11:43 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> Hi Catonano,
>
> On Sun, 14 Jan 2018 08:21:10 +0100
> Catonano <catonano@gmail.com> wrote:
>
> > the line is supposed to be like
> >
> > TRYTOPASSILE = /path/to/some/passfile trytond-admin -c
> > trytond-conf-file.conf
>

firstable I apologize for having written "TYTONPASSILE"

Of course an F is missing, my keybord is driving me mad



> >
> > that is
> >
> > TRYTOPASSILE = /gnu/store/some-hash-passfile
> > /gnu/store/some-hash-trytond-admin -c
> > /gnu/stor/some-hash-trytond-conf-file.conf
>
> That only works with a shell - and the spaces marked below break it:
>

Ah, the spaces :-/


>
> TRYTOPASSILE = /gnu/store/some-hash-passfile
>             ^ ^
>
> You'd need to remove those.  But even better instead do the following:
>
> I'd just call (setenv "/gnu/store/some-hash-passfile") instead of
> starting a whole shell (it's a waste and increases the attach surface for
> no reason to use a shell here).
>

I can certainly do like you suggest. It's cleaner

But "trytond-admin" has to be called finally. Doesn't this require a shell
anyway ?



>
> > The problem seesm to be that a call to some .trytond-admin-real can't be
> > satisfied
>
> I don't think so.  Did you check via "ls -a" ? (files whose names start
> with a dot are otherwise hidden from output)
>

No, you' re right, it's there

~$ ls -lha /gnu/store/144hjm67pzq9x0v47hwfiabwqq219aya-trytond-4.6.2/bin/
totale 32K
dr-xr-xr-x 2 root root 4,0K  1 gen  1970 ./
dr-xr-xr-x 4 root root 4,0K  1 gen  1970 ../
-r-xr-xr-x 2 root root 1,5K  1 gen  1970 trytond
-r-xr-xr-x 2 root root 1,5K  1 gen  1970 trytond-admin
-r-xr-xr-x 3 root root  671  1 gen  1970 .trytond-admin-real
-r-xr-xr-x 2 root root 1,5K  1 gen  1970 trytond-cron
-r-xr-xr-x 2 root root  805  1 gen  1970 .trytond-cron-real
-r-xr-xr-x 2 root root 1,8K  1 gen  1970 .trytond-real


So were the spaces the only problem ?

[-- Attachment #2: Type: text/html, Size: 3283 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 11:00       ` Catonano
@ 2018-01-14 16:38         ` Ricardo Wurmus
  2018-01-14 20:35           ` Catonano
  2018-01-14 16:45         ` Danny Milosavljevic
  2018-01-22 10:52         ` Catonano
  2 siblings, 1 reply; 24+ messages in thread
From: Ricardo Wurmus @ 2018-01-14 16:38 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel


Catonano <catonano@gmail.com> writes:

>> I'd just call (setenv "/gnu/store/some-hash-passfile") instead of
>> starting a whole shell (it's a waste and increases the attach surface for
>> no reason to use a shell here).
>>
>
> I can certainly do like you suggest. It's cleaner
>
> But "trytond-admin" has to be called finally. Doesn't this require a shell
> anyway ?

No, it actually doesn’t.  There are different ways to execute programs,
and only one of them is to spawn a shell and have the shell handle the
execution.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 11:00       ` Catonano
  2018-01-14 16:38         ` Ricardo Wurmus
@ 2018-01-14 16:45         ` Danny Milosavljevic
  2018-01-14 20:33           ` Catonano
  2018-01-15  5:43           ` Alex Vong
  2018-01-22 10:52         ` Catonano
  2 siblings, 2 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-14 16:45 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

> So were the spaces the only problem ?

In https://gitlab.com/humanitiesNerd/guix-hacks/blob/trytonservice/gnu/services/trytond.scm , you don't invoke a shell (example: "sh", "bash", "csh" etc) so the "VARIABLE=VALUE" syntax will not be evaluated by the shell and the kernel will try to start a program called "VARIABLE=VALUE" instead.

So either (invoke "sh" "-c" "VARIABLE=VALUE trytond-admin ...") or just use setenv and then invoke trytond-admin directly.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 16:45         ` Danny Milosavljevic
@ 2018-01-14 20:33           ` Catonano
  2018-01-15  5:43           ` Alex Vong
  1 sibling, 0 replies; 24+ messages in thread
From: Catonano @ 2018-01-14 20:33 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 705 bytes --]

2018-01-14 17:45 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> > So were the spaces the only problem ?
>
> In https://gitlab.com/humanitiesNerd/guix-hacks/blob/trytonservice/gnu/
> services/trytond.scm , you don't invoke a shell (example: "sh", "bash",
> "csh" etc) so the "VARIABLE=VALUE" syntax will not be evaluated by the
> shell and the kernel will try to start a program called "VARIABLE=VALUE"
> instead.
>
> So either (invoke "sh" "-c" "VARIABLE=VALUE trytond-admin ...") or just
> use setenv and then invoke trytond-admin directly.
>


Aahh I see now !

Ok, thank you

I won't fix it right now because it's late and I'm tired. But I'll take
care of this in the coming days

Thanks !

[-- Attachment #2: Type: text/html, Size: 1427 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 16:38         ` Ricardo Wurmus
@ 2018-01-14 20:35           ` Catonano
  0 siblings, 0 replies; 24+ messages in thread
From: Catonano @ 2018-01-14 20:35 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

2018-01-14 17:38 GMT+01:00 Ricardo Wurmus <rekado@elephly.net>:

>
> Catonano <catonano@gmail.com> writes:
>
> >> I'd just call (setenv "/gnu/store/some-hash-passfile") instead of
> >> starting a whole shell (it's a waste and increases the attach surface
> for
> >> no reason to use a shell here).
> >>
> >
> > I can certainly do like you suggest. It's cleaner
> >
> > But "trytond-admin" has to be called finally. Doesn't this require a
> shell
> > anyway ?
>
> No, it actually doesn’t.  There are different ways to execute programs,
> and only one of them is to spawn a shell and have the shell handle the
> execution.
>

Ok, ok

Thanks for clarifying

[-- Attachment #2: Type: text/html, Size: 1189 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 16:45         ` Danny Milosavljevic
  2018-01-14 20:33           ` Catonano
@ 2018-01-15  5:43           ` Alex Vong
  1 sibling, 0 replies; 24+ messages in thread
From: Alex Vong @ 2018-01-15  5:43 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hello Catonano,

Danny Milosavljevic <dannym@scratchpost.org> writes:

>> So were the spaces the only problem ?
>
> In
> https://gitlab.com/humanitiesNerd/guix-hacks/blob/trytonservice/gnu/services/trytond.scm
> , you don't invoke a shell (example: "sh", "bash", "csh" etc) so the
> "VARIABLE=VALUE" syntax will not be evaluated by the shell and the
> kernel will try to start a program called "VARIABLE=VALUE" instead.
>
> So either (invoke "sh" "-c" "VARIABLE=VALUE trytond-admin ...") or
> just use setenv and then invoke trytond-admin directly.

Actually, there is one more way. You can run (I didn't test)

  (invoke "env" "VAR1=VAL1" ... "VARn=VALn" "trytond-admin" "ARG1" ... "ARGn")

But personally I prefer the 'setenv' approach, it looks more schemish to
me.

In fact, I think we should have a 'with-environment-variables' macro
which run the body with the appropriate environment variables set and
restore them after we finish, similar to how 'with-directory-excursion'
works.

Cheers,
Alex

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-14 11:00       ` Catonano
  2018-01-14 16:38         ` Ricardo Wurmus
  2018-01-14 16:45         ` Danny Milosavljevic
@ 2018-01-22 10:52         ` Catonano
  2018-01-22 10:59           ` Danny Milosavljevic
  2 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-22 10:52 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2255 bytes --]

2018-01-14 12:00 GMT+01:00 Catonano <catonano@gmail.com>:

> Hi Danny,
>
> thanks for your help
>
>
> 2018-01-14 11:43 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:
>
>> Hi Catonano,
>>
>> On Sun, 14 Jan 2018 08:21:10 +0100
>> Catonano <catonano@gmail.com> wrote:
>>
>>
> Ah, the spaces :-/
>
>
>>
>> TRYTOPASSILE = /gnu/store/some-hash-passfile
>>             ^ ^
>>
>> You'd need to remove those.  But even better instead do the following:
>>
>> I'd just call (setenv "/gnu/store/some-hash-passfile") instead of
>> starting a whole shell (it's a waste and increases the attach surface for
>> no reason to use a shell here).
>>
>
> I can certainly do like you suggest. It's cleaner
>
>
With this form

(primitive-exit
 (begin
    (setenv "TRYTONPASSFILE" #$passfile)
    (invoke
       run-the-trytond-init-script
       trytond-initscript-args
       )))

I get this error

ERROR: In procedure primitive-exit:
ERROR: Wrong type (expecting exact integer): #t

While with this version

(primitive-exit
  (setenv "TRYTONPASSFILE" #$passfile)
  (invoke
     run-the-trytond-init-script
     trytond-initscript-args
     )))

I get an error claiming a wrong number of arguments passed to primitive-exit


Finally, with hthis version

          (match (primitive-fork)
             (0
              ;; Exit with a non-zero status code if an exception is thrown.
              ;; why don't we use a try/catch ? Boh
              (dynamic-wind
                (const #t)
                (lambda ()
                  (setgid (passwd:gid trytond-user))
                  (setuid (passwd:uid trytond-user))
                  (setenv "TRYTONPASSFILE" #$passfile)
                  (primitive-exit
                   (invoke
                    run-the-trytond-init-script
                    trytond-initscript-args;; THIS IS A LIST, NOT A STRING
                    )))
                (lambda ()
                  (primitive-exit 1))))
             (pid (waitpid pid)))))))))


I get

ERROR: In procedure primitive-exit:
ERROR: Wrong type (expecting exact integer): #t

isn't invoke returning an exact integer ?
Maybe tryton-admin insn't seeing the env var and promtping to ask for its
interaction ?


How am I supposed to use setenv, exactly ?

Thanks

[-- Attachment #2: Type: text/html, Size: 3967 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-22 10:52         ` Catonano
@ 2018-01-22 10:59           ` Danny Milosavljevic
  2018-01-22 12:42             ` Catonano
  0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-22 10:59 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

> isn't invoke returning an exact integer ?

No.  "invoke" raises an exception if the child's exit code != 0.
Otherwise you get #t.

"system*" returns the exit code - might want to use that instead.
(just replace the text "invoke" by "system*")

> Maybe tryton-admin insn't seeing the env var and promtping to ask for its
> interaction ?
> 
> 
> How am I supposed to use setenv, exactly ?

Looks fine to me.

Just exit with (primitive-exit 0) in the end :)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-22 10:59           ` Danny Milosavljevic
@ 2018-01-22 12:42             ` Catonano
  2018-01-22 19:01               ` Danny Milosavljevic
  0 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-22 12:42 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

2018-01-22 11:59 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> > isn't invoke returning an exact integer ?
>
> No.  "invoke" raises an exception if the child's exit code != 0.
> Otherwise you get #t.
>
> "system*" returns the exit code - might want to use that instead.
> (just replace the text "invoke" by "system*")
>
> > Maybe tryton-admin insn't seeing the env var and promtping to ask for its
> > interaction ?
> >
> >
> > How am I supposed to use setenv, exactly ?
>
> Looks fine to me.
>
> Just exit with (primitive-exit 0) in the end :)
>


Thank you Danny

The virtual machine boots successfully now

The trytond service is running in it

But the postgres role doesn't exist so the connection to postgres fails and
trytond attempts to connect to a sqlite database that doesn't exist

I'm not gonna keep working on this
It's not fun anymore

Should anyone want to observe the relic, it's here
https://gitlab.com/humanitiesNerd/failed_tryton_service

Thank you all people

[-- Attachment #2: Type: text/html, Size: 1783 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-22 12:42             ` Catonano
@ 2018-01-22 19:01               ` Danny Milosavljevic
  2018-01-22 20:37                 ` Catonano
  0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-22 19:01 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

Hi Catonano,

On Mon, 22 Jan 2018 13:42:26 +0100
Catonano <catonano@gmail.com> wrote:

> The virtual machine boots successfully now
> 
> The trytond service is running in it

Cool!

> But the postgres role doesn't exist so the connection to postgres fails and

Your db-creation already invokes createdb.  Try passing -O trytond,
maybe everything works then.

So in gnu/services/trytond.scm:

               (createdb-script (string-append #$postgresql "/bin/createdb")
                                "-O" "trytond"
                                #$database-name)

And later

  (apply invoke createdb-script)

> trytond attempts to connect to a sqlite database that doesn't exist

Probably a fallback, hmm.

> I'm not gonna keep working on this
> It's not fun anymore

Too bad.  I can understand it though.

For the part I had in the frustration by shitty VM error reporting, I'm sorry.

I've now merged the tryton packages from your repository into guix master.

(I've applied small stylistic fixes)

Since it's snowing outside and cold as hell, I'll also try to get a minimal
trytond service to work, starting from your work.

I have no idea what the program is supposed to do - so I'll stop when it starts
up.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors
  2018-01-22 19:01               ` Danny Milosavljevic
@ 2018-01-22 20:37                 ` Catonano
  2018-01-23 22:43                   ` weird errors; shepherd Danny Milosavljevic
  0 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-22 20:37 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

2018-01-22 20:01 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> Hi Catonano,
>
> On Mon, 22 Jan 2018 13:42:26 +0100
> Catonano <catonano@gmail.com> wrote:
>
> > The virtual machine boots successfully now
> >
> > The trytond service is running in it
>
> Cool!
>
> > But the postgres role doesn't exist so the connection to postgres fails
> and
>
> Your db-creation already invokes createdb.  Try passing -O trytond,
> maybe everything works then.
>
> So in gnu/services/trytond.scm:
>
>                (createdb-script (string-append #$postgresql
> "/bin/createdb")
>                                 "-O" "trytond"
>                                 #$database-name)
>
> And later
>
>   (apply invoke createdb-script)
>
> > trytond attempts to connect to a sqlite database that doesn't exist
>
> Probably a fallback, hmm.
>
> > I'm not gonna keep working on this
> > It's not fun anymore
>
> Too bad.  I can understand it though.
>
> For the part I had in the frustration by shitty VM error reporting, I'm
> sorry.
>
> I've now merged the tryton packages from your repository into guix master.
>
> (I've applied small stylistic fixes)
>
> Since it's snowing outside and cold as hell, I'll also try to get a minimal
> trytond service to work, starting from your work.
>
> I have no idea what the program is supposed to do - so I'll stop when it
> starts
> up.
>

You are way too kind 😃
Thank you !

[-- Attachment #2: Type: text/html, Size: 2186 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-22 20:37                 ` Catonano
@ 2018-01-23 22:43                   ` Danny Milosavljevic
  2018-01-24 12:34                     ` Catonano
                                       ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-23 22:43 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

The attached file is gnu/services/trytond.scm which successfully runs trytond.

Everyone:

After I've tried writing some shepherd service I have to say that writing a
shepherd "start" action is way too difficult.

Even now, I've not gotten to work:

* Having the activation depend on any other service.
* Logging errors from start-trytond to stderr or stdout.
  As far as I understand make-forkexec-constructor takes special care not
  to kill stderr.  As long there's no log-file specified it should leave stdout
  and stderr alone.  So where does the text go?

I've had other problems like:

* root's shepherd hangs sometimes and herd can't connect to it anymore.
* When I use (error "XXX") in a shepherd start block, booting the system
drops me into a REPL and doesn't let me out again (instead of just failing
this one service and continuing to boot).

Sigh...

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: trytond.scm --]
[-- Type: text/x-scheme, Size: 8273 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Adriano Peluso <catonano@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu services trytond)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (gnu system shadow)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages tryton)
  #:use-module (guix modules)
  #:use-module (guix records)
  #:use-module (guix build utils)
  #:use-module (guix gexp)
  #:use-module (ice-9 match)
  #:export (trytond-service-type
            <trytond-configuration>

            trytond-configuration
            trytond-configuration?

            trytond-configuration-trytond
            trytond-configuration-postgresql
            trytond-configuration-config-file
            trytond-configuration-data-directory
            trytond-configuration-postgres-role
            trytond-configuration-database-name))

;;; Commentary:
;;;
;;; Trytond based services. Mainly Trytond and GNUHealth for now
;;;
;;; Code:

(define %default-trytond-path
  "/var/lib/trytond")

(define %default-postgres-role
  "tryton")

(define %default-database-name
  "tryton")

(define %default-trytond-config
  (mixed-text-file "trytond.conf"
                   "[database]\n"
                   ;; XXX which postgres user shold we use here ?
                   (string-append "uri = postgresql://"
                                  %default-postgres-role
                                  "@127.0.0.1\n")
                   "path = " %default-trytond-path))

(define %default-passfile
  (mixed-text-file "passfile"
                   "tryton"))

(define-record-type* <trytond-configuration>
  trytond-configuration make-trytond-configuration
  trytond-configuration?
  (trytond     trytond-configuration-trytond ;<package>
               (default python-trytond))
  (postgresql  trytond-configuration-postgresql
               (default postgresql))
  (locale         trytond-configuration-locale
                  (default "en_US.utf8"))
  (config-file    trytond-configuration-file
                  (default %default-trytond-config))
  (passfile      trytond-passfile
                 (default %default-passfile))
  ;; Default: The db folder under the user home directory running trytond.
  (data-directory trytond-configuration-data-directory
                  (default %default-trytond-path))
  (postgres-role trytond-configuration-postgres-role
                 (default %default-postgres-role))
  (database-name trytond-configuration-database-name
                 (default %default-database-name)))

(define %trytond-accounts
  (list (user-group (name "trytond") (system? #t))
        (user-account
         (name "trytond")
         (group "trytond")
         (system? #t)
         (comment "Trytond server user")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define (setup-role.sql role)
  (plain-file "setup-role.sql" (format #f "
DO
$body$
BEGIN
   IF NOT EXISTS (
      SELECT *
      FROM   pg_catalog.pg_user
      WHERE  usename = '~A') THEN
      CREATE ROLE \"~A\" LOGIN;
   END IF;
END
$body$;
" role role)))

(define (setup-database.sql database role)
  (plain-file "setup-database.sql"
   (format #f "CREATE DATABASE \"~A\" WITH OWNER = \"~A\";" database role)))

(define (trytond-activation config)
  (let* ((postgresql (trytond-configuration-postgresql config))
         (role (trytond-configuration-postgres-role config))
         (database (trytond-configuration-database-name config))
         (data-directory (trytond-configuration-data-directory config)))
    #~(begin
        (let ((trytond-user (getpwnam "trytond")))
           (mkdir-p #$data-directory)
           (chown #$data-directory
                  (passwd:uid trytond-user)
                  (passwd:gid trytond-user))))))

(define trytond-shepherd-service
  (match-lambda
   (($ <trytond-configuration> trytond
                               postgresql
                               locale
                               config-file
                               passfile
                               data-directory
                               postgres-role
                               database-name)
    (let* ((setup-role.sql (setup-role.sql postgres-role))
           (setup-database.sql (setup-database.sql database-name postgres-role))
           (start-script
            (program-file "start-trytond"
                          (with-imported-modules '((guix build utils))
                            #~(begin
                                (use-modules (guix build utils))
                                ;; Set up postgres database.
                                (let ((psql (string-append #$postgresql
                                                           "/bin/psql")))
                                  (invoke psql "-U" "postgres"
                                               "-f" #$setup-role.sql)
                                  (system* psql "-U" "postgres"
                                                "-f" #$setup-database.sql))
                                ;; Set up tables.
                                (let ((trytond-admin (string-append #$trytond
                                                                    "/bin/trytond-admin"))
                                      (args (append (list "-c" #$config-file
                                                          "-d" #$database-name
                                                          "--all")
                                                    (if #$locale
                                                        (list "-l" #$locale)
                                                        '()))))
                                  (setenv "TRYTONPASSFILE" #$passfile)
                                  (apply invoke trytond-admin args))
                                ;; Start daemon.
                                (execl (string-append #$trytond
                                                      "/bin/trytond")
                                       (string-append #$trytond
                                                      "/bin/trytond")
                                       "-c" #$config-file))))))
      (list (shepherd-service
                (provision '(trytond))
                (documentation "Trytond daemon.")
                (requirement '(user-processes loopback postgres))
                ; TODO #:pid-file
                (start #~(make-forkexec-constructor #$start-script
                                                    #:log-file "/tmp/QQ"
                                                    #:user "trytond"
                                                    #:group "trytond"))
                (stop #~(make-kill-destructor))))))))

(define trytond-service-type
  (service-type (name 'trytond)
                (extensions
                 (list (service-extension shepherd-root-service-type
                                          trytond-shepherd-service)
                       (service-extension activation-service-type
                                          trytond-activation)
                       (service-extension account-service-type
                                          (const %trytond-accounts))))
                (default-value (trytond-configuration))))

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-23 22:43                   ` weird errors; shepherd Danny Milosavljevic
@ 2018-01-24 12:34                     ` Catonano
  2018-01-24 12:46                       ` Danny Milosavljevic
  2018-01-24 14:47                     ` Ludovic Courtès
  2018-01-29  7:24                     ` Catonano
  2 siblings, 1 reply; 24+ messages in thread
From: Catonano @ 2018-01-24 12:34 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

2018-01-23 23:43 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> The attached file is gnu/services/trytond.scm which successfully runs
> trytond.
>

With "successfully"" you mean that it connects to postgres and it shhows te
proper screens in the client ?

Sometimes the trytond daemon does run but it fails to connect to postgres

I'll check this out. Only, not today, neither tomorrow probably. But I
will, sooner or later

Thanks !



> Everyone:
>
> After I've tried writing some shepherd service I have to say that writing a
> shepherd "start" action is way too difficult.
>
> Even now, I've not gotten to work:
>
> * Having the activation depend on any other service.
> * Logging errors from start-trytond to stderr or stdout.
>   As far as I understand make-forkexec-constructor takes special care not
>   to kill stderr.  As long there's no log-file specified it should leave
> stdout
>   and stderr alone.  So where does the text go?
>
> I've had other problems like:
>
> * root's shepherd hangs sometimes and herd can't connect to it anymore.
> * When I use (error "XXX") in a shepherd start block, booting the system
> drops me into a REPL and doesn't let me out again (instead of just failing
> this one service and continuing to boot).
>
> Sigh...
>

I'm relieved that someone else finds this difficult

Thans again !

[-- Attachment #2: Type: text/html, Size: 2087 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-24 12:34                     ` Catonano
@ 2018-01-24 12:46                       ` Danny Milosavljevic
  2018-01-24 12:52                         ` Catonano
  0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-24 12:46 UTC (permalink / raw)
  To: Catonano; +Cc: guix-devel

Hi Catonano,

> With "successfully"" you mean that it connects to postgres and it shhows te
> proper screens in the client ?

Yes.

I invoked "tryton" which pops up a GUI.  Then I edited the profiles there,
adding "localhost" and then I logged into the client GUI via login "admin"
and password "tryton".  It asked me to configure "modules".

Then, it showed a window with two modules, "ir" and "res", in it.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-24 12:46                       ` Danny Milosavljevic
@ 2018-01-24 12:52                         ` Catonano
  0 siblings, 0 replies; 24+ messages in thread
From: Catonano @ 2018-01-24 12:52 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

2018-01-24 13:46 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> Hi Catonano,
>
> > With "successfully"" you mean that it connects to postgres and it shhows
> te
> > proper screens in the client ?
>
> Yes.
>
> I invoked "tryton" which pops up a GUI.  Then I edited the profiles there,
> adding "localhost" and then I logged into the client GUI via login "admin"
> and password "tryton".  It asked me to configure "modules".
>
> Then, it showed a window with two modules, "ir" and "res", in it.
>


Wonderful ! It's working !!

[-- Attachment #2: Type: text/html, Size: 1031 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-23 22:43                   ` weird errors; shepherd Danny Milosavljevic
  2018-01-24 12:34                     ` Catonano
@ 2018-01-24 14:47                     ` Ludovic Courtès
  2018-01-24 19:36                       ` Danny Milosavljevic
  2018-01-29  7:24                     ` Catonano
  2 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2018-01-24 14:47 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> Everyone:
>
> After I've tried writing some shepherd service I have to say that writing a
> shepherd "start" action is way too difficult.
>
> Even now, I've not gotten to work:
>
> * Having the activation depend on any other service.

I’m not sure what you mean.  There’s no notion of dependencies among
activation snippets, let alone between activation snippets and service
starts (when booting, activation snippets run *before* shepherd is
started).  Perhaps there’s a misunderstanding here?

> * Logging errors from start-trytond to stderr or stdout.

You can write:

  (make-forkexec-constructor
    …
    #:log-file "/var/log/something.log")

which will redirect stdout/stderr to that file (info "(shepherd) Service
De- and Constructors").

Now, I think stdout/stderr should be captured by default, and perhaps
made available with a journalctl-like interface (Leo proposed a GSoC
project along these lines.)

>   As far as I understand make-forkexec-constructor takes special care not
>   to kill stderr.  As long there's no log-file specified it should leave stdout
>   and stderr alone.  So where does the text go?

To PID 1’s stdout/stderr, i.e., /dev/console (which sucks).

> I've had other problems like:
>
> * root's shepherd hangs sometimes and herd can't connect to it anymore.

That’s a serious bug.  Can you reproduce it?

> * When I use (error "XXX") in a shepherd start block, booting the system
> drops me into a REPL and doesn't let me out again (instead of just failing
> this one service and continuing to boot).

That’s inconvenient but “expected” in the sense that the ‘start’ method
is called right from shepherd.conf.  Perhaps we should call ‘start’ at a
later stage.

As you write, the Shepherd leaves quite a bit to be desired.  The good
news is that it’s a very small code base, so I’d encourage people to
look at it when they find something they’re dissatisfied with, and see
how it can be improved.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-24 14:47                     ` Ludovic Courtès
@ 2018-01-24 19:36                       ` Danny Milosavljevic
  2018-01-24 22:28                         ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2018-01-24 19:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi Ludo,

On Wed, 24 Jan 2018 15:47:16 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

> I’m not sure what you mean.  There’s no notion of dependencies among
> activation snippets, let alone between activation snippets and service
> starts (when booting, activation snippets run *before* shepherd is
> started).  Perhaps there’s a misunderstanding here?

Yeah, if it's intended that way, that's fine.  So it's like /etc/rc.local
and it just runs the snippets in any order?

Now, I just do both the trytond DB-upgrading and the service starting at the
"start" action because postgres isn't running yet otherwise.

> >   As far as I understand make-forkexec-constructor takes special care not
> >   to kill stderr.  As long there's no log-file specified it should leave stdout
> >   and stderr alone.  So where does the text go?  
> 
> To PID 1’s stdout/stderr, i.e., /dev/console (which sucks).

Really?  I don't see it in the marionette os output (for make check-system) - 
I just tried it again, stdout is nowhere to be seen with check-system.
(I just put a program-file as shepherd start action and called "display" there)

Also tried
                    (marionette-eval '(current-output-port
                                                 (open-file "/dev/console" "w0"))
                                                                            marionette)
                    (marionette-eval '(current-error-port
                                                 (open-file "/dev/console" "w0"))
                                                                            marionette)

but that didn't change anything either...

> > I've had other problems like:
> >
> > * root's shepherd hangs sometimes and herd can't connect to it anymore.  
> 
> That’s a serious bug.  Can you reproduce it?

I'll try.

> That’s inconvenient but “expected” in the sense that the ‘start’ method
> is called right from shepherd.conf.  Perhaps we should call ‘start’ at a
> later stage.

Well, as it is it makes the system very brittle.

Once one service does that... oops.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-24 19:36                       ` Danny Milosavljevic
@ 2018-01-24 22:28                         ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2018-01-24 22:28 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Wed, 24 Jan 2018 15:47:16 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> I’m not sure what you mean.  There’s no notion of dependencies among
>> activation snippets, let alone between activation snippets and service
>> starts (when booting, activation snippets run *before* shepherd is
>> started).  Perhaps there’s a misunderstanding here?
>
> Yeah, if it's intended that way, that's fine.  So it's like /etc/rc.local
> and it just runs the snippets in any order?

Yes.

> Now, I just do both the trytond DB-upgrading and the service starting at the
> "start" action because postgres isn't running yet otherwise.

That’s the right thing to do if you need ordering.

>> >   As far as I understand make-forkexec-constructor takes special care not
>> >   to kill stderr.  As long there's no log-file specified it should leave stdout
>> >   and stderr alone.  So where does the text go?  
>> 
>> To PID 1’s stdout/stderr, i.e., /dev/console (which sucks).
>
> Really?  I don't see it in the marionette os output (for make check-system) - 

When running “make check-system”, you see the console (which is
redirected to the host’s qemu stdout), like this:

--8<---------------cut here---------------start------------->8---
$ make check-system TESTS=basic

[...]

[    0.511024] Freeing unused kernel memory: 308K
GC Warning: pthread_getattr_np or pthread_attr_getstack failed for main thread
GC Warning: Couldn't read /proc/stat
Welcome, this is GNU's early boot Guile.
Use '--repl' for an initrd REPL.

loading kernel modules...

[...]

adding group 'input'...
adding group 'video'...
adding group 'audio'...
adding group 'netdev'...
adding group 'lp'...
adding group 'disk'...
adding group 'floppy'...

[...]

Service udev has been started.
Service urandom-seed has been started.
Service user-processes has been started.
Service host-name has been started.
Service user-homes could not be started.
nscd: 279 monitoring file `/etc/hosts` (1)
nscd: 279 monitoring directory `/etc` (2)
nscd: 279 monitoring file `/etc/resolv.conf` (3)
nscd: 279 monitoring directory `/etc` (2)
nscd: 279 monitoring file `/etc/services` (4)
nscd: 279 monitoring directory `/etc` (2)
Service nscd has been started.

[...]

Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
+ info --version
info (GNU texinfo) 6.3

Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
shepherd: Service user-homes could not be started.
QEMU runs as PID 6
connected to QEMU's monitor
read QEMU monitor prompt
connected to guest REPL
%%%% Starting test basic  (Writing full log to "basic.log")
marionette is ready

;;; (services (user-processes loopback term-tty2 udev console-font-tty2 term-tty3 term-tty1 console-font-tty6 urandom-seed file-system-/dev/shm console-font-tty5 console-font-tty1 guix-daemon host-name file-system-/dev/pts user-file-systems root term-tty4 file-systems user-homes root-file-system nscd marionette syslogd term-tty6 term-tty5 console-font-tty4 console-font-tty3))
# of expected passes      19
@ build-succeeded /gnu/store/xab6i89lf15rab8ipy78rkj4218dzjvd-basic.drv -
TOTAL: 1
PASS: /gnu/store/hazdppnr6cd1dhqnbjhyj44yb6xcfpnf-basic
--8<---------------cut here---------------end--------------->8---

Here you see the output of ‘useradd’, shepherd itself, nscd, marionette,
etc.  All this is /dev/console.

> Also tried
>                     (marionette-eval '(current-output-port
>                                                  (open-file "/dev/console" "w0"))
>                                                                             marionette)
>                     (marionette-eval '(current-error-port
>                                                  (open-file "/dev/console" "w0"))
>                                                                             marionette)

This shouldn’t be necessary, but it would change the error port for the
marionette process itself.

>> That’s inconvenient but “expected” in the sense that the ‘start’ method
>> is called right from shepherd.conf.  Perhaps we should call ‘start’ at a
>> later stage.
>
> Well, as it is it makes the system very brittle.
>
> Once one service does that... oops.

Yeah, but then again we test services in a VM beforehand.  :-)
Also, using (error "xxx") is frowned upon because it raises an exception
that cannot usefully be handled.

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: weird errors; shepherd
  2018-01-23 22:43                   ` weird errors; shepherd Danny Milosavljevic
  2018-01-24 12:34                     ` Catonano
  2018-01-24 14:47                     ` Ludovic Courtès
@ 2018-01-29  7:24                     ` Catonano
  2 siblings, 0 replies; 24+ messages in thread
From: Catonano @ 2018-01-29  7:24 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

2018-01-23 23:43 GMT+01:00 Danny Milosavljevic <dannym@scratchpost.org>:

> The attached file is gnu/services/trytond.scm which successfully runs
> trytond.
>

I run it and I confirm it works

I couldn't attemp at installing a couple of Tryton modules (on top of the
base ones) because in the vm the keyboard layout is messed up and I
couldn't use the command line properly (in the xfce terminal)

I tried to set it up with the xfce panel, but it's not so immediate, so I
gave up

I'd merge this patch anyway, I'd keep working on Tryton/GNUHealth fron the
next reconfigure onwards

Thanks

[-- Attachment #2: Type: text/html, Size: 1008 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-01-29  7:24 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-13 17:00 weird errors Catonano
2018-01-13 21:13 ` Ludovic Courtès
2018-01-14  7:21   ` Catonano
2018-01-14 10:43     ` Danny Milosavljevic
2018-01-14 10:57       ` Danny Milosavljevic
2018-01-14 11:00       ` Catonano
2018-01-14 16:38         ` Ricardo Wurmus
2018-01-14 20:35           ` Catonano
2018-01-14 16:45         ` Danny Milosavljevic
2018-01-14 20:33           ` Catonano
2018-01-15  5:43           ` Alex Vong
2018-01-22 10:52         ` Catonano
2018-01-22 10:59           ` Danny Milosavljevic
2018-01-22 12:42             ` Catonano
2018-01-22 19:01               ` Danny Milosavljevic
2018-01-22 20:37                 ` Catonano
2018-01-23 22:43                   ` weird errors; shepherd Danny Milosavljevic
2018-01-24 12:34                     ` Catonano
2018-01-24 12:46                       ` Danny Milosavljevic
2018-01-24 12:52                         ` Catonano
2018-01-24 14:47                     ` Ludovic Courtès
2018-01-24 19:36                       ` Danny Milosavljevic
2018-01-24 22:28                         ` Ludovic Courtès
2018-01-29  7:24                     ` Catonano

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.