Wait for Internet connection on boot

I have the problem that my applications start before the internet connection is up, they fail and i have to manually restart them.

is there a way to wait for internet connection is up before starting KDE for example? or even better continue boot after network manager has a connection?

What sort of connection do you use? I use a wifi connection and it always connects as soon as I’m logged into KDE.

ethernet, my internet connection is uo shortly after applications has started, firefox and other apps are a bit faster up then the internet connection (about1-2 seconds)

I haven’t seen that happening before. On Arch (and EnOS) and most all Linux system I ever used, the service for Network-Manager is started on boot, way before the user-login. - What is the system you are using?

1 Like

I’m using enos, on other distros including Manjaro I don’t had this issue

What does the shell command systemd-analyze critical-chain show?

systemctl status NetworkManager-wait-online


1 Like

Yep, I was just getting there :laughing:


Which application(s) is that? Please give more details.

@mbod Wer lesen kann… :wink:

But that can not be it. You do not have to restart firefox if the internet is not up. firefox seamlessly picks up the internet when it is up.

True. But what does it help to know “other applications” if the network isn’t online after session start?

It could help to understand the full problem. The problem discription so far is blurry. My laptop for example starts anywhere without internet. And I do not have to restart any application when internet becomes available later. Even when I suspend the laptop while wifi is active and later resume without Internet - or vice versa - I do not have to restart anything.

1 Like

Output of systemd-analyze critical-chain

graphical.target @3.856s
└─sddm.service @3.856s
  └─systemd-user-sessions.service @3.800s +54ms
    └─network.target @3.799s
      └─NetworkManager.service @3.781s +17ms
        └─network-pre.target @3.749s
          └─firewalld.service @3.494s +254ms
            └─polkit.service @3.496s +8ms
              └─basic.target @3.374s
                └─sockets.target @3.373s
                  └─dbus.socket @3.373s
                    └─sysinit.target @3.368s
                      └─systemd-update-done.service @3.344s +23ms
                        └─ldconfig.service @1.588s +1.736s
                          └─local-fs.target @1.587s
                            └─run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount @1.823s
                              └─local-fs-pre.target @945ms
                                └─systemd-tmpfiles-setup-dev.service @905ms +39ms
                                  └─systemd-sysusers.service @788ms +96ms
                                    └─systemd-remount-fs.service @515ms +226ms
                                      └─systemd-fsck-root.service @584542y 2w 2d 20h 1min 47.839s +5ms

systemctl status NetworkManager-wait-online

â—‹ NetworkManager-wait-online.service - Network Manager Wait Online
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; enabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:nm-online(1)

Firefox has no problems thats true, i just have to click reload on the pages that loads on startup.

Schildichat (Matrix Client) is a application that does not recover that, i have to manually stop the application and start is again

network mounts are not coming up (could add a sleep there as aworkaround but i dont like workaraounds)

I am still trying to understand the situation.

When you boot your PC A and you do not login but let it sit idle, does the network come up and you can ping the PC A from another PC B?

Can you remote login to PC A? Can you share the journal after a fresh reboot, without local user login? E.g. Get the journal via a remote login. There should be some signs of a network delay / timeout in the journal.

I use auto login.

I see on the little icon that the internet connection comes up after first application starts

Can you please disable autologin and see if the network comes up without local user login.

The network is starting as a system service, in parallel to other systems.
With auto-login, the problem of a slow initial connectivity becomes more obvious, if you have also session/user autostart programs that require a network connection.
If you don’t want to restart those applications, you can replace the XDG autostart method with a systemd --user service unit, adding network to the requirements.
If this sounds difficult, you may want to check for a solution in the relevant program’s configuration, or you may not autostart it.