Repository navigation
Closed
Labels
0.kind: bugSomething is broken
Description
Describe the bug
After setting up ESPHome, plugging in the device to the server and configuring its yaml configuration, trying to install it causes a compilation failure with this error:
Multiple ways to build the same target were specified for: /var/lib/esphome/.esphome/build/m5stack-atom-echo-1/.pioenvs/m5stack-atom-echo-1/adc.o (from ['/var/lib/private/esphome/.platformio/packages/framework-espidf/components/driver/adc.c'] and from ['/var/lib/private/esphome/.platformio/packages/framework-espidf/components/driver/esp32/adc.c'])
File "/var/lib/esphome/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 684, in compile_source_filesSteps To Reproduce
- Set up ESPHome with this config and a reverse proxy for https
{
services.esphome = {
enable = true;
address = "100.64.0.10";
port = 6052;
};
}- Get the yaml config for my device from here: https://github.com/esphome/wake-word-voice-assistants
- Connect the device to the server using a USB cable
- Click on install and wait for error to show up
Expected behavior
I expect the firmware to be compiled.
Additional context
Because of DynamicUsers, all of the esphome user's files are placed in /var/lib/private/esphome which gets symlinked to /var/lib/esphome (source). This apparently causes issues with ESPHome and platformio as seen here: platformio/platform-espressif32#515.
I managed to work around this and get it to work by doing this:
{config, lib, ...}: {
systemd.services.esphome = let
inherit (lib) mkForce;
cfg = config.services.esphome;
stateDir = "/var/lib/private/esphome";
esphomeParams =
if cfg.enableUnixSocket
then "--socket /run/esphome/esphome.sock"
else "--address ${cfg.address} --port ${toString cfg.port}";
in {
environment.PLATFORMIO_CORE_DIR = mkForce "/var/lib/private/esphome/.platformio";
serviceConfig = {
ExecStart = mkForce "${cfg.package}/bin/esphome dashboard ${esphomeParams} ${stateDir}";
WorkingDirectory = mkForce stateDir;
};
};
}I don't know if this is the proper way to get this to work which is why I didn't do a PR.
Notify maintainers
@oddlama
@megheaiulian
@Stunkymonkey
@rhoriguchi
Metadata
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.6.48, NixOS, 24.11 (Vicuna), 24.11.20240831.12228ff`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.24.4`
- nixpkgs: `/nix/store/bd4fmzws6n5542khxbifbkr6nrygi232-source`Add a 👍 reaction to issues you find important.
Reacted by Kanecaine, Alex Bakon, Thane Gill, frenetic00, Antonín Říha, Pedro Rey Anca, Lukas Jagemann, jaredmontoya and Yusuf Bham
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is broken
Activity
rhoriguchi commentedon Sep 4, 2024
Could you attach the exact config file you are using.
Have you tried to compile the firmware manually?
nix-shell -p esphome --command 'esphome compile /var/lib/esphome/DEVICE-CONFIG.yaml'matt1432 commentedon Sep 4, 2024
@rhoriguchi
I'm not sure how I can compile the firmware manually, I keep getting
Permission denied: ...even withsudo -u esphome.However, I changed the ExecStart to the compile command and it only worked when
PLATFORMIO_CORE_DIRpointed to/var/lib/private/esphome/.platformio.All my nix code related to ESPHome is in my first message if that's what you asked.
This is my device config
rhoriguchi commentedon Sep 11, 2024
Tested it with your config example and got the same issue. The option I suspect causing this issue here
nixpkgs/nixos/modules/services/home-automation/esphome.nix
Line 118 in 574d1ea
From the man page:
I haven't tried this, but try to set option to
offI would report this to upstream since the package has a strange way of handling this option.
matt1432 commentedon Sep 11, 2024
Setting
ProtectSystemtofalsedid not fix my issuerhoriguchi commentedon Sep 11, 2024
Did you delete the 2 dirs before starting the service? Without that option, it should be able to see both dirs but it won't recreate that private symlink so you should delete it first but make a backup of your config.
/var/lib/esphome/var/lib/private/esphomematt1432 commentedon Sep 11, 2024
I just tried deleting the 2 dirs and it didn't work either
GrumpyMeow commentedon Nov 2, 2024
I tried the solution and it did work for me.
Thanks!
ory-the-human commentedon Dec 2, 2024
Hi @GrumpyMeow, where in your configuration did you set that option to off?
oryww commentedon Dec 2, 2024
Tried this and it didn't work for me either.
@matt1432 Did you figure out this issue?
GrumpyMeow commentedon Dec 2, 2024
I remember deleting the directories, but don't know what else i did. Sorry.
matt1432 commentedon Dec 2, 2024
I still have to use the workaround that is in my original message
ToxicFrog commentedon Oct 2, 2025
I was able to workaround this with:
15 remaining items
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user
nixos/esphome: replace DynamicUser with static system user