1

I tried running sudo fdisk -l, but I get

sudo: unable to resolve host (none): Connection refused fdisk: cannot open /proc/partitions: No such file of directory found

I also tried running mount and I get

mount: failed to read mtab: No such file or directory

How can I fix this? The microSD works fine, I have used it on multiple devices, and tried fresh OS installs but it won't boot up. I have a RPI 3

To run those I put, init=/bin/sh in cmdline.txt

Greenonline
  • 2,969
  • 5
  • 27
  • 38
trixonet
  • 13
  • 2
  • 6

1 Answers1

2

Let's look step by step where the error could be. You are booting into a shell without any graphics. In the shell maybe you can mount the pseudo filesystems from the kernel (/proc, /dev, /sys). But it will not help you. There is nothing else. You can only edit config files.

You try to boot into the graphics system that is the systemd graphical.target. That get stuck. Next step before is the multi-user.target. That is the system without graphics as you get it with Raspbian Stretch Light. Try to boot into this. If it works we have a running system Stretch Light and we know that the problem is the graphics part. You can boot into it by appending this to cmdline.txt:

systemd.unit=multi-user.target

If it runs we know the problem is the graphic system. You can enable journaling so we may see error messages. Enable it with:

rpi: ~# sudo mkdir -p /var/log/journal
rpi: ~# sudo systemd-tmpfiles --create --prefix /var/log/journal

Now boot into the graphic system until it get stuck wait a little and poweroff. Boot into the multi-user.target and look at the boot messages from the boot before with:

rpi ~$ journalctl --boot=-1

If you cannot boot into multi-user.target then you can get the next step back with appending this to cmdline.txt:

systemd.unit=rescue.target

Here you have a basic system including system mounts. Next step back is by appending to cmdline.txt:

systemd.unit=emergency.target

Here you have a bare system nearly to boot with init=/bin/sh. This should always do if you can boot with /bin/sh.

troubleshooting:
from the infos in your comments: it is possible to boot into multi-user.target but with read only filesystem. sudo cannot resolve host because there is no network connection with name resolution and for local name resolution there is no entry 127.0.1.1 raspberrypi (resp. your hostname) in the /etc/hosts I guess. Put it into /etc/hosts if not present.

On boot you get the error:

Timed out waiting for device dev/partuuid-fb3ed1c9\x2d01.device.

This shows that the device PARTUUID=fb3ed1c9-01 cannot be found. Postfix -01 shows it is the first partition, means the boot partition. It is possible that the partuuid has changed, for example by using a partitioner on a Raspberry installation. I suggest to change the device names in cmdline.txt and in etc/fstab. Put the SD Card in the card reader of your pc, mount its partitions and in cmdline.txt change the root entry to:

root=/dev/mmcblk0p2

etc/fstab change to similar like this:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

If mmcblk0 is not the right device name for your SD Card you can boot into multi-user.target and look in /dev what it is.

Ingo
  • 42,961
  • 20
  • 87
  • 207