0

When the sudo command is typed and pressed on the terminal, it's getting hanged. Background: I tried to establish the CAN link on the Raspberry PI board. Added CAN link connection command/script upon boot-up. For that, in /etc/network/interface I added the script below:

auto can0
  iface can0 inet manual
  pre-up /sbin/ip link set can0 type can bitrate 1000000
  up /sbin/ifconfig can0 up
  down /sbin/ifconfig can0 down

After this everything is not working. When I reboot the RPi board, it takes serveral minutes to boot up and the wifi doesn't work. Terminal works but stucks after sudo command. Please help!

Note: Any command run with sudo doesn't work, for example sudo nano <file>.

Gabboxl
  • 175
  • 12
  • 1
    sudo is never just run without at least ONE argument - what exactly is the command you are running - also, can you see any errors in dmesg that may indicate why the pi is taking longer to boot? – Bravo Nov 21 '21 at 23:06
  • so, all you did was add those five lines to /etc/network/interface and this has caused network failure and breaks sudo? You did nothing else? – Bravo Nov 21 '21 at 23:44
  • yes, nothing else. Before editing interfaces file, just upgrade the installed packages (sudo apt-get update followed by upgrade). Also, after sudo command freezed every time, I tried to delete the added script from the file. Since it is root file, I couldn't delete it as root user is blocked/freezed/hanged(sudo) – Theertha B V Nov 21 '21 at 23:51
  • put the sd card in another computer, edit the cmdline.txt file, adding init=/bin/bash to the end of the single line in that file - then put it back in your pi, boot, and issue the command mount -o remount,rw / –target / - now you can edit that file that's causing the problem, remove the init=/bin/bash from cmdline.txt and reboot - at least you'll now be back to a functional pi – Bravo Nov 22 '21 at 00:55
  • DO NOT put anything into /etc/network/interface (unless you disable interface in dhcpcd) – Milliways Nov 22 '21 at 01:24
  • @Bravo Thanks it worked now by following your instruction. But, could not find the the real cause. Mean while how to automate CAN link establishment/configuration upon bootup? The google article says what I did (inclusion in the /etc/network/interface) – Theertha B V Nov 22 '21 at 04:05
  • did removing the CAN stuff from /etc/network/interface fix the sudo issue? – Bravo Nov 22 '21 at 07:38
  • yes, sudo command worked. But, unable to link/configure the CAN bus. I'm using OS 5.10.79-v7+. Upon boot up, "failed to load overlay dtoverlay=spi-bcm2835" is displayed on the edge of the screen. – Theertha B V Nov 23 '21 at 01:04
  • Any one can help on these ? any experts ? – Theertha B V Nov 25 '21 at 01:34

1 Answers1

1

Your question is confusing to me. You do not explain what you mean by the CAN link - is this a Controller Area Network? If so, why are you provisioning an IP address for it? Did you get the "script" in your question from a tutorial or manufacturer's instructions? If so, you should supply a link (edit your question).

Assuming you're following competent instructions, and you do actually need to provision an IP address for this CAN link, please read on as you have apparently made one or more of the errors below. Otherwise please edit your question to explain your use case & we'll try to help.

  1. Your question says you have edited the file /etc/network/interface, but this file does not exist in a default RPi OS image. You may have this confused with the file: /etc/network/interfaces (note the 's') which is included in default RPi OS images.

  2. The file /etc/network/interfaces contains the following line:

# Please note that this file is written to be used with dhcpcd.

Which is an awkward way of saying that you are not supposed to manually edit this file if you use the default network management tool dhcpcd. Instead, you should use /etc/dhcpcd.conf, and follow the syntax defined in man dhcpcd.conf to declare your interface.

  1. You may be using the incorrect Network Manager. If /etc/network/interfaces is to be used as you've shown in your question, you will need to disable dhcpcd, and install or use another network manager; e.g. network-manager, systemd-networkd.
Seamus
  • 21,900
  • 3
  • 33
  • 70
  • same issue observed here ...https://forum.armbian.com/topic/14909-orange-pi-mcp2515-ip-up-freezes/ – Theertha B V Dec 10 '21 at 04:02
  • @TheerthaBV: Sorry - I've tried to explain why I feel your question is confusing - that question you've referenced in your comment doesn't help at all. – Seamus Dec 10 '21 at 05:26
  • I'll come back to this ones this is got fixed .....https://raspberrypi.stackexchange.com/questions/133329/can-interface-up-on-raspberry-pi-3b-issue – Theertha B V Dec 13 '21 at 03:24