2

I've got a Raspberry Pi. And lately I have the problem that I need to press enter when it's starting up.

The error is:

Cannot open access to console, the root account is locked.
See sulogin(8) man page for more details.
Press enter to continue.

How can I view that man page? Or does anyone know a solution?

I found this question here, but that does not have an answer also.

MatsK
  • 2,791
  • 3
  • 16
  • 20
Refilon
  • 121
  • 1
  • 1
  • 3
  • Do you have a spare SD card? You could try setting up the same config to see if there's any issue. It could be worth doing a process of elimination to determine what's causing the issue. – BantuTech Feb 13 '18 at 12:27
  • How can I view that man page? Open a command line and type man sulogin or man 8 sulogin. Easier still, google for man sulogin , most of the man pages have been put on the web. Be warned they do change from time to time, so the command line is the better option. – Philip Couling Feb 13 '18 at 13:25
  • I doubt that will be useful though. Do you have any more context on the message? Which service was trying to start when it hit the error. Ie: what were the few lines before the message? – Philip Couling Feb 13 '18 at 13:27
  • @couling the message before this is: > Reached target Network – Refilon Feb 13 '18 at 15:27

7 Answers7

5

I have limited skills in linux, but I found the following link very useful: Strange problem on startup - cannot open access to console.

In particular I took this sentence:

"The reason for this problem appearing seemingly out of the blue is fsck - the automated file system check, which runs on startup. During this check fsck may discover that something is wrong with some of your filesystems and interactive input is needed to confirm fixes. At this point it apparently attempts to launch the root shell via sulogin in order to ask for this input, sulogin then discovers that the root account has no password login privileges (i.e., its line in /etc/shadow has a * in the second field), and suggests to press "Enter" to continue."

Base on the explanation above (and taking a look at another cmdline.txt file from a different Rasberry that was working fine), before trying another thing, I added to the cmdline.txt file the following: fsck.repair=yes. Now my cmdline.txt looks similar to:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles

That worked fine for me, but I recommend to make sure that doing that is not going to corrupt the system.

user85839
  • 51
  • 1
  • 3
1

There are many reasons for the issue. I solved my problem, which is equivalent but maybe not the same with:

Edit the cmdline.txt and make sure you have: fsck.mode=force fsck.repair=yes

This from: Raspberry Pi 3 and Raspbian Jessie - How to run fsck at boot?

(you need a full setup with monitor and keyboard on the pi)

If it works, fine. In my case I did something before. One ref is here: https://www.raspberrypi.org/forums/viewtopic.php?t=155233

Add this at the end of the line in cmdline.txt

init=/bin/sh

Then reboot. You will get into a shell that allows you some editing. You need to start with:

mount -o remount,rw /dev/mmcblk0p2 /
mount /dev/mmcblk0p1 /boot

Then you can inspect the /etc/fstab

Hardcode /dev/mmcblkopX for example in fstab, if this is the issue and also hardcode it in the root=XXX in the cmdline.txt file.

In this shell you will not be able to run systemctl commands, but you can inspect some logs in /var/logs/.

I hope this helps.

mariotti
  • 121
  • 3
  • That seems related to the filesystem, not to the root account. – RalfFriedl Jul 17 '19 at 05:22
  • @RalfFriedl the root account is the last resort. If no disk is available but the system did boot indeed, you probably end up on a root shell. As I mentioned, there are really many reasons for ending up on a root shell. What I propose here is just one of the many possible solutions. But this one might also help to find the actual issue. – mariotti Aug 07 '19 at 22:00
  • At least it helped me, thanks. I restored an image that was dd'd at a time when an external ssd was mounted in /etc/fstab. I got the OP's error and couldn't edit fstab but your answer helped me. You should insist on the "you need to start with"... otherwise, fstab is read-only. – Myoch Oct 24 '23 at 11:28
0

Last weekend I took a project to build myself a nice Pi powered NAS. Everything worked perfectly, but as I saved my changes to /etc/fstab and rebooted all hell broke loose. The Pi would simply not boot up. I run almost all my Pis in a headless enviroment so I had to get hold of our TV and a keybaord to see what was going on.

Lo and behold, there it was, The Pi would get stuck at boot with the following error message

"Cannot open access to console, the root account is locked." The error message while not too descriptive, it asked me use sulogin and run journalctl -xb however there was no shell to run or list anything.

After some frantic net searches and a lot of trial and erros, I found the following workaround that worked. Note: You will need access to a display,keyboard and a laptop/desktop to do the following steps

Retrive your SD card from the Pi and sing a adapter mount the card to your PC,Mac or Linux. You should be able to see the /boot partition of your SD card. Locate the file cmdline.txt and add the following at the end of the line init=/bin/sh Note: Do not create a new line, just add the above to end of the current line. Load the SD card back to your pi and boot up. You should now get the a root shell prompt. From here you can undo the changes to /etc/fstab or whatever else that initially broke your system In some cases you will not be able save your changes and the system will complain of a read only file system. If you get that move to the next sections

A raspberry pi SD card will has two main partitions, since we cannot read the partition table directly you must manually locate the device for your root and boot partitions. You can do this by going to the /dev directory and you should see something similar to mmcblk0p1 & mmcblk0p2. The second device mmcblk0p2 will be your root partition. You need to remount this with read write permissions

mount -o remount,rw /dev/mmcblk0p2 / Once this is remounted, go ahead and edit your /etc/fstab and save it.

Before you exit, make sure you revert the change to the cmdline.txt in the /boot partition. You may need to mount that in read write mode as well before you can change it.

mount -o remount,rw /dev/mmcblk0p1 /boot Alternatively you can revert back the change to cmdline.txt on your laptop or desktop.

If everything goes well, you should be able to boot back your Pi in a normal way.

0

There's insufficient information here to say what's broken. Something is broken during boot and it's trying to drop into an emergency console to let you fix it.

... then the emergency console is broken because the root account is locked. The messages you have included in your question are due to the to this, not the root cause which tries to drop you into the emergency console in the first place. See here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806852

So to fix this the best thing you can do is try to figure out what's breaking. It may help if you first unlock the root account and set a password on it.

Also check the lines in the console before your error, to see if there are any other errors reported.

Philip Couling
  • 508
  • 2
  • 5
  • 16
0

OK I already faced this issue .. your SD card is broken, you should have a lot of injures message in dmesg related to memory disk problems .. just format another fresh one an retry.

  • 2
    I don't think this is correct. I can just continue when I press enter, and all works perfectly. So it is not broken :) – Refilon Feb 14 '18 at 13:47
0

I had the same problem and managed to fix it by "verifying" both boot and system partition with gparted on Linux.

Steps are:

  1. Open gparted, right click -> "unmount" partition for both partitions on SD card.
  2. Right click on partition -> "verify" also for both partitions
  3. Apply and that's it. You should be ready to go
Greenonline
  • 2,740
  • 4
  • 23
  • 36
Alex
  • 31
  • 2
0

Sudo nano /boot/cmdline.txt the file contains one line parameters separated by a space.

Either set parameter fsck.repair=no from fsck.repair=yes or add/insert on same line fsck.repair=no if fsck.repair parameter not in the file.

The prompt to press " enter to continue" will disappear at next boot.