Look at the update. It is important.
Please post text and not images. Just the important error message is stripped-down: dhcpcd(377): ... Exec format error ???
. With lack of further information I guess dhcpcd has problems to read its configuration file /etc/dhcpcd.conf
or maybe there is anywhere a cached malformed hostname. Please check if there are some unknown entries in dhcpcd.conf. You can look at the journal if there are some related errors shown with:
rpi ~$ journalctl --boot --unit=dhcpcd.service
You can also try to run dhcpcd
from the command line with the debug flag -d
set:
rpi ~$ sudo /usr/lib/dhcpcd5/dhcpcd -w -d
# or maybe
rpi ~$ sudo /sbin/dhcpcd -w -d
This should give you detailed output on the screen (stderr) what's going on.
Update:
As I have learned from the comment it is very likely that /sbin/dhcpcd
and /usr/sbin/sshd
are broken or have been replaced. I also see just now that the error message:
Exec format error
is given on dhcpcd AND on sshd. Following the answer from @Valentin R. is a good advice for both packages. You can also first try to reinstall them with:
rpi ~$ sudo apt --reinstall install dhcpcd5
rpi ~$ sudo apt --reinstall install openssh-server
But because dhcpcd is not working it may be a problem that your eth0 interface has no ip address and you cannot connect to the Raspbian repository for update. You can temporary configure the interface. For example I use the local network 192.168.10.0/24 with ip address 192.168.10.60 for the RasPi and default gateway 192.168.10.1. The gateway is the ip address from your internet router. You have to use the ip addresses from your network and must use one for your RasPi that isn't used by another device.
rpi ~$ sudo ip addr add 192.168.10.60 dev eth0
rpi ~$ sudo ip route add default via 192.168.10.1 dev eth0 proto static
rpi ~$ sudo bash -c "echo nameserver 8.8.8.8 >> /etc/resolv.conf"
Couldn't test it, hope it works.
If you can't get it to run you can use systemd-networkd
. It doesn't need dhcpcd. For detailed information look at (1). Here only in short. Execute these commands:
# disable classic networking
rpi ~$ sudo -Es
rpi ~# systemctl mask networking.service
rpi ~# systemctl mask dhcpcd.service
rpi ~# sudo mv /etc/network/interfaces /etc/network/interfaces~
rpi ~# sed -i '1i resolvconf=NO' /etc/resolvconf.conf
# enable systemd-networkd
rpi ~# systemctl enable systemd-networkd.service
rpi ~# systemctl enable systemd-resolved.service
rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
Create this file:
rpi ~# cat /etc/systemd/network/04-eth0.network
[Match]
Name=eth0
[Network]
DHCP=yes
Reboot.
Now you should have a network connection as before.
Reference:
[1] Howto migrate from networking to systemd-networkd with dynamic failover
hostnamectl
? ... also, your error messages include a "exec format error" ... this may indicate that, somehow, your RPi has a few x86 executables rather than ARM ... Are there any other changes, updates, modifications to the/etc/apt/sources.list
file, any PPAs added, any extra packages downloaded and installed ignoring as many errors as possible? – RubberStamp Oct 28 '18 at 12:12sshd
program matches the system configuration with these two commands: Check the libc architecture usingdpkg -l libc6
.... and then ensuresshd
is the correct one for that architecture using:ldd /usr/sbin/sshd
– RubberStamp Oct 28 '18 at 13:53file /usr/sbin/sshd
. – goldilocks Oct 28 '18 at 13:55dpkg -l libc6
->Name: libc6:armhf Architecture armhf
ldd /usr/sbin/sshd
->not a dynamic executable
@goldilocksfile /usr/sbin/sshd
:data
and/etc/apt/sources.list
has astretch-backports main
– The24thDS Oct 28 '18 at 15:26ls -l /usr/sbin/sshd
.... 2 What is the output ofstrings /usr/sbin/sshd |head -n 15
... It seems pretty clear that somehow at least some of the critical system executables have either been damaged or replaced... I would recommend getting a new SD card and reinstalling Raspbian. You should be able to retrieve any information that you may need from the current SD card once you have a working RPi... use a USB card reader to retrieve any user files. – RubberStamp Oct 28 '18 at 17:55