Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-13-2017, 05:36 PM
|
#1
|
Member
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 939
Rep:
|
systemd - how to properly stop dhcpcd.service?
I have stopped and disabled dhcpcd.service
Code:
systemctl stop dhcpcd.service
systemctl disable dhcpcd.service
But then dhcpcd.service went into FAILURE state. Why and how properly shutdown dhcpcd in systemd?
Code:
root@raspberrypi:/home/pi# systemctl status dhcpcd.service
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled)
Active: failed (Result: exit-code) since Sat 2017-05-13 20:44:51 UTC; 23min ago
Main PID: 1689 (code=exited, status=1/FAILURE)
May 13 20:44:50 raspberrypi systemd[1]: Stopping dhcpcd on all interfaces...
May 13 20:44:50 raspberrypi dhcpcd[1835]: dhcpcd[1835]: sending signal TERM to pid 1689
May 13 20:44:50 raspberrypi dhcpcd[1835]: sending signal TERM to pid 1689
May 13 20:44:50 raspberrypi systemd[1]: dhcpcd.service: main process exited, code=exited, status=1/FAILURE
May 13 20:44:50 raspberrypi dhcpcd[1835]: dhcpcd[1835]: waiting for pid 1689 to exit
May 13 20:44:50 raspberrypi dhcpcd[1835]: waiting for pid 1689 to exit
May 13 20:44:51 raspberrypi systemd[1]: Stopped dhcpcd on all interfaces.
May 13 20:44:51 raspberrypi systemd[1]: Unit dhcpcd.service entered failed state.
May 13 20:51:38 raspberrypi systemd[1]: Stopped dhcpcd on all interfaces.
May 13 20:55:18 raspberrypi systemd[1]: Stopped dhcpcd on all interfaces.
|
|
|
05-13-2017, 09:39 PM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,727
|
I barely know SystemD, but this video could help: https://www.youtube.com/watch?v=IuDmg75n6FU
I watched it yesterday in my attempt to learn more about SystemD.
|
|
|
05-13-2017, 10:21 PM
|
#3
|
Member
Registered: Jul 2013
Posts: 749
Rep:
|
The commands used should be correct. You should probably track down the error, it sounds like the service may have a problem. Maybe you can start it from the command line and see if any helpful info shows up.
|
|
|
05-13-2017, 11:04 PM
|
#4
|
Member
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997
|
I wonder IF similar to this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1356561
Can you provide version details (&distro), like in that bug? (&service config file maybe)
Note the two different pids. Any ideas from a systemd guru? ( ?e.g.)
Last edited by !!!; 05-13-2017 at 11:16 PM.
|
|
|
05-14-2017, 04:12 AM
|
#5
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
it went to failed state already 23 minutes before you looked at the status.
maybe it's unrelated?
i'd be more worried that it stays off, i.e. other services can't restart it. maybe you have to mask it.
|
|
|
05-14-2017, 05:48 PM
|
#6
|
Member
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 939
Original Poster
Rep:
|
Hi, thank you all fro replies.
@!!! - here are details I have collected form my system.
Code:
root@raspberrypi:/home/pi# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@raspberrypi:/home/pi# uname -a
Linux raspberrypi 3.16.0-4-586 #1 Debian 3.16.36-1+deb8u2 (2016-10-19) i686 GNU/Linux
root@raspberrypi:/home/pi# systemd --version
systemd 215
+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR
root@raspberrypi:/home/pi# dhcpcd --version
dhcpcd 6.7.1
Copyright (c) 2006-2015 Roy Marples
Last edited by czezz; 05-14-2017 at 05:55 PM.
|
|
|
05-15-2017, 06:31 AM
|
#7
|
Member
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 939
Original Poster
Rep:
|
Hi, I have also checked on the latest release of 2017-04-10-raspbian-jessie-lite.img
At this stage dhcpcd is running:
Code:
root@raspberrypi:/home/pi# netstat -anop | grep -v unix
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Timer
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 440/sshd off (0.00/0/0)
tcp 0 0 164.48.95.90:22 164.48.95.89:54892 ESTABLISHED 2280/sshd: pi [priv keepalive (5496.12/0/0)
tcp 0 0 164.48.95.90:22 164.48.95.89:54888 ESTABLISHED 1300/sshd: pi [priv keepalive (5025.08/0/0)
udp 0 0 0.0.0.0:68 0.0.0.0:* 2547/dhcpcd off (0.00/0/0)
udp 0 0 0.0.0.0:46201 0.0.0.0:* 319/avahi-daemon: r off (0.00/0/0)
udp 0 0 169.254.41.133:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 164.48.95.90:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 127.0.0.1:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 0.0.0.0:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 0.0.0.0:5353 0.0.0.0:* 319/avahi-daemon: r off (0.00/0/0)
Next, I stop dhcpcd via systemctl
Code:
root@raspberrypi:/home/pi# systemctl stop dhcpcd.service
I can see that dhcpcd is gone.
Code:
root@raspberrypi:/home/pi# netstat -anop | grep -v unix
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Timer
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 440/sshd off (0.00/0/0)
tcp 0 0 164.48.95.90:22 164.48.95.89:54892 ESTABLISHED 2280/sshd: pi [priv keepalive (5477.34/0/0)
tcp 0 0 164.48.95.90:22 164.48.95.89:54888 ESTABLISHED 1300/sshd: pi [priv keepalive (5006.30/0/0)
udp 0 0 0.0.0.0:46201 0.0.0.0:* 319/avahi-daemon: r off (0.00/0/0)
udp 0 0 169.254.41.133:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 164.48.95.90:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 127.0.0.1:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 0.0.0.0:123 0.0.0.0:* 462/ntpd off (0.00/0/0)
udp 0 0 0.0.0.0:5353 0.0.0.0:* 319/avahi-daemon: r off (0.00/0/0)
The good thing is that daemon/process is gone.
However, it looks like systemd is not satisfied as it shows status: failed
Code:
root@raspberrypi:/home/pi# systemctl status dhcpcd.service
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled)
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: failed (Result: exit-code) since Sun 2017-05-14 23:01:41 UTC; 17s ago
Process: 2553 ExecStop=/sbin/dhcpcd -x (code=exited, status=0/SUCCESS)
Process: 2543 ExecStart=/sbin/dhcpcd -q -w (code=exited, status=0/SUCCESS)
Main PID: 2547 (code=exited, status=1/FAILURE)
May 14 22:47:44 raspberrypi dhcpcd[2543]: forked to background, child pid 2547
May 14 22:47:44 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
May 14 23:01:41 raspberrypi systemd[1]: Stopping dhcpcd on all interfaces...
May 14 23:01:41 raspberrypi dhcpcd[2553]: dhcpcd[2553]: sending signal TERM to pid 2547
May 14 23:01:41 raspberrypi dhcpcd[2553]: sending signal TERM to pid 2547
May 14 23:01:41 raspberrypi dhcpcd[2553]: waiting for pid 2547 to exit
May 14 23:01:41 raspberrypi dhcpcd[2547]: received signal TERM from PID 2553, stopping
May 14 23:01:41 raspberrypi dhcpcd[2547]: eth0: removing interface
May 14 23:01:41 raspberrypi dhcpcd[2553]: dhcpcd[2553]: waiting for pid 2547 to exit
May 14 23:01:41 raspberrypi dhcpcd[2547]: exited
May 14 23:01:41 raspberrypi systemd[1]: dhcpcd.service: main process exited, code=exited, status=1/FAILURE
May 14 23:01:41 raspberrypi systemd[1]: Stopped dhcpcd on all interfaces.
May 14 23:01:41 raspberrypi systemd[1]: Unit dhcpcd.service entered failed state.
So I decided to go one step forward and disable it:
Code:
root@raspberrypi:/home/pi# systemctl disable dhcpcd.service
Synchronizing state for dhcpcd.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d dhcpcd defaults
Executing /usr/sbin/update-rc.d dhcpcd disable
insserv: warning: current start runlevel(s) (empty) of script `dhcpcd' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `dhcpcd' overrides LSB defaults (0 1 6).
By looking at the status, I can see service is not only failed but also still enabled
Code:
root@raspberrypi:/home/pi# systemctl status dhcpcd.service
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled)
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: failed (Result: exit-code) since Sun 2017-05-14 23:01:41 UTC; 1min 8s ago
Main PID: 2547 (code=exited, status=1/FAILURE)
May 14 22:47:44 raspberrypi dhcpcd[2543]: forked to background, child pid 2547
May 14 22:47:44 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
May 14 23:01:41 raspberrypi systemd[1]: Stopping dhcpcd on all interfaces...
May 14 23:01:41 raspberrypi dhcpcd[2553]: dhcpcd[2553]: sending signal TERM to pid 2547
May 14 23:01:41 raspberrypi dhcpcd[2553]: sending signal TERM to pid 2547
May 14 23:01:41 raspberrypi dhcpcd[2553]: waiting for pid 2547 to exit
May 14 23:01:41 raspberrypi dhcpcd[2547]: received signal TERM from PID 2553, stopping
May 14 23:01:41 raspberrypi dhcpcd[2547]: eth0: removing interface
May 14 23:01:41 raspberrypi dhcpcd[2553]: dhcpcd[2553]: waiting for pid 2547 to exit
May 14 23:01:41 raspberrypi dhcpcd[2547]: exited
May 14 23:01:41 raspberrypi systemd[1]: dhcpcd.service: main process exited, code=exited, status=1/FAILURE
May 14 23:01:41 raspberrypi systemd[1]: Stopped dhcpcd on all interfaces.
May 14 23:01:41 raspberrypi systemd[1]: Unit dhcpcd.service entered failed state.
Now, the question is:
in systemd - is normal that once service is set to disable, it still shows its enable and failed?
That makes no sense but maybe there is some hidden logic behind it?
And by looking at other example, eg. sudo.service which is disabled by default, it seems that dhcpcd.service is not completely disabled or at least not in a clear state:
Code:
root@raspberrypi:/home/pi# systemctl status sudo.service
● sudo.service - Provide limited super user privileges to specific users
Loaded: loaded (/lib/systemd/system/sudo.service; disabled)
Active: inactive (dead)
Last edited by czezz; 05-15-2017 at 06:40 AM.
|
|
|
05-15-2017, 02:32 PM
|
#8
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
Quote:
Originally Posted by Doug G
You should probably track down the error, it sounds like the service may have a problem. Maybe you can start it from the command line and see if any helpful info shows up.
|
Quote:
Originally Posted by ondoho
i'd be more worried that it stays off, i.e. other services can't restart it. maybe you have to mask it.
|
some good advice there.
|
|
|
05-15-2017, 02:55 PM
|
#9
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
Under debian I tend to use the service method. About the only thing I used systemctl for aside from multi-user.target, is ModemManager, which lacks any entries under service, and seems to exist/run for no apparently good reason.
# service --status-all
# service dhcpcd stop
Although I think it has it's own method to stop it.
# dhcpcd -x
Not sure if that's the right option, I tend towards the dhclient from the isc option(not available under arch). The dhcpcd thing is like a not so attractive overly assertive girlfriend. Honey, not right now.
|
|
|
05-15-2017, 03:35 PM
|
#10
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
oh i keep forgetting that debian jessie is running a hybrid systemd/sysvinit system; so if the dhcpcd systemd service just passes the requests on to a sysvinit script, the failure message could be a carry-over from there.
|
|
|
05-15-2017, 03:46 PM
|
#11
|
Member
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 939
Original Poster
Rep:
|
Thanks for replies.
I just left it in a failed state. Process seems to be killed, which means dhcpcd is gone (although systemd shows it as "enable").
Im not really sure where to look for systemd logs. Not much hints in syslog and messages.
Last edited by czezz; 05-15-2017 at 03:59 PM.
|
|
|
05-15-2017, 05:03 PM
|
#12
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
# journalctl -a
The systemd version of logs, all logs, or whatever applies. In debian jessie the /var/log/syslog and other individual ones still exist and in human readable form, not binary whatevers.
|
|
|
05-16-2017, 05:40 PM
|
#13
|
Member
Registered: Jul 2013
Posts: 749
Rep:
|
In Fedora, you'd use something like
Quote:
journalctl -u dhcpcd.service
|
to find log entries relating to your specific service.
|
|
|
All times are GMT -5. The time now is 10:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|