Dirk1312
Posts: 14
Joined: Sun Aug 28, 2016 9:24 am

Cannot connect to Pi 3 using Putty

Sun Aug 28, 2016 9:40 am

Hi all,

I bought the Raspberry Pi 3 some month ago and added a SSD device via USB, connected it to my LAN and connected via Putty. Everything worked fine. I gave it a static IP, installed owncloud and linked owncloud's data folder to the SSD, so my microSD card (32 GB) rasbpian is running on, should have space left.

The Raspberry Pi 3 was not plugged to the power socket for some days now and when I today wanted to start, I cannot connect via putty, cannot ping the static ip,... When I plugin a hdmi cable and connect it to my TV, I see the following message on/after boot:

"[ OK ] Started LSB: Switch to ondemand cpu govenor (unless shift key is pressed),
Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot into default mode.
Give your root password for maintenance (or type Control-D to continue):"

Any ideas what may cause that issue and how I can solve it? I don't have a external keyboard anymore, since I'm only using my laptop. So I'm depending on putty / ssh connection.

Thanks and kind regards,

Dirk

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Cannot connect to Pi 3 using Putty

Sun Aug 28, 2016 3:10 pm

It's booting into emergency mode, that's why Putty and ping don't work.

What I have found is that if you are mounting a USB drive using fstab it will boot fine when the drive is plugged in before booting, but if the drive is not plugged in the boot may fail when it can't find the drive, and it will go to emergency mode. That could be what's causing your problem. I use a flashdrive for backups and that's how I noticed it, I would sometimes forget to plug it in before booting. If the drive, which is mounted using fstab, was plugged in the Pi would boot fine, if the drive was not plugged in it would always boot into emergency mode.

From what I've gathered this is intentional rather than a bug. When fstab runs it has no way of knowing what is critical and what is not, so any drive being mounted by fstab that is missing will cause a boot failure rather than boot into an unstable state. You could have the OS on that USB drive.

Make sure the USB drive is plugged in, and see if it boots.

What I do to get around that, so it will boot even if the USB drive is not plugged in, is to use systemd to mount it in fstab. When fstab runs it will hand the mount off to systemd, which will create an automount unit and wait for the drive to appear, or be accessed. But the boot will continue on normally whether the drive is plugged in or not.

This is the line I use to mount the "Backup" flashdrive. Using this it will boot normally whether it finds the drive when fstab runs or not.

Code: Select all

LABEL=Backup /mnt/Backup ext4 defaults,noauto,x-systemd.automount 0 0

Dirk1312
Posts: 14
Joined: Sun Aug 28, 2016 9:24 am

Re: Cannot connect to Pi 3 using Putty

Mon Aug 29, 2016 2:02 pm

Hi JimmyN,

thanks a lot for your detailed description. It seems, this is / was the problem, even if the drive was plugged-in, but probably it was too late recognized by the Raspberry Pi?!

I know connected an old wireless usb keyboard to my pi, started it plugged-in in television as monitor and logged-in as root. I then ran

Code: Select all

nano /etc/fstab
and commented the line that mounts the /dev/sda drive. Then I rebooted the Rasberry Pi and it started in its x window.

Jimmy, thanks for your description how you boot drives. Is there a more detailed description how to do it your way? My drive is always plugged-in but not recognized as seen. I have some basic knowledge, but with your way how you solved it I cannot realize it on my own. A link to a description would be great or some keywords I can google for.

Thanks and kind regards,

Dirk

RAZERZ
Posts: 57
Joined: Mon Jun 13, 2016 4:56 pm

Re: Cannot connect to Pi 3 using Putty

Mon Aug 29, 2016 6:36 pm

Hi, may I just suggest "df -h"? Your SSD should show up there.
Raspberry pi 3 set up as desktop with raspbian.
I guess you can say I am not newbie with linux but I am not a master at it either.
I will always try to help you as much as I can because I know how hard it is to run into problems :D

Dirk1312
Posts: 14
Joined: Sun Aug 28, 2016 9:24 am

Re: Cannot connect to Pi 3 using Putty

Mon Aug 29, 2016 8:01 pm

Hi Razerz,

df -h shows me my ssd with the following infos:

/dev/sda 230G 632M 217G 1% /media/pi/untitled

But what exactly do you now want me to do with data? Ok, I can always navigate via /media/pi/untitled/... to my directories. But is it always mounted that way? And can I use that path (I should give a name to the drive, so "untitled" should be renamed to the given name?!) to set symlinks for owncloud,..?

Thanks and kind regards,

Dirk

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Cannot connect to Pi 3 using Putty

Mon Aug 29, 2016 10:47 pm

The way to make sure it's always mounted to the same place, so it has the same directory name, is to create the mount point directory and then use fstab to mount it to that directory.

To make sure the same flashdrive gets mounted to the same point then it's better to use labels, or UUID to specify the drive in fstab. Otherwise sda1 could become sdb1 if you already have a flashdrive inserted, and the wrong one could be mounted to your mount directory.

It's not actually "my" way, it's just one of many ways it can be done. But to help you get started I'll go through the steps I probably took to set up the "Backup" example I used above.

First create a mount directory, I chose to put it in /mnt/ and call it "Backup".

Code: Select all

sudo mkdir /mnt/Backup
Once you do that the directory will always be there, and have the same name unless you rename or delete it.

Then I probably used "gparted" to label the drive and name it "Backup"

Then I would have added it to fstab using this line

Code: Select all

LABEL=Backup /mnt/Backup ext4 defaults,noauto,x-systemd.automount 0 0
Using x-systemd.automount also takes care of USB and network drives that are sometimes late to arrive at the party, they'll still get mounted even if the drive wasn't ready/available when the system was booting and fstab was run.

That flashdrive was formatted ext4, if the drive being mounted is FAT, NTFS, or cifs mount then you'll need to add some ownership credentials in fstab when it's mounted, otherwise the flashdrive will belong to root.

Return to “Troubleshooting”