You are not logged in.

#1 2017-08-26 21:43:25

Limero
Member
Registered: 2016-01-18
Posts: 10

Reconnect internet

Hello!
I have an Arch Linux machine running 24/7 without problems, until recently, when we had a power outage. The computer is set to automatically start again when there's power, and that works. The problem is that the computer starts before the router is up, the computer tries to connect to the network once, fails and then doesn't try again. That leaves the computer running without internet until I manually restart it.

Is there any way to make the computer continue to try connecting to the router until it works? Instead of trying once and giving up.

I ran the following to enable the connection in the first place: systemctl enable dhcpcd@enp7s0.service

Offline

#2 2017-08-26 23:57:00

chr0mag
Member
From: Vancouver, Canada
Registered: 2017-02-02
Posts: 94

Re: Reconnect internet

I suggest looking into one of the systemd "wait-online" services.  Examples are: NetworkManager-wait-online.service, systemd-networkd-wait-online.service, netctl-wait-online.service, etc.  Your dhcpcd@enp7s0.service unit would then run after the wait-online target.

Offline

#3 2017-08-27 23:39:52

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Reconnect internet

I can't even figure out how to do it manually, ever since "systemd" was implemented. I tried "systemctl restart dhcpcd@enp2s0.service" but it never seems to reconnect, so I always just reboot! sad

Offline

#4 2017-08-28 01:13:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Reconnect internet

The wait-online services will not help at all.  That's for units that should wait until the network is up - having the networking service wait until the network is up is obviously nonsensical.

drcouzelis, I could only speculate that you are not initially (or only) running dhcpcd@.service, otherwise that command *would* work.

As for the OP, you should look at Restart= and RestartSec= options of the service file.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-08-29 02:37:23

chr0mag
Member
From: Vancouver, Canada
Registered: 2017-02-02
Posts: 94

Re: Reconnect internet

Trilby wrote:

The wait-online services will not help at all.  That's for units that should wait until the network is up - having the networking service wait until the network is up is obviously nonsensical.

Thanks Trilby. My bad, I didn't think the dhcpd service was a standalone networking service.

Offline

#6 2017-08-29 07:13:08

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: Reconnect internet

Edit your boot-loader to have a longer wait before continuing boot -- long enough for your router to come up before your PC.

Offline

#7 2017-09-01 21:01:08

Limero
Member
Registered: 2016-01-18
Posts: 10

Re: Reconnect internet

My solution was to disable dhcpcd@enp7s0.service, install NetworkManager and enable that instead. Now everything works as it should.

Does anyone know if this is what's used by default for other distros, like Fedora?

Offline

#8 2017-09-01 23:41:50

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Reconnect internet

Limero wrote:

Does anyone know if this is what's used by default for other distros, like Fedora?

I think so. I don't use Fedora, but I do know NetworkManager was created by Red Hat... wink

Offline

Board footer

Powered by FluxBB