[Nix-dev] environment in systemd services
Arnold Krille
arnold at arnoldarts.de
Sat Jan 30 14:34:21 CET 2016
Nope, the aws credentials are in the url given in the config file.
I also tried setting serviceConfig with options privateTmp=false and
privateNetwork=false but these options seem to be for a later version
of systemd. I am on stock 15.09 here.
- Arnold
(Before anyone asks, the backup is encrypted and only the public part
of the gpg key is present on the server.)
On Sat, 30 Jan 2016 13:27:52 +0000 zimbatm <zimbatm at zimbatm.com> wrote:
> 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 at 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 at lists.science.uu.nl
> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160130/091df521/attachment-0001.bin
More information about the nix-dev
mailing list