5.7 KiB
Troubleshooting Guide
This guide provides solutions for common issues that may arise when using this NixOS configuration.
System Issues
Failed System Build
Problem: nixos-rebuild switch fails with an error.
Solutions:
-
Syntax Errors:
- Check the error message for file and line number information
- Verify the syntax in the mentioned file
- Common issues include missing semicolons, curly braces, or mismatched quotes
-
Missing Dependencies:
- If the error mentions a missing package or dependency:
git pull # Update to the latest version nix flake update # Update the flake inputs
- If the error mentions a missing package or dependency:
-
Conflicting Modules:
- Look for modules that might be configuring the same options incompatibly
- Disable one of the conflicting modules or adjust their configurations
-
Disk Space Issues:
- Check available disk space with
df -h - Clear old generations:
sudo nix-collect-garbage -d
- Check available disk space with
Boot Issues
Problem: System fails to boot after a configuration change.
Solutions:
-
Boot into a Previous Generation:
- At the boot menu, select an older generation
- Once booted, revert the problematic change:
cd /etc/nixos git revert HEAD # Or edit the files directly sudo nixos-rebuild switch
-
Boot from Installation Media:
- Boot from a NixOS installation media
- Mount your system:
sudo mount /dev/disk/by-label/nixos /mnt sudo mount /dev/disk/by-label/boot /mnt/boot # If separate boot partition - Chroot into your system:
sudo nixos-enter --root /mnt cd /etc/nixos git revert HEAD # Or edit the files directly nixos-rebuild switch --install-bootloader
Home Assistant Issues
Home Assistant Fails to Start
Problem: Home Assistant service fails to start.
Solutions:
-
Check Service Status:
systemctl status home-assistant journalctl -u home-assistant -n 100 -
Database Issues:
- Check PostgreSQL is running:
systemctl status postgresql - Verify database connection settings in Home Assistant configuration
- Check PostgreSQL is running:
-
Permission Issues:
- Check ownership and permissions on config directory:
ls -la /var/lib/homeassistant sudo chown -R hass:hass /var/lib/homeassistant sudo chmod -R 750 /var/lib/homeassistant
- Check ownership and permissions on config directory:
-
Custom Component Issues:
- Try disabling custom components to isolate the issue:
- Edit
modules/nixos/homeassistant/services/homeassistant/default.nix - Comment out the
customComponentssection - Rebuild:
sudo nixos-rebuild switch
- Edit
- Try disabling custom components to isolate the issue:
Zigbee Device Connection Issues
Problem: Zigbee devices fail to connect or are unstable.
Solutions:
-
Verify Device Path:
- Check the Zigbee coordinator is properly detected:
ls -la /dev/ttyUSB* - Update the device path if needed:
- Edit your system configuration
- Set
mjallen.services.home-assistant.zigbeeDevicePathto the correct path - Rebuild:
sudo nixos-rebuild switch
- Check the Zigbee coordinator is properly detected:
-
Interference Issues:
- Move the Zigbee coordinator away from other wireless devices
- Try a USB extension cable to improve positioning
- Change Zigbee channel in Zigbee2MQTT configuration
-
Reset Zigbee2MQTT:
systemctl restart zigbee2mqtt
Automation Issues
Problem: Automations don't run as expected.
Solutions:
-
Check Automation Status:
- In Home Assistant UI, verify the automation is enabled
- Check Home Assistant logs for automation execution errors
-
Entity Issues:
- Verify entity IDs are correct
- Check if entities are available/connected
- Test direct service calls to verify entity control works
-
Trigger Issues:
- Test the automation manually via Developer Tools > Services
- Use
automation.triggerservice with the automation's entity_id
Flake Issues
Flake Input Update Errors
Problem: nix flake update fails or causes issues.
Solutions:
-
Selective Updates:
- Update specific inputs instead of all at once:
nix flake lock --update-input nixpkgs
- Update specific inputs instead of all at once:
-
Rollback Flake Lock:
- If an update causes issues, revert to previous flake.lock:
git checkout HEAD^ -- flake.lock
- If an update causes issues, revert to previous flake.lock:
-
Pin to Specific Revisions:
- In
flake.nix, pin problematic inputs to specific revisions:nixpkgs-stable.url = "github:NixOS/nixpkgs/5233fd2ba76a3accb05f88b08917450363be8899";
- In
Secret Management Issues
Sops Decryption Errors
Problem: Sops fails to decrypt secrets.
Solutions:
-
Key Issues:
- Verify your GPG key is available and unlocked
- Check
.sops.yamlincludes your key fingerprint
-
Permission Issues:
- Check file permissions on secret files
- Make sure the user running
nixos-rebuildhas access to the GPG key
Network Issues
Firewall Blocks Services
Problem: Services are not accessible due to firewall rules.
Solutions:
-
Check Firewall Status:
sudo nix-shell -p iptables --run "iptables -L" -
Verify Firewall Configuration:
- Check if ports are properly allowed in the configuration
- Add missing ports if necessary
-
Temporary Disable Firewall (for testing only):
sudo systemctl stop firewall # After testing sudo systemctl start firewall
Getting Help
If you encounter an issue not covered in this guide:
- Check the NixOS Wiki: https://nixos.wiki/
- Search the NixOS Discourse forum: https://discourse.nixos.org/
- Join the NixOS Matrix/Discord community for real-time help
- File an issue in the repository if you believe you've found a bug