Can't find config.yaml during apt install crowdsec

I tried installing Crowdsec on my Debian 12 server. I followed the official guide but I got stuck at the second step. I run sudo apt install crowdsec but for some reason, Crowdsec does not create the essential files it needs (config.yaml). I was able to bypass this by manually creating a config.yaml from the GitHub examples, but later on more of these “missing file” errors popped up. I tried completely uninstalling Crowdsec, rebooting and reinstalling, but I keep getting the same issue. I found some threads about people having a similar issue but with Docker, but I’m doing a direct install on the server itself.

user@server:~$ sudo apt install crowdsec
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  crowdsec
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/40.7 MB of archives.
After this operation, 150 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package crowdsec.
(Reading database ... 107105 files and directories currently installed.)
Preparing to unpack .../crowdsec_1.5.5_amd64.deb ...
You can always run the configuration again interactively by using '/usr/share/crowdsec/wizard.sh -c
Unpacking crowdsec (1.5.5) ...
Setting up crowdsec (1.5.5) ...
Updating hub
FATA[13-01-2024 20:52:05] while reading yaml file: open /etc/crowdsec/config.yaml: no such file or directory 
dpkg: error processing package crowdsec (--configure):
 installed crowdsec package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 crowdsec
E: Sub-process /usr/bin/dpkg returned an error code (1)

Very odd can you just download the default configuration from the github

wget -qO- https://raw.githubusercontent.com/crowdsecurity/crowdsec/master/config/config.yaml > /etc/crowdsec/config.yaml

Thank you for your quick response, that fixed it. But the next error is about local_api_credentials.yaml being blank.

user@server:/etc/crowdsec$ sudo apt install crowdsec
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
crowdsec is already the newest version (1.5.5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up crowdsec (1.5.5) ...
Updating hub
INFO[13-01-2024 23:21:03] Wrote new 1058191 bytes index to /etc/crowdsec/hub/.index.json 
Created symlink /etc/systemd/system/multi-user.target.wants/crowdsec.service → /lib/systemd/system/crowdsec.service.
ERRO[13-01-2024 23:21:04] failed to load API client configuration: no credentials or URL found in api client configuration '/etc/crowdsec/local_api_credentials.yaml' 
ERRO[13-01-2024 23:21:04] failed to load API client configuration: no credentials or URL found in api client configuration '/etc/crowdsec/local_api_credentials.yaml' 
Job for crowdsec.service failed because the control process exited with error code.
See "systemctl status crowdsec.service" and "journalctl -xeu crowdsec.service" for details.
dpkg: error processing package crowdsec (--configure):
 installed crowdsec package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 crowdsec
E: Sub-process /usr/bin/dpkg returned an error code (1)

I copy pasted the example from GitHub and also fixed this issue. But the third issue is about crowdsec.service, I ran crowdsec manually and saw that it was about simulation.yaml not existing:

user@server:/etc/crowdsec$ sudo apt install crowdsec
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
crowdsec is already the newest version (1.5.5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up crowdsec (1.5.5) ...
Updating hub
INFO[13-01-2024 23:22:11] hub index is up to date                      
INFO[13-01-2024 23:22:11] Wrote new 1058191 bytes index to /etc/crowdsec/hub/.index.json 
Job for crowdsec.service failed because the control process exited with error code.
See "systemctl status crowdsec.service" and "journalctl -xeu crowdsec.service" for details.
dpkg: error processing package crowdsec (--configure):
 installed crowdsec package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 crowdsec
E: Sub-process /usr/bin/dpkg returned an error code (1)

user@server:/etc/crowdsec$ sudo systemctl status crowdsec.service
● crowdsec.service - Crowdsec agent
     Loaded: loaded (/lib/systemd/system/crowdsec.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-01-13 23:23:05 CET; 46s ago
    Process: 14825 ExecStartPre=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error (code=exited, status=1/FAILURE)
        CPU: 46ms

Jan 13 23:23:05 server systemd[1]: crowdsec.service: Control process exited, code=exited, status=1/FAILURE
Jan 13 23:23:05 server systemd[1]: crowdsec.service: Failed with result 'exit-code'.
Jan 13 23:23:05 server systemd[1]: Failed to start crowdsec.service - Crowdsec agent.

user@server:/etc/crowdsec$ sudo /usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error
time="13-01-2024 23:24:06" level=fatal msg="load error (simulation): while reading yaml file: open /etc/crowdsec/simulation.yaml: no such file or directory"```

Was crowdsec installed before that installation attempt?

apt remove crowdsec will not remove the config and if a manual clean up was done I experienced that as well.

over here Cannot install Crowdsec on Ubuntu 20.04.4 & 18.04.6

there is a hint to use apt-get remove --purge XXXX, that worked for me

1 Like

Thank you, that fixed it

1 Like