mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

First time headless startup failed / SSH connection refused

Sun Dec 22, 2013 11:23 am

I have nearly no peripherials, so I have to run my new Rasperry completely headless. Here is what I did

Hardware: Raspberry Pi Model B 512MB, 16GB SD card class 10, Ethernet LAN cable, power adapter from a mobile phone, Windows 7 laptop, Windows XP laptop, wifi router

1. Operation system: I wrote the latest Raspbian release (2013-09-25) on a new 16GB SD card class 10 using win32diskmanager under Windows 7. I also did the checksum test. I read that this release has SSH activated by default.

2. Internet: My internet comes from a wifi router. I connected the Windows 7 laptop to a secured wifi network. Then I connected the Windows 7 and Windows XP latops via ethernet cable and enabled the wifi connection for sharing. I tried the ethernet connection on the Windows XP laptop and it worked. I also found the IP address (xxx.xxx.xxx.1) by typing ipconfig under Windows XP. On the Windows 7 laptop I was able to see this address when listing all connections under netstat and it also responded on ping xxx.xxx.xxx.1.

3. Raspberry startup: I first inserted the SD card, then the ethernet LAN cable and finally the power source. This was the first startup if this Raspberry. After some time PWR was red, FDX and LNK were green and 100 was orange.

4. SSH: Under Windows 7 I typed netstat but now I couldn't see an IP address for the Raspberry. However, when typing ping xxx.xxx.xxx.1 this address still responded. I tried to connect via Putty to xxx.xxx.xxx.1 on port 22 and it said "Network error: Connection refused".

Please help me! What I did wrong?

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 2:41 pm

I have to add one correction: After switching the ethernet LAN cable from the Windows XP laptop to the Raspberry, the IP address initially assigned to the Windows XP laptop is no longer responsible.

My explanation is the following. The Windows XP laptop automatically acquires an IP address from the Windows 7 laptop as soon as both devices are connected through the ethernet cable and Windows 7 laptop is sharing its internet connection. Thereby the wifi router doesn't list the IP address of the Windows XP laptop; it only lists devices connected to the wireless network. The IP address of the Windows XP laptop is visibly through netstat from the Windows 7 laptop. It seems that Raspberry won't acquire an IP address automatically like the Windows XP laptop does. I am stuck at this point. How to make Raspberry to acquire an IP adress, which I can then read out through netstat on Windows 7?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 2:42 pm

sudo ifconfig eth0 169.254.82.80
sudo ifconfig eth0 up
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 2:44 pm

DougieLawson wrote:sudo ifconfig eth0 169.254.82.80
sudo ifconfig eth0 up
Do you mean to run this command on the Raspberry? I can't do this because I have no access to the Raspberry.

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 2:52 pm

Shutdown the RPi, pull the power.
Pull your SDCard
Mount the card in Win7
Edit F:\cmdline.txt (I use the wordpad editor for that)
After rootwait, add ip=169.254.82.80 to the end of that file (don't split the line).
Save.
Use "remove device safely" to eject the card.
Put it back in your RPi and add some electrons.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 4:22 pm

DougieLawson wrote:Shutdown the RPi, pull the power.
Pull your SDCard
Mount the card in Win7
Edit F:\cmdline.txt (I use the wordpad editor for that)
After rootwait, add ip=169.254.82.80 to the end of that file (don't split the line).
Save.
Use "remove device safely" to eject the card.
Put it back in your RPi and add some electrons.
Did this, but no difference.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 8:22 pm

I thought it is a common feature of Ethernet that devices find their addresses alone and automatically. Why is this such a big deal with Raspberry?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 8:24 pm

mittkkoo wrote:I thought it is a common feature of Ethernet that devices find their addresses alone and automatically. Why is this such a bug deal with Raspberry?
Only when the other end of the wire has a DHCP server that can dish out addresses to the new connection.
Wire it directly to your router and it should be assigned an address.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 8:41 pm

DougieLawson wrote: Only when the other end of the wire has a DHCP server that can dish out addresses to the new connection.
Windows XP does the job, so obviously there is a DHCP server in my network.
DougieLawson wrote:Wire it directly to your router and it should be assigned an address.
If I do this I will have internet only on the Raspberry, which would be useless as Raspberry runs headless and I can't access it. I have a cable modem with wireless switch/router attached to it through the only ethernet port available, so I can either have one wired connection OR a wireless network. That's why the only possibility which I can think of is to use the wireless network and share the connection through ethernet on the Windows 7 laptop, as described above.

UPDATE: I found an old wifi dongle (TL-WN422G). The list with compatible hardware says, it should work well (out of the box) with Raspberry. However I have no idea how it could help me, because I can't tell Raspberry which wireless network it should connect to, even if I make the wireless network unsecured.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 9:29 pm

May be the reason for Raspberry not to connect to Ethernet is that this is its first run ever? I read that during the first boot the system does some formatting. But I can't ensure a smooth first boot because I can't shut down the Raspberry properly. Actually, the only way is to pull out the power (I did this once to try the advice with cmdline.txt given above), but in this case may be the first boot formatting is not done correctly.

Any ideas how to shut down a fresh headless Raspberry without SSH?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 9:52 pm

mittkkoo wrote:
DougieLawson wrote: Only when the other end of the wire has a DHCP server that can dish out addresses to the new connection.
Windows XP does the job, so obviously there is a DHCP server in my network.
Microsoft invented their own non-standard scheme for this using the 169.254.xxx.xxx/16 subnet.
Other operating systems (like Linux) don't want to do that.

Adding ip=169.254.82.80 in cmdline.txt should assign that address to the RPi eth0 interface. Windows will pick it's own random address and you should be able to ping your RPi. You may be able to connect if sshd is running. That's probably the nature of your problems - nothing to connect to.

When I rebuilt my system today (after my months old SDCard went bad, it's been on it's last legs for days now) the first five minutes (to get networking running) involved using a TV and a keyboard (with a few "What are you doing now" comments from my wife).

Ran raspi-config
Set sshd running
reboot
login as pi (password raspberry)
set a password for root (sudo passwd)
sudo ifconfig eth0 169.154.82.80
sudo ifconfig eth0 up

Next step was a cat5 wire to my laptop (so I could logon to my RPi and configure wireless).
Reboot to ensure wireless was working and I'd put the configs in the right place.

Then the rest of the four hour rebuild were spent restoring config files, installing latest firmware and upgrading from Wheezy to Jessie.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mittkkoo
Posts: 15
Joined: Sun Dec 22, 2013 10:17 am

Re: First time headless startup failed / SSH connection refu

Sun Dec 22, 2013 10:26 pm

DougieLawson wrote: Adding ip=169.254.82.80 in cmdline.txt should assign that address to the RPi eth0 interface.
I got your idea, but this doesn't seem to work.

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First time headless startup failed / SSH connection refu

Mon Dec 23, 2013 1:27 am

You'll have to go for Plan B with your RPi, a keyboard, an HDMI lead and a TV.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

jarvis28
Posts: 4
Joined: Mon Jan 25, 2016 10:47 am

Re: First time headless startup failed / SSH connection refu

Mon Jan 25, 2016 10:51 am

Hi, I have the exact problem. A few days ago the auto config ip address was 192.168.137.1 for my pc and I had set 192.168.137.5 as my pi 2's address.With those addresses i could connect via putty and also access internet via LAN. Now for some reason the ip address has been changed to 169.254.167.145 and I have set 169.254.167.148 as my pi 2's ip address.But, with these addresses i cannot connect via putty at all. The error is "CONNECTION REFUSED". Can you please help me with this error!. Btw I edited the ip addresses in the cmdline.txt file

ardanew
Posts: 1
Joined: Tue Jan 24, 2017 1:14 pm

Re: First time headless startup failed / SSH connection refu

Tue Jan 24, 2017 1:16 pm

worked for me: place an empty file named ssh into sd card near the config.txt

rfran
Posts: 1
Joined: Mon Feb 27, 2017 12:01 am

Re: First time headless startup failed / SSH connection refu

Mon Feb 27, 2017 12:07 am

Thank you, empty ssh file worked for me too.

Return to “Troubleshooting”