[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nix-dev
Subject:    Re: [Nix-dev] environment in systemd services
From:       zimbatm <zimbatm () zimbatm ! com>
Date:       2016-01-30 13:27:52
Message-ID: CANEP-f7yMB0Ao_yQN+tmBa-6M2cB+5mt55tp79xjfxbJNqx4Eg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Did you try to pass the AWS keypair trough an environment variable ? I
don't know it that would fix it but it's a 3rd solution, not having access
to the right keys.

On Sat, 30 Jan 2016 at 13:20 Arnold Krille <arnold@arnoldarts.de> wrote:

> Hi all,
> 
> yes, its the first time I am writing on this list.
> 
> I am trying to get duply/duplicity to run. When I execute `duply amazon
> backup` in a root shell, all is well. But I want it to be run regularly
> by systemd. So I created a service:
> 
> ```
> systemd.services.duplyamazon =
> {
> path = [ pkgs.duply ];
> environment = { LANG = "C"; HOME="/root"; TMPDIR="/tmp"; };
> script = "duply amazon status";
> startAt = "Sat 4:10:00";
> };
> ```
> 
> But when I run that (either by the timer or by `systemctl start
> duplyamazon`, it fails with very strange python backtrace:
> 
> ```
> Jan 30 14:10:08 portal duplyamazon-start[47296]: Using temporary
> directory /tmp/duplicity-b53bV9-tempdir Jan 30 14:10:08 portal
> duplyamazon-start[47296]: Backend error detail: Traceback (most recent
> call last): Jan 30 14:10:08 portal duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
>  line 1519, in <module> Jan 30 14:10:08 portal duplyamazon-start[47296]:
> with_tempdir(main) Jan 30 14:10:08 portal duplyamazon-start[47296]:
> File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
>  line 1513, in with_tempdir Jan 30 14:10:08 portal
> duplyamazon-start[47296]: fn() Jan 30 14:10:08 portal
> duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
>  line 1354, in main Jan 30 14:10:08 portal duplyamazon-start[47296]:
> action = commandline.ProcessCommandLine(sys.argv[1:]) Jan 30 14:10:08
> portal duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/commandline.py",
>  line 1062, in ProcessCommandLine Jan 30 14:10:08 portal
> duplyamazon-start[47296]: globals.backend =
> backend.get_backend(args[0]) Jan 30 14:10:08 portal
> duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
>  line 223, in get_backend Jan 30 14:10:08 portal
> duplyamazon-start[47296]: obj = get_backend_object(url_string) Jan 30
> 14:10:08 portal duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
>  line 209, in get_backend_object Jan 30 14:10:08 portal
> duplyamazon-start[47296]: return factory(pu) Jan 30 14:10:08 portal
> duplyamazon-start[47296]: File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
>  line 161, in __init__ Jan 30 14:10:08 portal duplyamazon-start[47296]:
> self.resetConnection() Jan 30 14:10:08 portal duplyamazon-start[47296]:
> File
> 
> "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
>  line 187, in resetConnection Jan 30 14:10:08 portal
> duplyamazon-start[47296]: raise BackendException(err.message) Jan 30
> 14:10:08 portal duplyamazon-start[47296]: BackendException Jan 30
> 14:10:08 portal duplyamazon-start[47296]: BackendException: Jan 30
> 14:10:08 portal duplyamazon-start[47296]: 14:10:08.191 Task 'STATUS'
> failed with exit code '23'.
> ```
> 
> I think its either because it can not access the tmpdir or because it
> can not access the network. And I don't know whether that is because of
> some missing environment variables or because of how systemd services
> have to be configured.
> 
> Can anyone try to point me in the right direction?
> 
> Thanks in advance,
> 
> Arnold
> 
> 
> Background: I am currently setting up a new homeserver with NixOS and
> therefore I am moving all the currently running services of my ubuntu
> based homeserver. Expect more questions from me in the next weeks… ;-)
> _______________________________________________
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> 


[Attachment #5 (text/html)]

<div dir="ltr">Did you try to pass the AWS keypair trough an environment variable ? I \
don&#39;t know it that would fix it but it&#39;s a 3rd solution, not having access to \
the right keys.</div><br><div class="gmail_quote"><div dir="ltr">On Sat, 30 Jan 2016 \
at 13:20 Arnold Krille &lt;<a \
href="mailto:arnold@arnoldarts.de">arnold@arnoldarts.de</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br> <br>
yes, its the first time I am writing on this list.<br>
<br>
I am trying to get duply/duplicity to run. When I execute `duply amazon<br>
backup` in a root shell, all is well. But I want it to be run regularly<br>
by systemd. So I created a service:<br>
<br>
```<br>
systemd.services.duplyamazon =<br>
   {<br>
      path = [ pkgs.duply ];<br>
      environment = { LANG = &quot;C&quot;; HOME=&quot;/root&quot;; \
TMPDIR=&quot;/tmp&quot;; };<br>  script = &quot;duply amazon status&quot;;<br>
      startAt = &quot;Sat 4:10:00&quot;;<br>
   };<br>
```<br>
<br>
But when I run that (either by the timer or by `systemctl start<br>
duplyamazon`, it fails with very strange python backtrace:<br>
<br>
```<br>
Jan 30 14:10:08 portal duplyamazon-start[47296]: Using temporary<br>
directory /tmp/duplicity-b53bV9-tempdir Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: Backend error detail: Traceback (most recent<br>
call last): Jan 30 14:10:08 portal duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped&quot;,<br>
 line 1519, in &lt;module&gt; Jan 30 14:10:08 portal duplyamazon-start[47296]:<br>
with_tempdir(main) Jan 30 14:10:08 portal duplyamazon-start[47296]:<br>
File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped&quot;,<br>
 line 1513, in with_tempdir Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: fn() Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped&quot;,<br>
 line 1354, in main Jan 30 14:10:08 portal duplyamazon-start[47296]:<br>
action = commandline.ProcessCommandLine(sys.argv[1:]) Jan 30 14:10:08<br>
portal duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/commandline.py&quot;,<br>
 line 1062, in ProcessCommandLine Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: globals.backend =<br>
backend.get_backend(args[0]) Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py&quot;,<br>
 line 223, in get_backend Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: obj = get_backend_object(url_string) Jan 30<br>
14:10:08 portal duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py&quot;,<br>
 line 209, in get_backend_object Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: return factory(pu) Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py&quot;,<br>
 line 161, in __init__ Jan 30 14:10:08 portal duplyamazon-start[47296]:<br>
self.resetConnection() Jan 30 14:10:08 portal duplyamazon-start[47296]:<br>
File<br>
&quot;/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py&quot;,<br>
 line 187, in resetConnection Jan 30 14:10:08 portal<br>
duplyamazon-start[47296]: raise BackendException(err.message) Jan 30<br>
14:10:08 portal duplyamazon-start[47296]: BackendException Jan 30<br>
14:10:08 portal duplyamazon-start[47296]: BackendException: Jan 30<br>
14:10:08 portal duplyamazon-start[47296]: 14:10:08.191 Task &#39;STATUS&#39;<br>
failed with exit code &#39;23&#39;.<br>
```<br>
<br>
I think its either because it can not access the tmpdir or because it<br>
can not access the network. And I don&#39;t know whether that is because of<br>
some missing environment variables or because of how systemd services<br>
have to be configured.<br>
<br>
Can anyone try to point me in the right direction?<br>
<br>
Thanks in advance,<br>
<br>
Arnold<br>
<br>
<br>
Background: I am currently setting up a new homeserver with NixOS and<br>
therefore I am moving all the currently running services of my ubuntu<br>
based homeserver. Expect more questions from me in the next weeks… ;-)<br>
_______________________________________________<br>
nix-dev mailing list<br>
<a href="mailto:nix-dev@lists.science.uu.nl" \
target="_blank">nix-dev@lists.science.uu.nl</a><br> <a \
href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" rel="noreferrer" \
target="_blank">http://lists.science.uu.nl/mailman/listinfo/nix-dev</a><br> \
</blockquote></div>



_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic