Is there any option to disable LAN and USB interfaces during boot. I found options to disable the interfaces using the Following command.

echo 0 | sudo tee /sys/devices/platform/soc/3f980000.usb/buspower > /dev/null

But I need it to be disabled during boot and enable manually once Pi turns ON.

  • 1
    "I need it to be disabled during boot and enable once Pi turns ON." What's the difference between "during boot" and "once Pi turns ON"? They're same. – M. Rostami Feb 3 at 15:13
  • I want to enable it manually after Pi turns ON – Prudhvi Feb 4 at 4:05

With Raspbian, network interfaces are managed with dhcpcd by default. If you want to start interfaces manually then you should first disable its service with:

rpi ~$ sudo systemctl disable dhcpcd.service
rpi ~$ sudo systemctl reboot

This ensures that the interface isn't started on boot first and then disabled by a job. You can start an interface with:

rpi ~$ sudo dhcpcd -w eth0
eth0: waiting for carrier
eth0: carrier acquired
DUID 00:01:00:01:25:1e:c1:bd:dc:a6:32:01:db:ed
eth0: IAID 32:01:db:ec
eth0: adding address fe80::77c0:a4bd:e655:5427
eth0: rebinding lease of
eth0: probing address
eth0: soliciting an IPv6 router
eth0: leased for 3600 seconds
eth0: adding route to
eth0: adding default route via
forked to background, child pid 676

For the command to manage the USB interfaces you should create a systemd Unit file:

rpi ~$ sudo systemctl --force --full edit disable-usb.service

In the empty editor insert these statements:

Description=Disable USB interfaces

ExecStart=/bin/bash -c 'echo 0 > /sys/devices/platform/soc/3f980000.usb/buspower'
ExecStop=/bin/bash -c 'echo 1 > /sys/devices/platform/soc/3f980000.usb/buspower'


Enable the new service and monitor it with:

rpi ~$ sudo systemctl enable --now disable-usb.service
rpi ~$ systemctl status disable-usb.service

The service will run on boot up and disable the USB interfaces. You can enable/disable them manually with:

rpi ~$ sudo systemctl stop disable-usb.service
rpi ~$ sudo systemctl start disable-usb.service
| improve this answer | |
  • According to your answer in need to run sudo systemctl disable dhcpcd.service and reboot the Pi. But, I don't know wham the Pi will restart. I need the interface to be disabled whenever Pi reboots. – Prudhvi Feb 5 at 12:39
  • This is exactly what sudo systemctl disable ... do. It prevent services to start on boot. You only have to do it one time. Then the service will never start automatically, no matter when the RasPi reboots. Independent from that you can always manual sudo systemctl start ... and sudo systemctl stop .... – Ingo Feb 5 at 12:51

You can simply disable an interface by running sudo ifconfig eth0 down and also enable that by sudo ifconfig eth0 up.

If you concern that it would be disabled after startup/booting up, you have to make a special service and enable startup that.
Also you can add the command to crontab by:

crontab -e

And put this line there:

@reboot ifconfig eth0 down  

More information about Run programs/commands On Your Raspberry Pi At Startup.

As the body of the question, you also need to disable USB interface like the command you have added. Just put that command to your service which you have created for eth0 or crontab.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.