4

I'm trying to connect via Wi-Fi and to do so I have to disable dhcpcd but I couldn't. I tried:

sudo update-rc.d -f dhcpcd disable

But it didn't work I also tried to remove it using:

sudo update-rc.d -f dhcpcd remove

It still didn't work, any idea how to do so?

Darth Vader
  • 4,206
  • 24
  • 45
  • 69
B.andalous
  • 43
  • 1
  • 1
  • 4

2 Answers2

8

sudo systemctl stop dhcpcd.service will stop (deactivate) dhcpcd
sudo systemctl disable dhcpcd.service will prevent it from restarting.

Having said the above, I think this is a bad idea. There are a few different network managers in use on Pi under Linux. dhcpcd performs well, and has been chosen by the Foundation for good reasons.

On another point, you should get used to systemd. It is now used by most GNU/Linux distributions. sysV is still partially used, but on the way out.

Milliways
  • 59,890
  • 31
  • 101
  • 209
1

This Answer is technically incorrect.
You should follow How to set up networking/WiFi
or if you really want Static IP How to set up Static IP Address

This is not a direct answer but going to be useful to anyone trying to set up their raspberry pi to use static IP, because /etc/dhcpcd.conf will in fact change the IP of raspberry PI, even if you set a static profile, if another device is using that IP on the network. This can be a big security issue for some projects.

In addition to disabling dhcpcd using systemctl, you can set a static IP by editing /etc/network/interfaces

The latest Raspbian distributions ship with this file empty, but I tested that after disabling dhcpcd, you can set the static IP you want to use by adding this to the end of /etc/network/interfaces file

auto eth0
iface eth0 inet static
address 192.168.1.51
netmask 255.255.255.0
gateway 192.168.1.1
broadcast 192.168.1.255
Milliways
  • 59,890
  • 31
  • 101
  • 209
Mich
  • 131
  • 3