Closed nihil-2019 closed 3 years ago
cc @matejc
FTR I have applied a similar workaround to @yegortimoshenko in my configuration.nix
networking.wireless = {
enable = true; # Actually automatically enabled by connman.
networks = {
# Fake ssid so NixOS creates wpa_supplicant.conf
# otherwise the service fails and WiFi is not available.
# https://github.com/NixOS/nixpkgs/issues/23196
S4AKR00UNUN21W1NV2Y5MDDW8 = {};
};
};
I think that it would be possible to fix this if the connman configuration did something similar when it's being instantiated:
wireless.networks
If people are interested, I'd be willing to submit a PR (with some guidance from maintainers/developers).
BTW, this happens in:
"x86_64-linux"
Linux 4.14.43, NixOS, 18.03.132507.5f2da7f837e (Impala)
yes
no
nix-env (Nix) 2.0.2
"nixos-18.03.132507.5f2da7f837e"
"nixpkgs-18.03.132448.33682d9af4c"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
Thanks!
So isn't it a duplicate of https://github.com/NixOS/nixpkgs/issues/56125 ?
This workaround is no longer needed.
@doronbehar unfortunately I can still reproduce the issue with a fresh NixOS 20.03.2651.0a40a3999eb
.
Would it be possible to reopen this issue please? I don't want to create duplicates.
Thanks.
@stefano-m many things have changed since your last comment - e.g the names of the options. I think it'd be better to open a new issue with better info of the NixOS version you use (I can confirm I don't experience this issue anymore on unstable) and ccing the module's maintainer.
iwd
but the problem is still present with wpa_supplicant
.I can open a new GitHub issue allright, but the problem on the latest stable 20.03 (fresh installation) is the same as described here with the same workaround https://github.com/NixOS/nixpkgs/issues/23196#issuecomment-392932006).
If the problem has been fixed in unstable, unfortunately it does not make the situation any better for users that are on the stable channel.
Also, AFAIU this does not even seem to be fixed in unstable, because networking.wireless.enable
with no networks configured still relies on a /etc/wpa_supplicant.conf
file
that may or may not exist. In the case of connman, that file does not exist, which causes the wpa supplicant service to fail which causes connman to be unable to use wifi.
Alternative workaround (which is also nice for plain wpa supplicant use so that wpa_gui
can be used by users in the network
group):
{
users.groups = {
"network" = {};
};
systemd.services.wpa_supplicant_initial_cfg = {
description = "WPA Supplicant Initial Configuration";
before = [ "network.target" "wpa_supplicant.service" ];
wants = [ "network.target" ];
wantedBy = [ "multi-user.target" "wpa_supplicant.service" ];
path = [];
script = ''
if ! test -e "/etc/wpa_supplicant.conf"; then
printf "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=network\nupdate_config=1\n" > /etc/wpa_supplicant.conf
fi
chmod 600 /etc/wpa_supplicant.conf
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
};
networking = {
wireless.enable = true;
connman.enable = true;
};
}
If the problem has been fixed in unstable, unfortunately it does not make the situation any better for users that are on the stable channel.
I agree :grimacing: though we are near yet a 20.09 release and I sure hope whatever commit that fixed it on unstable will reach 20.09. I'll reopen as it seems others are still facing this issue on 20.03. If anyone is capable of verifying that the issue persists on 20.03 or 20.09, it'll help.
Well, I'm happy that this has been reopened although, looking at the code on master, I have the feeling that this is not yet solved.
The problem is that connman sets networking.wifi.enable
to true
but it does not set a default configuration for wpa_supplicant
causing the wpa_supplicant
service to fail.
I wish I had more time to look into it since it's been bothering me for a while. I hope that eventually I'll be able to post a PR.
Thanks for keeping this issue open.
Is it possible that this is related to https://github.com/NixOS/nixpkgs/issues/101963?
Applying @rnhmjoj's fix (https://github.com/NixOS/nixpkgs/pull/104722) I observe reliable availability of wifi in NixOS 20.09 (including on first boot), even when removing the dummy network workaround.
I marked this as stale due to inactivity. → More info
I close this considering @knuton's report that this is not an issue on stable and unstable anymore.
Interesting... I have recently moved to NixOS 21.05 and the issue was still present for me. I don't mind that this issue has been closed. If I ever get to it I might investigate further and possibly submit a patch.
In the meantime I changed my workaround slightly:
environment.etc."wpa_supplicant.conf".text = lib.mkIf
config.services.connman.enable
''
# Dummy config file. Connman uses wpa_supplicant directly.
'';
The only annoying thing is that with 21.05 I get a warning whenever I rebuild because "wpa_supplicant" has not interfaces:
trace: warning: No network interfaces for wpa_supplicant have been configured: the service
may randomly fail to start at boot. You should specify at least one using the option
networking.wireless.interfaces.
I guess this can be avoided by conditionally disabling the warning is services.connman.enable
is true
.
@stefano-m I must be missing something: why are you enabling networking.wireless
when using services.connman
? You say connman starts wpa_supplicant manually, so you should configure the its daemon using networking.wireless
.
Not sure I follow...
IIRC services.connman.enable = true
also enables networking.wireless
and I guess that then the warning follows.
Connman configures wpa_supplicant on its own, I don't need to do anything directly.
Ah, I missed that line, thanks. So, connman starts the daemon and writes to /etc/wpa_supplicant.conf
at runtime?
AFAIU no, it does not, it just sets networking.wireless
to true
(and disables NetworkManager).
I guess that ideally, it should create a dummy /etc/wpa_supplicant.conf
if none exists, and at the same time networking.wireless
should disable the warning if connman is enabled.
I close this considering @knuton's report that this is not an issue on stable and unstable anymore.
My report above was about a version of nixpkgs with https://github.com/NixOS/nixpkgs/pull/104722 applied, however this patch has been reverted in upstream nixpkgs and no longer is present in 21.05 (see also https://github.com/NixOS/nixpkgs/issues/107341#issuecomment-862155447).
So I can't say how this behaves in current NixOS, sorry. :-)
This should be finally fixed with #127595 (now in nixos-unstable).
Issue description
When connman is enabled with
networking.connman.enable = true
, connman fails to see Wi-Fi. It will not be listed in technologies & when runningenable wifi
inconnmanctl
you will get the cryptic & confusing errorError wifi: Method "SetProperty" with signature "sv" on interface "net.connman.Technology" doesn't exist
Oddly enough, connman works fine when
networking.connman.enable = false
&networking.wireless.enable = true
(specifically, when wpa_supplicant is running, which of course also requires a valid wpa_supplicant.conf otherwise it'll fail.) &connmand
is manually run as root.Steps to reproduce
1.Put
networking.connman.enable = true
in configuration.nix.nixos-rebuild switch --upgrade
Technical details