Hi,

when the activation script encounters some errors, they are not passed
through the guix deploy session.  They are suppressed and user has no
idea something went wrong.

This can be reproduced in few simple steps, in any VM.

First make sure activation works fine:

--8<---------------cut here---------------start------------->8---
$ /run/current-system/activate 
making '/gnu/store/hc3rbr861i92lqnqh9789yfsmfbr67an-system' the current 
system...
populating /etc from /gnu/store/qjg8ir1irw1vrffay0y2lgi7x87fbdbf-etc...
setting up privileged programs in '/run/privileged/bin'...
--8<---------------cut here---------------end--------------->8---

Then replace any symlinked file in /etc with a directory, for example
skel works nicely:

--8<---------------cut here---------------start------------->8---
$ rm /etc/skel
$ mkdir /etc/skel
--8<---------------cut here---------------end--------------->8---

And run the activation again:

--8<---------------cut here---------------start------------->8---
$ /run/current-system/activate 
making '/gnu/store/hc3rbr861i92lqnqh9789yfsmfbr67an-system' the current 
system...
populating /etc from /gnu/store/qjg8ir1irw1vrffay0y2lgi7x87fbdbf-etc...
#<&compound-exception components: (#<&external-error> #<&origin origin: 
"symlink"> #<&message message: "~A"> #<&irritants irritants: ("File exists")> 
#<&exception-with-kind-and-args kind: system-error args: ("symlink" "~A" ("File 
exists") (17))>)>
warning: failed to activate 
'/gnu/store/rpawqd9zs98prk7sywv1vdc1188znxmw-activate-service.scm'
setting up privileged programs in '/run/privileged/bin'...
--8<---------------cut here---------------end--------------->8---

So we see a warning printed (would be useful to have a file name
somewhere in there, but that is a separate issue).  Now let us try the
same via guix deploy:

--8<---------------cut here---------------start------------->8---
+ guix deploy -L . testvm.scm
The following 1 machine will be deployed:
  testvm

guix deploy: deploying to testvm...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
guix deploy: sending 0 store items (0 MiB) to '127.0.0.1'...
The following derivations will be built:
  /gnu/store/1j3yv0zkdpf89701ymdd39287vd1rzqf-grub.cfg.drv
  /gnu/store/r8r4fwakq0ca7ckl3yhqpdbcy9wnkhby-install-bootloader.scm.drv
  /gnu/store/yx26302lz6vivd12fd8sn82ih6w2s9ab-remote-exp.scm.drv

building /gnu/store/1j3yv0zkdpf89701ymdd39287vd1rzqf-grub.cfg.drv...
building 
/gnu/store/r8r4fwakq0ca7ckl3yhqpdbcy9wnkhby-install-bootloader.scm.drv...
building /gnu/store/yx26302lz6vivd12fd8sn82ih6w2s9ab-remote-exp.scm.drv...
guix deploy: sending 3 store items (0 MiB) to '127.0.0.1'...
guix deploy: successfully deployed testvm
--8<---------------cut here---------------end--------------->8---

It claims that the deploy was successful and the warning was not passed
through.  What is worse, the warning is not logged into
/var/log/messages, it is just lost, making debugging painful.

As a workaround, I will update my deploy wrapper with:

--8<---------------cut here---------------start------------->8---
guix deploy -L . testvm.scm
guix deploy -L . testvm.scm -x -- /run/current-system/activate
--8<---------------cut here---------------end--------------->8---

This does at least show the warning, but I think we all will agree that
it is somewhat sub-optimal.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.



Reply via email to