Guix System pretends to not find configuration files

Hi all,

I think I’ve discovered a very weird bug in guix system, but if anyone can find a logical explanation for this, I would love to know.

Here’s my experience so far with the command: I’ve used it to build a Guix system from a single configuration file os.scm and update the operating system from there with guix system reconfigure. All normal stuff. Now, I want to expand my configuration to multiple files very similarly to how David Wilson has managed it in his daviwil/dotfiles github repo. Ignoring the update wrapper scripts, he’s basically just used #:include-module statements in the module declaration for his operating system in the file that he runs guix system reconfigure on.

So I tried this, too. The result for me, on my Guix system, was that guix system reconfigure reports a failure to load .scm: no such file or directory. Of course, the file very much does exist. Now, we can prove that guix system can in fact find the file because if you introduce any syntax error in it, it will point that out to you, complaining about the mistake you made. If I remove the -L ~/.dotfiles argument from guix system reconfigure, which tells it where to find the other modules, it will similarly complain about the .scm file because it lacks code for the modules it’s trying to pull in (but it will find the file and point out the error).

So sometimes guix system selectively lies about finding configuration files. However, I tested this again in a bunch of different ways. I tried using guix installation media, both built with the linux and the linux-libre kernels, and the same thing happened with guix system init. Same results from inside a chroot, also from using the Guix package manager on my gentoo system to run guix system init. I tried rebuilding the OS using all of these methods with single configuration files, but then guix system reconfigure fails on the multi-file setup.

Finally, guix system init worked once in a qemu qcow2-based guix system (taken from the Guix website) that was then given access to my hard drive, but as soon as I remembered to guix pull I got the same error again.

I have tried this over nearly every conceivable setup, and yet guix system returns this error every time. It’s so strange because I’m sure I’m invoking everything correctly, but if this is a bug then how does David Wilson’s configuration, and the no doubt numerous derived from it, actually work?

Thoughts?

The trace back from guile can be a bit obtuse. Which is then propagates to guix. And you can get some odd errors if the error is in a module and not directly in the configuration file.

Best way I found to debug things like this is to launch the guix repl and import the module.

E.g.

$ guix repl -L ~/.dotfiles
scheme@(guix-user)>  ,use (your module)

You can also try to switch to it

guix repl -L ~/.dotfiles
scheme@(guix-user)>  ,m (your module)

You can see all the commands for the repl by calling ,help. These two commands are under ,help module.

Also, I could be mistaken on this, in order to move code out from your os.scm and into separate modules you will need to add them as a channel. That way guix will add it to the load-path when doing a guix pull. Otherwise you’ll need to always use -L for guix to find them.

Although it might be possible that guile looks in the same directory for matching files if it cannot locate them on the load path. I haven’t tried that.

For another reference, here is my channel. With a common operating-system defined in plt/system/machines.scm that all my machines inherit from. E.g. plt/system/machines/surt.scm is for the machine I’m typing this on.

And I’ve started to use

$ guix system reconfigure -e '(@ (plt system machines surt) plt-surt-os)'

To make sure it is using the configuration that gets pulled in by guix pull. That way I do not need to have a clone of the repo on every machine and keep it up to date. A helpful suggestion I found on the mailing list.

3 Likes

You were right, there were problems with the other modules I made, and it was just showing up in weird ways. I’ve got it to reconfigure properly now!

Your recommendation of using guix repl is a good one; I had forgotten about that tool.

I also created a channel for myself, based off of yours, to help organize everything, though the command guix system reconfigure -e '(@ (wyvernh system machines baywyvernh) wyvernh-system-baywyvernh)' doesn’t work for me; it fails at parsing the s-expression somehow. I will work that out, but my main problem at the moment is that the system hangs at boot time after starting mcron.

As you can probably tell, I’m fairly new to Guix, and I learned quite a bit from your informative response! Would you be willing to look at my initial basic configuration, in case you notice anything amiss? It’s frustrating that I can’t get it to boot!

The channel is at GitHub - WyvernH/Guix-config.

Never mind!

By starting from a very basic working config, I was able to get the system to work just fine.

The reproducibility and version control literally built into Guix is a huge feature.