18

After attempting setting up Raspberry Pi bluetooth to be bluetooth receiver for stereo, now whenever I start it up I can't SSH at all, I can't use the desktop at all or CTRL+ALT+Fnumber key to get to a terminal.

I tried startx=0 in config with shift key at startup, but that doesn't prevent it from freezing completely.

I see a failed message on booting so I think last tweak broke bluetooth... but how can I possibly get to a root console to fix it again? Even in Shift recovery mode, Ctrl+Alt+F1 does not let me log in as it rejects the password. This is on up-to-date Pi3.

7
  • 1
    I'm not sure if I've used recovery mode on Raspbian or not, but as a guess it only allows root logins and is rejecting the password because you have no root password set. There are two variations on this; one (the default) means you cannot log in root at all. The other is that you can log in without a password; you can make it so this way: raspberrypi.stackexchange.com/a/47129/5538
    – goldilocks
    Commented Feb 7, 2017 at 11:32
  • @goldilocks Even so how would I log in when it immediately goes to desktop?
    – NoBugs
    Commented Feb 8, 2017 at 3:03
  • @NoBugs After it boots try going to another terminal with Ctrl + Alt + F2
    – NULL
    Commented Feb 13, 2017 at 14:49
  • @NULL That's exactly what I had hoped would fix it... No response though, unless in Shift recovery mode and then it doesn't want to let me in...
    – NoBugs
    Commented Feb 14, 2017 at 2:51
  • Did you try to remove the SD and insert it to the computer to remove config file (easier to do on Linux machine that on Windows machine). Commented Feb 19, 2017 at 15:33

3 Answers 3

4

The traditional way to get into "Safe" mode, otherwise known as "single user" mode, is to add an "S" to the end of the command line.

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait S

Instead of bypassing all the system can do, this tells init the runlevel is "S", and it can then do special things to support this case. I just tested this with my semi-ancient installation of Jessie.

The boot command line can typically be found in "/boot/cmdline.txt".

1
  • 2
    This actually works, unlike the other howtos that I've seen... You should make a note that this is boot/cmdline.txt when you mount it on an Ubuntu machine (and might be possible on Windows too I don't know?)
    – NoBugs
    Commented Mar 1, 2020 at 4:57
14

This Answer is out of date (Raspbian now uses PARTUUID to identify root partition) and uses /bin/bash rather than the POSIX compliant /bin/sh

It may work to repair the partition, but changing cmdline.txt to contain root=/dev/mmcblk0p2 (without a matching change to etc/fstab) may cause subsequent boot problems.

One way to get in to a safe mode of sorts can be accomplished by booting directly in to bash.

  1. Unplug and take the card out
  2. Mount it on a computer
  3. Open the drive, edit the cmdline.txt file and append "init=/bin/bash" at the end of the existing command.

Example:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/bin/bash
  1. Unmount the card, put it back in your pi, and boot up. For me, the availability of a command line was not apparent until I pressed Enter on the keyboard.

  2. You will likely find that the card is not writable.

You can remount it as readable/writable by doing (adjust the device name if necessary):

mount -o remount,rw /dev/mmcblk0p2 /
  1. Track down that boo boo, exit the bash session, and unplug the pi
  2. Remount the card on your computer and remove " init=/bin/bash" from cmdline.txt and hopefully voila! Lather, rinse, and repeat if necessary.
7
  • 2
    I would add to this command should be "mount -o remount,rw /dev/mmcblk0p2 /" Commented Feb 8, 2018 at 1:53
  • In my case, I had to do mount -o remount,rw /dev/mmcblk0p2 / else it throws not mounted or invalid option error
    – palaniraja
    Commented Jun 22, 2018 at 8:47
  • Interesting! Not certain if something changed or what, but I've updated the post accordingly. Thanks for the heads up. Commented Nov 8, 2018 at 23:31
  • where is the cmdline.txt ? it has to be created at root ?
    – snoob dogg
    Commented Dec 18, 2018 at 21:00
  • 1
    @snoobdogg When you mount the SD card on a computer, it should be in the root directory of the browsable filesystem. It is worth noting I have only confirmed this on the Raspbian distribution. Commented Dec 19, 2018 at 22:20
4

Since you probably updated your raspian in the process, you might have been caught by this change:

As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually.

The solution to this is quite simple: Put the SD card into some other machine and place an empty file called "ssh" into the boot partition (aka the only partition you see on a windows computer).

1
  • I got caught by this so plugged it into an HDMI monitor, mouse & keyboard, and booted up then went to raspi-config to re-enable it.
    – SDsolar
    Commented Mar 20, 2018 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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