wicd restart script?

Hello, as the title suggests, I need a script to restart network if it loses connection.Whenever I lose signal or restart the router(the computer is connected wirelessly ) i have to “sudo rcnetwork restart” to enable network again.Can this be done automatically with a script or a configuration?

  • Please confirm that, the system suffering this issue does not use “systemd” to handle system initialisation.

A normal openSUSE system, which uses “systemd” to handle system initialisation, regardless of whether “Network Manager” or “Wicked” is used to configure the network interfaces, will automatically reconnect the network path if the connection drops.

  • This is a normal Linux network interface behaviour.

[HR][/HR]Please post the customisations which have been made to the network configuration files located in “/etc/sysconfig/network/”, especially in the “if-down” and “if-up” areas.

there are too many files on that folders(if-up.d, if-down.d), which ones are needed?

The only change I’ve made to network, is adding manual dns(google ones) to the resolv.conf file, because after switching from NM to wicd, I couldn’t use the browser.

If no customisations have been made then, none.

Please take a look at the openSUSE Reference Guide Chapter 13 “Basic Networking”, Section 13.4 “Configuring a Network Connection with YaST”, Sub-Section “Activating the Network Device”

I suspect that, given “Wicked”, you need the activation option “On Cable Connection”. The YaST help is a bit more informative as to the behaviour of the activation options than the content of the Reference Guide.

Basically I’m “on cable connection” and I’ve tried every other option available(and I’ve read the guide).
My computer is connected wirelessly via a usb adapter, a tp-link wn722n(Qualcomm Atheros AR9271 802.11n, Driver: “ath9k_htc”) if that matters.

Then, and especially for the case of a WiFi (WLAN) connection, I can only recommend “Network Manager” instead of “Wicked” – there’s also the advantage that, the data needed to access the WLAN (passwords and so on . . . ) will be stored on a per-user basis in a “KWallet” wallet.

Please be aware that, the default wallet “kdewallet” has to be setup before beginning to setup the “Network Manager” WLAN access point(s).

  • My recommendation for the wallet used to store the WLAN connection data (“kdewallet”) is to use “Blowfish” encryption for that wallet with an empty wallet password.

I was on NM but I had random disconnects several times. Wicked is rock solid, never loses connection, I only need to manually rcnetwotk restart in case I restart router. I think I’ll stay with wicked, but I just need it to restart automatically. I was thinking of a cron script, pinging the router, and restarting network service in case of disconnection, but I’ve never wrote a script before.

It should reconnect when your router comes back. When not, you should try to solve that instead of restarting the whole network.

And rc… isn’t the way to do it nowadays in the systemd world (though it may still work for backwards compatibility, but who knows for how long).

You could monitor wicked in a terminal window using

sudo journalctl -fu wicked

and observe the messages when disconnection takes place.

I’m wondering is USB power management is causing problems here

It is possible to write a custom udev rule to prevent a particular device from being auto-suspending (if that is the cause of the problem)…

  • You can use ‘lsusb’ to get the vendor and product IDs.

Or, a DHCP option: “/etc/sysconfig/network/dhcp” – at least the following parameters could be inspected.

  • “DHCLIENT_USE_LAST_LEASE=” – default “yes” – also “DHCLIENT6_USE_LAST_LEASE=”

Or, an issue with parameters in “/etc/sysconfig/network/ifcfg-<WLAN interface>” – man page (5) “ifcfg-wireless”.

With the system in the “Router was restarted – network connection not yet restored” state, please post the output of (user “root” CLI): “wicked ifstatus all”.

By the way, the “systemd” way of restarting the network is to issue the “root” CLI command: “systemctl restart network.service” – the “wickedd-nanny.service wickedd-dhcp4.service wickedd-dhcp6.service wicked.service” services should restart as a result – if not, append them to the “systemctl restart network.service” command.

guilty of the “old school” charge:P I stopped using linux for 5+ years, and now that I’m 100% back almost every command and trick I remember, is considered “old school”, so I have to learn some new tricks from the beginning:X

Well, strange things happen here!I had a different problem on another thread(https://forums.opensuse.org/showthread.php/526828-black-screen-after-restarting-rebooting?p=2836190#post2836190) and everything went back to normal, after rebooting from SDDM Greeter screen.Yes, wicked didn’t lose connection after I restarted the router, as it should do!
Can someone please explain, how rebooting from SDDM Greeter screen fixed two different problems?

One of the issues could have been a user’s KDE cache.

The “Wicked” issue can only be a system cache – a “normal” user, and KDE and/or SDDM have absolutely no influence on Wicked’s data or caches.
[HR][/HR]Old school?

One thing I’ve noticed over the last year or so is that, Linux has “matured” somewhat – possibly an effect of the Linux Foundation: <https://www.linuxfoundation.org/&gt;

Whether or not the “Open Group” has an influence, or not, via the UNIX® Standards is a moot point . . . <http://www.opengroup.org/&gt; <http://www.opengroup.org/unix&gt;