I am using nixos-24.11 packages in my flake. I have
services.unifi = {
enable = true;
unifiPackage = pkgs.unifi8;
# mongodb-7_0 is not available precompiled and compiling takes dozens of GB RAM and disk space
# use mongodb-ce instead:
mongodbPackage = pkgs.mongodb-ce;
openFirewall = true;
};
However the unifi service never fully starts. I can not reach the unifi controller webinterface on port 8443.
/var/log/unifi/server.log keeps repeating those lines:
[2025-04-19T17:49:18,490+02:00] <mongod-tail> WARN mongo - Mongo log not found during startup
[2025-04-19T17:49:18,591+02:00] <mongod-tail> WARN mongo - Mongo log not found during startup
[2025-04-19T17:49:18,691+02:00] <mongod-tail> WARN mongo - Mongo log not found during startup
[2025-04-19T17:49:18,792+02:00] <mongod-tail> WARN mongo - Mongo log not found during startup
[2025-04-19T17:49:18,892+02:00] <mongod-tail> WARN mongo - Mongo log not found during startup
[2025-04-19T17:49:18,974+02:00] <mongo-db> WARN mongo - Stop listening to Mongo logs after process has exited
[2025-04-19T17:49:18,974+02:00] <mongo-db> INFO mongo - Database process stopped, code=132
So I wanted to try to downgrade the mongodb package from 8.x to 7x and see if that works arround the issue. My problem is I am new to nixos and donât know how to specify the mongodb-ce version for unifi.
This didnât work: mongodbPackage = pkgs.mongodb-ce.override { version = "7.0.14"; };
Can I only do this via the lock file?
Okay so the issue causing the mongodb crashes was not exposing the AVX cpuinfo flag to the VM that nixos runs in. AVX is a minimum requirement for mongodb.
Now everything works, except some occasional IllegalStateExceptions, that donât affect normal operation as far as I can tell.
Mai 05 04:47:39 nixos-unifi java[892]: Exception in thread âThread-12â java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ârefreshâ before accessing beans via the ApplicationContext
Mai 05 04:47:39 nixos-unifi java[892]: at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:169)
Mai 05 04:47:39 nixos-unifi java[892]: at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1252)
Mai 05 04:47:39 nixos-unifi java[892]: at com.ubnt.service.ooOO.Ă00000(Unknown Source)
Mai 05 04:47:39 nixos-unifi java[892]: at com.ubnt.ace.Launcher.Ă00000(Unknown Source)
Mai 05 04:47:39 nixos-unifi java[892]: at java.base/java.lang.Thread.run(Thread.java:840)