rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

SSH error during Headless Install

Sun Dec 11, 2016 5:15 pm

Hi

I have recently purchased a Raspberry Pi 3 (without a preloaded sd card) and wanted to do a "headless install" but I am encountering a problem.

I dont have a keyboard or mouse so i want to undertake the install with my windows 10 laptop only ( i am logged in as admin). The RPi is powered up correctly, the LAN status LEDs are flashing.

Existing Set up

1.I have downloaded and correctly installed Raspbian Jessie Lite image file on to a 32GB sd card. https://www.raspberrypi.org/downloads/raspbian/

2.In addition i have also added the SSH text file (without the .txt extension) in the root folder of the sd card to enable SSH.

3.The RPi is connected via an Ethernet cable to a spare port on my wifi router.

4.I used Advacned IP scanner 2.4 to get the IP address of the RPi (its a number like 192.168.X.XXX). The IP address does not change even when i power down and restart the RPi.
I checked using the cmd console by using ping function to to see if the above IP address was working and it shows the following

Ping statistics for 192.168.X.XXX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 3ms, Average = 2ms

So that all seems ok.

5.Trying to use Putty to SSH into the RPi but i get the following error - "network error:connection refused"

Looking at the Putty help docs for this error message it says the following
"This error means that the network connection PuTTY tried to make to your server was rejected by the server. Usually this happens because the server does not provide the service which PuTTY is trying to access.
Check that you are connecting with the correct protocol (SSH, Telnet or Rlogin), and check that the port number is correct. If that fails, consult the administrator of your server."

The SSH file in the root folder must mean that the RPi can provide SSH service which Putty is trying to access.

The port number is by default set at 22, which is the default port for SSH. I checked and it looks like port 22 is closed. as per this website - http://www.yougetsignal.com/tools/open-ports/ - although this says all ports are closed?

6. I am using McAfee anti virus and firewall software. I did disable the firewall for a short while to see if that sorts the problem but no luck.

I now think its a SSH issue and that Port 22 may need to be enabled to allow me to connect to the RPi but cannot find a way to do it. Any ideas?

I am not a software engineer or know anything about computer networks. I got to this stage of the install via youtube videos and the forums but now i cant get any further. Any help would be much appreciated.

Regards

Roger.

PS I think I may have to resort to a normal install and get a keyboard,mouse & screen but i am desperately trying to avoid doing that hence trying all of the above.

Update

I also connected the RPi directly to the laptop via its Ethernet port and tried to connect via SSH to the new IP address but again it came back with the same error message
as before "network error:connection refused". This time the Ip address was different 192.168.XXX.X to one i got earlier, which seems reasonable as its not connected to the router.

I then connected my Raspberry to my TV Screen via HDMI and whilst the Ethernet port on the RPi was still connected to my Laptop Ethernet port.

On start up the raspberry boots up with various files being loaded and i get to the raspberrypi loginscreen.

In addition i can see the following line in the start up screen "MY IP address is 169.254.133.122". I tired this address in Putty and got the same error message as before.
Last edited by rborde10 on Sun Dec 11, 2016 6:18 pm, edited 2 times in total.

MrEngman
Posts: 4021
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: SSH error during Headless Install

Sun Dec 11, 2016 5:52 pm

File SSH probably won't enable SSH You need the file ssh, lower case letters.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.


rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Sun Dec 11, 2016 6:26 pm

Hi MrEngman

I just checked the SD card and the file name is in all in small caps.

Any thing else i could check?

thegnnu
Posts: 157
Joined: Thu Oct 18, 2012 7:07 pm
Location: Bristol

Re: SSH error during Headless Install

Sun Dec 11, 2016 6:42 pm

Vital piece of info missing what user name and password did you use with PUTTY
TerryR

rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Sun Dec 11, 2016 6:48 pm

thegnnu wrote:egnnu
I can't even get to that stage because i cant use putty to bring up the log in screen.

The only way i can get the log in screen to display anything is to hook it up to my television but then without a keyboard to input any data i cant log in. :oops:

thegnnu
Posts: 157
Joined: Thu Oct 18, 2012 7:07 pm
Location: Bristol

Re: SSH error during Headless Install

Sun Dec 11, 2016 7:09 pm

Putty does not use that login screen run Putty and input your ip address for the Pi . You can confirm the IP in your routers pages.
So input the IP something like 192.168.0.10 port is 22 and select the SSH button. Click open button and you should then be asked for user name so "pi" then password "raspberry" and this should give you access to your Raspberry Pi.
I run all my Pi headerless I use WinSCP and it also uses Putty it will
give you a explorer type screen from win10 onto the Pi and the Putty command screen.
TerryR

rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Sun Dec 11, 2016 8:36 pm

thegnnu wrote:Putty does not use that login screen run Putty and input your ip address for the Pi . You can confirm the IP in your routers pages.
So input the IP something like 192.168.0.10 port is 22 and select the SSH button. Click open button and you should then be asked for user name so "pi" then password "raspberry" and this should give you access to your Raspberry Pi.
I run all my Pi headerless I use WinSCP and it also uses Putty it will
give you a explorer type screen from win10 onto the Pi and the Putty command screen.
TerryR
Hi Terry

I am having problems accessing the RPi via Putty. I have the IP address and the port is set to 22, ssh is selected.

But when i hit ok on the Putty programme "network error:connection refused"

I dont know if i need to enable SSH or open port 22 to receive data?

Roger.

User avatar
HawaiianPi
Posts: 5692
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH error during Headless Install

Sun Dec 11, 2016 10:23 pm

rborde10 wrote:Hi MrEngman

I just checked the SD card and the file name is in all in small caps.

Any thing else i could check?
Something is wrong here. That file gets deleted after the system boots and enables SSH, so if you can still see it on a card you have supposedly booted, then the boot process never completed. Something is wrong with the SD card, the Raspbian image, or the process you used to write the card.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Sun Dec 11, 2016 10:38 pm

Hi HawaiianPi

Thanks and yes the ssh has not deleted despite me un-plugging the raspberry several times

I did connect the RPi to a TV with a HDMI powered it up and got to the log in screen but as i don't have a keyboard i cannot log in.

I think i might try a fresh install of Raspbian image on the sd card and see if that helps failing that i might just invest in a cheap keyboard and mouse to get into the RPi.

This is so painfull :( but i am learning a lot about networks so its not too bad.

Thanks

Roger
.

Mr Toad
Posts: 3
Joined: Fri Mar 11, 2016 2:16 pm

Re: SSH error during Headless Install

Mon Dec 12, 2016 1:55 pm

Hi Roger,

the problem you are having is down to the fact that as of the November release of the OS ssh is disabled by default.

https://www.raspberrypi.org/documentati ... ccess/ssh/

You have two options.

Buy a cheap keyboard and set the Pi up that way.

Depending on your Linux/computer skills you can do what they say at the bottom of the page in what looks like a throw away comment and enable ssh.

If you're using a Linux machine to set the Pi up then this should help. If your main machine is a Windows OS machine then I'm not sure.

I did this on a Mac, which is basically a Linux OS in a party frock :lol:

Using an SD card adapter plug the MicroSD card containing the bootable Pi OS into your PC
on the Mac it shows up in finder as a removable drive called boot.

Open a terminal window.

On the Mac the disk is mounted in Volumes so the command is

cd /Volumes

typing ls -l shows all the disks I have mounted including boot

cd boot

My path is now /Volumes/boot and using the ls command I can see the files in the there. This is not the RasPi file system, this is the boot partition so you can't get at the config files from here.

However, all you have to do is create a blank file called ssh with no extension and no content.

nano ssh

Once nano or the editor you use opens save the file and exit, in nano this is Ctrl O to save then Ctrl X to exit.

Eject the SD card and put it in the Pi and boot the Pi, ssh will now be enabled and you can use;
ssh pi@raspberrypi or use ssh pi@<IP address> the password is raspberry. You can then configure the Pi using;

sudo raspi-config


I hope this helps.

jahboater
Posts: 5646
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: SSH error during Headless Install

Mon Dec 12, 2016 3:44 pm

Mr Toad wrote: However, all you have to do is create a blank file called ssh with no extension and no content.

nano ssh

Once nano or the editor you use opens save the file and exit, in nano this is Ctrl O to save then Ctrl X to exit.
You can just do

echo >ssh

or even just

>ssh

which should work on the Mac, on Linux, and probably even on Windows (I have not tried Windows).
No need to use an editor (which is risky on Windows as they are prone to adding extensions like ".txt").

Mr Toad
Posts: 3
Joined: Fri Mar 11, 2016 2:16 pm

Re: SSH error during Headless Install

Mon Dec 12, 2016 4:26 pm

jahboater wrote:
Mr Toad wrote: However, all you have to do is create a blank file called ssh with no extension and no content.

nano ssh

Once nano or the editor you use opens save the file and exit, in nano this is Ctrl O to save then Ctrl X to exit.
You can just do

echo >ssh

or even just

>ssh

which should work on the Mac, on Linux, and probably even on Windows (I have not tried Windows).
No need to use an editor (which is risky on Windows as they are prone to adding extensions like ".txt").
We're talking about remotely enabling ssh on a Raspberry Pi which has ssh disabled by default. Typing ssh or echo > ssh on a remote computer isn't going to do it.

jahboater
Posts: 5646
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: SSH error during Headless Install

Mon Dec 12, 2016 5:51 pm

Mr Toad wrote: We're talking about remotely enabling ssh on a Raspberry Pi which has ssh disabled by default. Typing ssh or echo > ssh on a remote computer isn't going to do it.
Then neither will "nano ssh" :). But no, you do this on your PC just after you have imaged the card. Mount or automount the SD card's first partition (just pulling it out of the card reader and replacing it works for me - do a sync first of course). Then cd /media/<you>/boot and create the file. If your PC is running linux (e.g. understands ext4) then you can also edit any config files in /etc such as dhcpcd.conf to set a static IP address if you like, and/or wpa_supplicant.

tweak42
Posts: 531
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: SSH error during Headless Install

Tue Dec 13, 2016 4:23 am

rborde10 wrote: 2.In addition i have also added the SSH text file (without the .txt extension) in the root folder of the sd card to enable SSH.
Sounds like ssh isn't being activated since the ssh file isn't being deleted. Considering you are using windows, are you absolutely sure that the .txt file extension isn't being hidden by windows file manager? Instructions how to disable "hide extensions for known file types" in Windows 10 here:

http://kb.winzip.com/kb/entry/26/

rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Tue Dec 13, 2016 10:49 am

update

Thank you everyone for taking time to look at this issue and providing your assistance. It is much appreciated.

I have to admit that last night i had to give up on a headless install. I took my RPi to my office where at my desk i have hdmi screen,usb mouse and keyboard.

I then logged in directly into the Rpi and enabled SSh through the sudo raspi-config command.

When i checked Ssh it was still disabled despite the fact that i had placed a notepad file called ssh in the root directory.

@tweak42 "are you absolutely sure that the .txt file extension isn't being hidden by windows file manager?" Answer is i dont know when i saved the file i did delete the extension but i wasn't aware of hidden file extensions. The ssh file was not deleted despite multiple reboots which i can see now as being not right.

Although my Rpi is up and running now i do think the instructions on the release notes are not comprehensive enough.

I deleted the extension when saving the file but i wasnt aware of windows ability to add hidden extensions. I am not an expert with computers and it wasn't obvious to me. One of the reasons i got my rpi was to learn more about programming so in that sense i have already learnt a bit ( about file extensions anyway)

Just to close off this thread i will check the ssh file again tonight to see if the hidden file extension is enabled. If it is there is a good chance that it was the reason for not enabling ssh. Atleast that way the next windows users (who is equally clueless of hidden extension) will have some thing to check to enable ssh. I will post my finding here.

Regards

Roger.

tweak42
Posts: 531
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: SSH error during Headless Install

Wed Dec 14, 2016 3:18 am

It's been awhile since I tried it (back in WinXP days), but if you save files using notepad in windows using " " quotes around the name, it should save the file as is, without appending any extension. To verify, just double click the file you just created in file explorer and it should NOT open in anything, but prompt you asking what program you want to use to open it.

The "hide known file extensions" has been a major insecurity "feature" since at least Windows 3.1 (24 years ago) because it allows malicious persons to hide .exe files masquerading as files like Word .doc or Adobe .pdf files so a clueless or careless user might run them from the email attachments. It's much less of a problem these days since virus scanners often rigorously scan email on the server side, and internet users are more educated to be suspicious of strange attachments.

rborde10
Posts: 8
Joined: Sun Dec 11, 2016 2:07 pm

Re: SSH error during Headless Install

Wed Dec 14, 2016 10:53 pm

@ tweak42

I just checked the ssh file that I had created and as you suggested the file is saved as a .txt file despite the fact that when i saved it I made sure i deleted the file extension.

I followed the instructions from your link "Hide extensions for known file types" and the ssh file now shows the .txt extension.

Then when the .txt is shown i manually deleted the .txt extension. Windows then gives the following prompt " If you change the filename extension the file might become unusable are you sure you want to change it?" I hit yes and the file is saved with no extension. Right click on the new file and under type of File just says file.

I think if i were to start with a headless install then this file would have enabled ssh on the RPi.

Roger.

User avatar
HawaiianPi
Posts: 5692
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH error during Headless Install

Thu Dec 15, 2016 2:17 am

LOL, yea, those stupid hidden extensions. I always forget about that because it's one of the first things I turn off after installing Windows on a system.

Booting that card should work now. SSH should be enabled, and the file should get deleted.

You can also get your Pi3 to connect to a wireless network automatically by placing a file named,

wpa_supplicant.conf

in the boot partition. The file should contain the wireless login info as follows:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
	ssid="your-network-service-set-identifier"
	psk="your-network-WPA/WPA2-security-passphrase"
	key_mgmt=WPA-PSK
}
Edit country=, ssid= and psk= with your info and save it in the boot partition of the SD card (the only partition visible to Windows). When you boot the system the file will be moved to the correct location and the Pi will connect to the wireless network.

With both the ssh and wpa_supplicant.conf files you can boot a headless Pi on a wireless network and SSH into it.

There used to be a bug in the Lite version that didn't work with /boot/wpa_supplicant.conf, but that seems to have been fixed with the 2016-11-25 release. I tested it this morning on my Pi-Zero and it works now (it's been a feature of the full GUI version of Raspbian for several months).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

tweak42
Posts: 531
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: SSH error during Headless Install

Thu Dec 15, 2016 5:28 am

HawaiianPi wrote: You can also get your Pi3 to connect to a wireless network automatically by placing a file named,

wpa_supplicant.conf

in the boot partition. The file should contain the wireless login info as follows:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
	ssid="your-network-service-set-identifier"
	psk="your-network-WPA/WPA2-security-passphrase"
	key_mgmt=WPA-PSK
}
Edit country=, ssid= and psk= with your info and save it in the boot partition of the SD card (the only partition visible to Windows). When you boot the system the file will be moved to the correct location and the Pi will connect to the wireless network.
I found the blog post mentioning the /boot/wpa_supplicant.conf trick, but is that documented anywhere in the official documentation? I searched the github raspi documentation repository and find no mention of it.

Return to “Troubleshooting”