You are not logged in.

#1 2019-02-03 11:41:15

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

[SOLVED] Connection with connman doesn't work

I'm almost just after the install of ArchLinux, and, before doing anything unnecessary in respect of what I ask in the title, I'd only like to have ConnMan work, in order to deal with ethernet, wifi, bluetooth, and so on.

As soon as I log in with my non-root user, the connection doesn't work,

$ ping archlinux.org
ping: archlinux.org: Temporary failure in name resolution

As suggested in Check_the_connection I check the following points are verified (or try to make them be verified)

1. Your network interface is listed and enabled. It seems so, from the following output (isn't enp5s0 what I'm lookin for, if I want to connect by ethernet?).

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 14:da:e9:36:4f:ea brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 78:92:9c:24:9e:a0 brd ff:ff:ff:ff:ff:ff
$ sudo ip link set enp5s0 up
$ ip link show dev enp5s0
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 14:da:e9:36:4f:ea brd ff:ff:ff:ff:ff:ff

2. You are connected to the network. The cable is plugged in or [... I don't care, since it's about wifi, and I want a working ConnMan to deal with wifi]. The ethernet cable is plugged in.

3. Your network interface has an IP address. Has it got?

$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mt 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 14:da:e9:36:4f:ea brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 78:92:9c:24:9e:a0 brd ff:ff:ff:ff:ff:ff

I can't see any reasonable IP here, am I wrong? So I try to add one, but I get a bit lost, since I don't know what prefix_len is; anyway I think it's 24 (just beacuse it's a number I see in afterward when I have the connection working), so I enter

$ sudo ip address add 192.168.1.14/24 broadcast + dev enp5s0
$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mt 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 14:da:e9:36:4f:ea brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.14/24 brd 192.168.1.255 scope global enp5s0
       valid_lft forever preferred_lft forever
3: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 78:92:9c:24:9e:a0 brd ff:ff:ff:ff:ff:ff

Am I ok now with this poin too? I don't know, actually, but I try to go on.

4. Your routing table is correctly set up.

$ ip route show

Gives no output at all, so I try (is default correct?)

$ sudo ip route add default via 192.168.1.14 dev enp5s0
RTNETLINK answers: Network is down

Ok, I'm completely lost now. So I just try to guess what to do (while jumping from one link to another in the wikis).

$ sudo dhcpcd enp5s0
enp5s0: waiting for the carrier
enp5s0: carrier acquired
DUID 00:04:9c:ed:14:80:b9:9a:81:e0:3a:7a:14:da:e9:36:4f:ea
enp5s0: IAID e9:36:4f:ea
enp5s0: adding address fe80::965f:48e5:6c38:79c9
enp5s0: carreir lost
enp5s0: deleting address fe80::965f:48e5:6c38:79c9
enp5s0: carreir acquired
enp5s0: IAID e9:36:4f:ea
enp5s0: adding address fe80::965f:48e5:6c38:79c9
enp5s0: soliciting an IPv6 router
enp5s0: rebinding lease of 192.168.1.14    <--- this is the assigned IP that I can check from the other computer
enp5s0: Router Advertisement from fe80::1213::31ff:fef5:678
enp5s0: soliciting a DHCPv6 lease
enp5s0: dropping DHCPv6 due to no valid routers
enp5s0: DHCP lease expired
enp5s0: soliciting a DHCP lease
enp5s0: offered 192.168.1.14 from 192.168.1.254
enp5s0: probing address 192.168.1.14/24
enp5s0: leased 192.168.1.14 for 86400 seconds
enp5s0: adding route to 192.168.1.0/24
enp5s0: adding default route via 192.168.1.254
forked to background, child pid 657

$ ping archlinux.org
PING archlinux.org (138.201.81.199) 56(84) bytes of data.
64 bytes from apollo.archlinux.org (138.201.81.199): icmp_seq=1 ttl=54 time=39.6 ms
64 bytes from apollo.archlinux.org (138.201.81.199): icmp_seq=2 ttl=54 time=39.4 ms
64 bytes from apollo.archlinux.org (138.201.81.199): icmp_seq=3 ttl=54 time=38.3 ms
64 bytes from apollo.archlinux.org (138.201.81.199): icmp_seq=4 ttl=54 time=38.3 ms
64 bytes from apollo.archlinux.org (138.201.81.199): icmp_seq=5 ttl=54 time=39.5 ms

Ok, so now I'm connected to the internet. Btw, I'm wrong in assuming that this condition is sufficient to say that all points in Check_the_connection are satisfied?

Now I go to ConnMan's page and read that I should disable any existing network configuration before enabling connman.service; is the following enough to go on and enabling it?

$ systemctl status dhcpcd.service
■ dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

$ systemctl status dhcpcd@enp5s0.service
■ dhcpcd@enp5s0.service - dhcpcd on enp5s0
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

$ systemctl status connman.service
■ connman.service - Connectiion service
   Loaded: loaded (/usr/lib/systemd/system/connman.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

If so, then I enter

$ sudo systemctl enable connman.service
$ sudo systemctl start connman.service
$ systemctl status connman.service
■ connman.service - Connectiion service
   Loaded: loaded (/usr/lib/systemd/system/connman.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2019...... 4s ago
 Main PID: 1214 (connmand)
    Tasks: 1 (limit: 4915)
   Memory: 7.0M
   CGroup: /system.slice/connman.service
           └─1214 /user/bin/connmand -m

but now I can't ping

$ ping archlinux.org # it takes a while (more than a coulple of seconds) to get the output
ping: archlinux.org: Temporary failure in name resolution

If I try again, I get

$ ping archlinux.org
PING archlinux.org (138.201.81.199) 56(84) bytes of data.
From archlinux (192.168.1.14) icmp_seq=1 Destination Host Unreachable
From archlinux (192.168.1.14) icmp_seq=2 Destination Host Unreachable
From archlinux (192.168.1.14) icmp_seq=3 Destination Host Unreachable
From archlinux (192.168.1.14) icmp_seq=4 Destination Host Unreachable
From archlinux (192.168.1.14) icmp_seq=5 Destination Host Unreachable
From archlinux (192.168.1.14) icmp_seq=6 Destination Host Unreachable

Oh, during install I inadvertently skipped this section in the installation guide, so I have no /etc/hostname file.

Last edited by Enrico1989 (2019-02-05 16:01:46)

Offline

#2 2019-02-03 13:36:29

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

As soon as I log in with my non-root user, the connection doesn't work

Are you implying that you've a working wifi connection via connman w/ root logins and that is then just magically severed when you login as a non-privileged user? I kinda doubt that.

First of all, fix your hostname. That's not an optional step. You'll face trouble down the road.

Second: stop the mindless poking around.
Connman won't work if the service isn't running. Also it's not possible to run competitive network managing services (in your case you started dhcpcd by hand and than attempted connman on top of that)
Also don't try to statically configure the network by hand and then using connman on top of that.

If you want to use connman, follow https://wiki.archlinux.org/index.php/ConnMan step by step. For wifi make sure you've either iwd or wpa_supplicant installed (as instructed by wiki)

Don't forget: first of all fix your hostname.

Offline

#3 2019-02-04 09:29:35

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

seth wrote:
As soon as I log in with my non-root user, the connection doesn't work

Are you implying that you've a working wifi connection via connman w/ root logins and that is then just magically severed when you login as a non-privileged user? I kinda doubt that.

Oh, it really seems I imply that, sorry, but no, the behavior is the same for the root login, as far as I can tell from the few tests I've done.

seth wrote:

Don't forget: first of all fix your hostname.

Done now; what about the /etc/hosts file? That section also tells me to fill it with the content

127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

which I can do, since I have a hostname, now. But is says If the system has a permanent IP address, it should be used instead of 127.0.1.1.. If "system" means the computer and not anything wider than that (e.g. the router as something that as a public IP), I suspect that the "permanent IP address" refers to the local IP address that I want my laptop to use (192.168.1.14), which can be permanent since, for instance, I can glue it to the laptop's MAC address, or it could be the only available local IP, etc. Am I wrong?

seth wrote:

Also it's not possible to run competitive network managing services (in your case you started dhcpcd by hand and than attempted connman on top of that)

Yes, I've read that, and in turn assumed the following: if I get a situation in which the computer is successfully connected to the internet (proof: download any file from the www), then I can be sure that I have only a single network managing service working and, in turn, that it is the only service I have to disable&stop before enabling&starting connman. Am I wrong?

seth wrote:

Also don't try to statically configure the network by hand and then using connman on top of that.

This sounds a bit obscure to me.

seth wrote:

If you want to use connman, follow https://wiki.archlinux.org/index.php/ConnMan step by step.

I'm trying to, but I don't think the problem is with ConnMan:

$ connmanctl
connmanctl> technologies
/net/connman/technology/ethernet
  Name = Wired
  Type = ethernet
  Powered = True
  Connected = True
  Tethering = False
/net/connman/technology/wifi
  Name = WiFi
  Type = wifi
  Powered = True
  Connected = False
  Tethering = False

which is what I get when everything works (from the perfectly working system from which I'm writing now).

seth wrote:

For wifi make sure you've either iwd or wpa_supplicant installed (as instructed by wiki)

wpa_supplicant is installed, but I'm not messing up with the wifi, since not event the ethernet connection is working with ConnMan, hence the present thread.

Offline

#4 2019-02-04 13:22:05

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

You can but don't have to maintain /etc/hosts - several network managers will actually rewrite it.
Please ensure youre not literally using "myhostname"…

You determine whether and how many and which NM services you're running by checking which you're running.
For the beginning, try

systemctl list-unit-files --state=enabled

By assigning IPs and adding routes you're manually configuring a static network layout. Stop doing this. You want to use connman and just get "weird" results because the system is trying to use those manual values which lack any basis in reality.

Enrico1989 wrote:

which is what I get when everything works (from the perfectly working system from which I'm writing now).

That's not "perfectly working" - you've an ethernet connection, likely from dhcpcd and because there's a cable plugged into it.

Enrico1989 wrote:

wpa_supplicant is installed, but I'm not messing up with the wifi, since not event the ethernet connection is working with ConnMan, hence the present thread.

Enrico1989, earlier wrote:

The cable is plugged in or [... I don't care, since it's about wifi, and I want a working ConnMan to deal with wifi]. The ethernet cable is plugged in.

Please specify your actual goals, stop dhcpcd, start connman, check the connection status. In doubt "connmanctl enable ethernet" and continue the wifi connection by following the wiki.

Offline

#5 2019-02-04 17:22:49

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

seth wrote:
systemctl list-unit-files --state=enabled

It gives

autovt@.service  enabled
connman.service  enabled
getty@.service   enabled
remote-fs.target enabled
seth wrote:

By assigning IPs and adding routes you're manually configuring a static network layout. Stop doing this. You want to use connman and just get "weird" results because the system is trying to use those manual values which lack any basis in reality.

Well, I do it because I want to know which address I have to use to connect to each specific computer from the smartphone when I'm not home. Wouldn't the IP be assigned in an unpredictable (to me) way if I didn't enfornce them manually in the router config page?

seth wrote:

Please specify your actual goals

My actual goal is to use ConnMan to manage the network. It could maybe important that so far (with two working computers, not counting the laptop), I've used connman just to switch on/off the wifi, etherneth, and bluetooth, and nothing more. For instance I've disconnected and disabled the ethernet, and enabled and connected the wifi, for this pc from which I write, since I've only one ethernet cable which I'm using to connect the laptop in question.

Anyway, I've followed your suggestion of going on with the wifi and it works. The ethernet, though, doesn't, even if I enable and connect it (please, see my second message). Since it's a laptop I could pragmatically be not very interested, in the end, in a working ethernet, if the wifi works, but... I'd like to understand why it doesn't and, possibly, how to make it work (I could need this understanding for another computer with no wifi).

Offline

#6 2019-02-04 17:45:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

I do it because I want to know which address I have to use to connect to each specific computer from the smartphone when I'm not home.

When you're "not home" you're not using your router and on a foreign router you'll most likely not get to select the IP you want - let alone that the router might use a random other IP range.
If you mean *you* and your smartphone are not at home, but your notebook is: for IPv4 you'll be talking to the public IP of your router and the NAT will translate that to the devices behind. You cannot directly connect w/ your notebook behind your home-router.

If you want to use connman and a static IP rather than dhcp, see https://www.mankier.com/5/connman-service.config - you'll have to tell connman to configure the static IP and not tell connman to use dhcp while you're configuring a static IP behind its back.

Offline

#7 2019-02-04 18:20:00

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

Uh, I just forgot that obviously I type the public IP and not the local one big_smile. Actually I don't even write it, since it's saved in the app. Now that I look again at the app, I remembre I had set two port forwarding rules to allow access to the computer from which I write both when it is connected by wifi and eth.

But what about connecting within the local network? In this moment I could simply ssh to the 192.168.1.X address; in fact I have a .ssh/config file with all IPs and usernames under easy-to-remembre names. I could I set these config file if it was not me to set the IP for each system? Would the static local IPs approach still be useless or too dumb?

Offline

#8 2019-02-04 20:21:47

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

Nobody said it's "useless or dumb", but if you want connman to configure your network and if you want a static IP, you'll have to configure connman to obtain a static IP. Not some hybrid approach where you try to set a static IP and don't tell connman and just expect it will magically figure your intentions.

There are however superior approaches, depending on the capabilities of your router. You can usually configure the routers dhcp server to reserve IPs and assign them to specific MACs. Some routers will even allow you to assign a domain name for those IPs (usually by some dnsmasq implementation in the router)
This is more robust since you won't accidentally cause conflicts among devices and also won't run into a situation where the router has handed out the desired IP to another lease via dhcp.

Offline

#9 2019-02-05 06:52:05

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

seth wrote:

depending on the capabilities of your router. You can usually configure the routers dhcp server to reserve IPs and assign them to specific MACs.

Yes, I have this configured (a lot of the MACs are friends'/relatives'/... smartphones and/or laptops, the printer, the wifi extender, ...):
https://i.ibb.co/rHcLxSY/IPvsMAC.png

seth wrote:

There are however superior approaches

Superior to what? To using connman? So is setting up the router's IP vs MAC table a solution that goes against using connman? Or does it simply mean that I'd have to configure connman according to that table?

Last edited by jasonwryan (2019-02-05 07:00:14)

Offline

#10 2019-02-05 07:00:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Connection with connman doesn't work

Read the Code of Conduct and only post thumbnails http://wiki.archlinux.org/index.php/Cod … s_and_code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2019-02-05 08:05:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

You just let connman do dhcp (as it does by default) and don't try to set a static IP on the local system and let the router worry about the IP assignment…

Offline

#12 2019-02-05 15:00:53

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

So you mean I should delete all those (IP,MAC) configuration in the image I posted (and should have linked only, sorry)?

Offline

#13 2019-02-05 15:05:16

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

Certainly not, that's the exact opposite of what I said.
You shall skip any attempt to "ip address add 192.168.1.14/24 broadcast + dev enp5s0", "ip route add default via 192.168.1.14 dev enp5s0", dhcpcd and the likes.
Ensure connman and only connman is enabled and let it and the routers dhcp server manage the connections. In doubt you might have to re-enable the ethernet connection in connman and that's it.

At this point I'm frankly no longer sure whether this is serious or you're just trolling.

Offline

#14 2019-02-05 16:00:34

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

Quite detailed messages from a troll, I'd say hmm

Stopping and disabling dhcpc and enabling and starting connman was my first try, based on connman wiki. But it didn't work (nor did I think that good idea would have been to try the wifi before having the ethernet work), so I got swallowed in the Network Configuration wiki and this dhcp(cd) stuff.

About message #12, setting up those (IP,MAC) address is a way to use static IPs, isn't it? In your #11 message you suggested to don't try to set up a static IP. Hence my message #12. Only after your last message I understand you were referring to those commands I picked from the wikis with the spirit of "trying something I don't understand since all I understad didn't work" (yes, not a smart move, in the end), and not to the router config page.

I'm not trolling.

So your point is: use nothing but connman and the router-bound configuration utilities, the former to turn on/off what I like when I like, and the latter to set up a static IP for each MAC in my local network. Am I right? If I am, then it seems that I was just too stingy with the reboots (especially with the router, maybe), since it seems that the ethernet connection works now as well.

I've shrunk the title to put [SOLVED] in it.

Last edited by Enrico1989 (2019-02-05 16:02:54)

Offline

#15 2019-02-05 16:15:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,767

Re: [SOLVED] Connection with connman doesn't work

That's not a static IP - you're still configuring via dhcp, that there's a reservation list in the dhcp server is a detail of the server only.

So your point is: use nothing but connman and the router-bound configuration utilities, the former to turn on/off what I like when I like, and the latter to set up a […] IP for each MAC in my local network.

This.

In case this fails, focus on why connman doesn't do it's supposed job (by checking it's opinion on the "technologies") instead of tweaking the system around it.
Or use a different network manager, if you want.
If "it didn't work", specify what you actually do (commands, configs, …) and the actual results ("ip l", "ip r" is good here, next to error messages of course) in comparism to the expectation.

Offline

#16 2019-02-05 16:38:35

Enrico1989
Member
Registered: 2018-07-05
Posts: 301

Re: [SOLVED] Connection with connman doesn't work

seth wrote:

In case this fails, focus on why connman doesn't do it's supposed job (by checking it's opinion on the "technologies") instead of tweaking the system around it.

I did it, and connman's opinion looked like it should look like when it works, but it didn't (probably I should have rebooted the router and the computer), so I started tweaking and messing around it.

Enrico1989 wrote:

I'm trying to, but I don't think the problem is with ConnMan:

$ connmanctl
connmanctl> technologies
/net/connman/technology/ethernet
  Name = Wired
  Type = ethernet
  Powered = True
  Connected = True
  Tethering = False
/net/connman/technology/wifi
  Name = WiFi
  Type = wifi
  Powered = True
  Connected = False
  Tethering = False

which is what I get when everything works (from the perfectly working system from which I'm writing now).

seth wrote:

That's not a static IP - you're still configuring via dhcp, that there's a reservation list in the dhcp server is a detail of the server only.

Oh, ok. I can't understand it well, since from my perspective the IPs I set there don't change, but you imply the definition of static is more subtle than it doesn't change, so I could give a more thorough look at it and at dhcp.

Anyway the problem seems solved. Thank you for the help big_smile

Offline

Board footer

Powered by FluxBB