╰─λ systemctl status network-restart.service
○ network-restart.service - Network Restart Service
Loaded: bad-setting (Reason: Unit network-restart.service has a bad unit file setting.)
Active: inactive (dead)
Remove the above two lines from the service file, or you can simply comment them out as below:
#Restart=always
#RestartSec=3
Save your changes and then restart.
After restarting, again run the following command and post the output:
systemctl status network-restart.service
It is often difficult to troubleshoot a service remotely as it can take a lot of time testing different variations. This service should work though, as I've written very similar working versions many times in the past.
If the above changes don't help then try the changes below.
Alter the following section:
Ammend it as follows:
[Unit]
Description=Network Restart Service
Wants=network-online.target
After=network-online.target
StopWhenUnneeded=yes
Save the changes, then restart.
If the service begins to function correctly, but you can't live with the startup delays then you can comment out or reduce the time intervals of the sleep units.
Example:
#/etc/systemd/system/network-restart.service
#sudo systemctl enable network-restart.service
#sudo systemctl start network-restart.service
#systemctl status network-restart.service
[Unit]
Description=Network Restart Service
Wants=network-online.target
After=network-online.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
#Restart=always
#RestartSec=3
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
#ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/ip link set wlp6s0 down
ExecStart=/usr/bin/modprobe -r rtl8192ee
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/modprobe rtl8192ee
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/ip link set wlp6s0 up
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/systemctl start NetworkManager
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'
[Install]
WantedBy=multi-user.target
As I've already mentioned several times, you can eliminate the sleep units entirely, but then the service may not execute correctly.
Post the results of running the status command after making changes and restarting.
Sorry, but I'm having a hard time figuring out what exactly you have done, and the results. Perhaps we have a language issue here, because I'm left confused by what you are trying to say.
Apparently the first version of my service (not a script), was inoperable from the looks of its status output (bad-setting). It appears that after modifying the original version of the service it was executing properly. However, you have not exactly provided any detailed information on what changes you made to the service. A 15 second delay before the connection is expected, as it appears that you did not reduce or eliminate the sleep units in the service. My example I posted previously showed you how to do this. Yet it appears that you did not implement my proposed reductions to the sleep times in the service.
I will post again, the example of how to reduce the connection delay after login:
#/etc/systemd/system/network-restart.service
#sudo systemctl enable network-restart.service
#sudo systemctl start network-restart.service
#systemctl status network-restart.service
[Unit]
Description=Network Restart Service
Wants=network-online.target
After=network-online.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
#Restart=always
#RestartSec=3
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
#ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/ip link set wlp6s0 down
ExecStart=/usr/bin/modprobe -r rtl8192ee
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/modprobe rtl8192ee
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/ip link set wlp6s0 up
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/systemctl start NetworkManager
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStart=/usr/bin/sleep .5
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'
[Install]
WantedBy=multi-user.target
I am not at your place looking over your shoulder while you perform modifications to the service. The only way I can know what changes you have made is from you posting any modifications you have made to the service file on the forum. I have already given you the command required to display/post the service file's content.
Type the following command to display the service's content:
cat /etc/systemd/system/network-restart.service
Then post the output of the above cat command after making any modifications to the service file. Also be sure to post the service's status after making any changes to the service, (and rebooting).
systemctl status network-restart.service
Sorry my friend, but you need put more effort into providing clear ad understandable information if you desire assistance and want your issues resolved.
At first I modified the delay times of your script to take less time, but after the network issue was still present, I decided to put it back to the original 15 seconds to see if that would change anything.
systemctl status network-restart.service
Doing the above command now shows that the script is active after removing the two lines on the script that you advised me to.
Sorry for the misunderstanding.
As for an update on the wifi connectivity issues:
Wifi connectivity still struggles when first booting up my computer, even after the initial 15 seconds and with an active script and following all of your advice.
For some reason when I put my computer to sleep and woke it back up, there was no wifi icon at all in the widgets area. There was also no wifi connection (doing ping archlinux.org did nothing). Because of this I tried restarting numerous times and even booting to Windows, but for some reason it never worked.
It only started working again after I fully shut down and powered on my computer.
I posted the above request for info 9 days ago and still you have not supplied your revised information that I requested. It is near impossible to remotely troubleshoot a service unless the one requesting the support fully complies with all requests. Please post both the cat and status outputs again.