Also recorded here: https://bugs.debian.org/1132088

Hi,

Since version 3.12, cabal will not build propellor config if it has no package index.

When using propellor --init, it fails when trying to build the configuration:

nicolas@testvm:~$ propellor --init


                 _         ______`|                     ,-.__
 .---------------------------  /   \___-=O`/|O`/__|                    (____.'
  - Welcome to              -- \          / | /    )        _.-'-._
  -            Propellor!   --  `/-==__ _/__|/__=-|        (       \_
 `---------------------------   *             \ | |         '--------'
                    (o)  `


Propellor's configuration file is ~/.propellor/config.hs

Let's get you started with a simple config that you can adapt
to your needs. You can start with:
   A: A clone of propellor's git repository    (most flexible)
   B: The bare minimum files to use propellor  (most simple)
Which would you prefer? [A|B] b
hint: Using 'master' as the name for the initial branch. This default branch name
hint: will change to "main" in Git 3.0. To configure the initial branch name
hint: to use in all of your new repositories, which will suppress this warning,
hint: call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
Initialized empty Git repository in /home/nicolas/.propellor/.git/
Creating minimal config ... done

------------------------------------------------------------------------------

Let's try building the propellor configuration, to make sure it will work...

Config file path source is default config file.
Config file not found: /home/nicolas/.config/cabal/config
Writing default configuration to /home/nicolas/.config/cabal/config
Error: [Cabal-7160]
The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it.

'cabal.project.local' already exists, backing it up to 'cabal.project.local~'.
Error: [Cabal-7160]
The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it.

propellor: cabal build failed
CallStack (from HasCallStack):
  error, called at src/Propellor/Bootstrap.hs:274:25 in propellor-5.18-ARIHO6yi294BROyWQhe7xc:Propellor.Bootstrap
HasCallStack backtrace:
  finally, called at src/System/Console/Concurrent/Internal.hs:117:28 in propellor-5.18-ARIHO6yi294BROyWQhe7xc:System.Console.Concurrent.Internal

If cabal update has been run, the build works:

[...]
------------------------------------------------------------------------------

Let's try building the propellor configuration, to make sure it will work...

Resolving dependencies...
Build profile: -w ghc-9.10.3 -O1
In order, the following will be built (use -v for more details):
 - config-0 (exe:propellor-config) (first run)
Configuring config-0...
Preprocessing executable 'propellor-config' for config-0...
Building executable 'propellor-config' for config-0...
[1 of 1] Compiling Main             ( config.hs, /home/nicolas/.propellor/dist-newstyle/build/x86_64-linux/ghc-9.10.3/config-0/build/propellor-config/propellor-config-tmp/Main.o )
[2 of 2] Linking /home/nicolas/.propellor/dist-newstyle/build/x86_64-linux/ghc-9.10.3/config-0/build/propellor-config/propellor-config
Propellor build ... done

Great! Propellor is bootstrapped.

------------------------------------------------------------------------------

Propellor can use gpg to encrypt private data about the systems it manages,
and to sign git commits.
You don't seem to have gpg installed, so skipping setting it up.
Propellor can still be used without gpg, but it won't be able to
manage private data. You can set this up later:
 1. gpg --gen-key
 2. propellor --add-key (pass it the key ID generated in step 1)

------------------------------------------------------------------------------

Everything is set up ...
Your next step is to edit ~/.propellor/config.hs
and run propellor again to try it out.

For docs, see https://propellor.branchable.com/
Enjoy propellor!

When using propellor --spin, it fails when remotely building the configuration:

nicolas@testvm:~/.propellor$ propellor --spin testvm
Up to date
Propellor build ... done
[master 7b09329] propellor spin
Git commit ... done
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.08 KiB | 555.00 KiB/s, done.
Total 7 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
propellor7266-0.git                                                                                                                                                                100% 1173     1.1MB/s   00:00    
Cloning into '/usr/local/propellor'...
Note: switching to '7b0932958a9d751e5762ac65383838dfb2da7de5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Switched to a new branch 'master'
Clone git repository to testvm ... done
'cabal.project.local' already exists, backing it up to 'cabal.project.local~'.
Error: [Cabal-7160]
The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it.

sh: 1: ./propellor: not found
propellor: user error (ssh ["-o","ControlPath=/home/nicolas/.ssh/propellor/testvm.sock","-o","ControlMaster=auto","-o","ControlPersist=yes","root@testvm","sh -c 'if [ ! -d /usr/local/propellor/.git ] ; then (if ! git --version >/dev/null 2>&1; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq --no-install-recommends --no-upgrade -y install git; fi && echo STATUSNeedGitClone) || echo STATUSNeedPrecompiled ; else cd /usr/local/propellor && if ! cabal configure >/dev/null 2>&1; then ( apt-get update ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install gnupg ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install ghc ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install cabal-install ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-async-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-split-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-hslogger-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-unix-compat-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-ansi-terminal-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-ifelse-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-network-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-mtl-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-transformers-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-exceptions-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-text-dev ; DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-hashable-dev ; if LANG=C apt-cache policy libghc-type-errors-dev| grep -q Candidate:; then DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-type-errors-dev; fi ; if LANG=C apt-cache policy libghc-stm-dev| grep -q Candidate:; then DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install libghc-stm-dev; fi ; cabal update ; cabal install --only-dependencies) || true; fi&& if ! test -x ./propellor; then cabal configure && cabal build -j1 propellor-config && if [ -d dist-newstyle ]; then ln -sf $(cabal exec -- sh -c '\"'\"'command -v propellor-config'\"'\"') '\"'\"'propellor'\"'\"'; else ln -sf dist/build/propellor-config/propellor-config '\"'\"'propellor'\"'\"'; fi; fi;if test -x ./propellor && ! ./propellor --check; then cabal clean && cabal configure && cabal build -j1 propellor-config && if [ -d dist-newstyle ]; then ln -sf $(cabal exec -- sh -c '\"'\"'command -v propellor-config'\"'\"') '\"'\"'propellor'\"'\"'; else ln -sf dist/build/propellor-config/propellor-config '\"'\"'propellor'\"'\"'; fi; fi && ./propellor --boot testvm ; fi'"] exited 127)
HasCallStack backtrace:
  finally, called at src/System/Console/Concurrent/Internal.hs:117:28 in propellor-5.18-ARIHO6yi294BROyWQhe7xc:System.Console.Concurrent.Internal

Again, it works if cabal update has been run for the root user (like with ssh root@testvm cabal update).

There is a --offline flags for cabal, but it does not solve the problem:

nicolas@testvm:~/.propellor$ cabal build --offline
Error: [Cabal-7160]
The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it.

The user can work around the problem by running cabal update, but this has the side effect of wasting 1 GB of package list, which are useless for propellor usage. On the machine you run propellor, that’s 1 GB for your own user and 1 GB for the root user.

This problem can be seen on Debian testing and unstable, where cabal-install is at version 3.12.

--Nicolas