RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

SSH won't start - error running do_ssh

Fri Jul 20, 2012 7:02 pm

Using the latest Raspbian “wheezy” release, SSH won't start and running the rpi-config script I get:

"Invalid ssh key generation still running. Please wait and try again."

I hit enter and then get:

"There was an error running do_ssh"

I've waited a while and it doesn't seem to help. Any ideas?

User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: SSH won't start - error running do_ssh

Fri Jul 20, 2012 7:08 pm

When I started my Wheezy install ssh runs without doing anything.

As in Image the Wheezy to an SD card put in a RPi with a 10BaseT cable to my router plug in the SD then the power.

Look at my router (its a Netgear one and has a button to show whats connected)

Fire up putty and address the IP address discovered from the router.

I put some noob stuff for this on the wiki and I don't think the Wheezy image has changed since. Obviously I'm gona go look.
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Fri Jul 20, 2012 7:22 pm

Jim JKla wrote: Fire up putty and address the IP address discovered from the router.
I know the ip address of the pi but I just get connection refused when trying to SSH in. It's definitely on the network as the motion-webserver I have running can see the pi's webcam.

alexchamberlain
Posts: 121
Joined: Thu Jun 14, 2012 11:20 am
Location: Leamington Spa, UK
Contact: Website

Re: SSH won't start - error running do_ssh

Fri Jul 20, 2012 7:42 pm

RobParker wrote:Using the latest Raspbian “wheezy” release, SSH won't start and running the rpi-config script I get:

"Invalid ssh key generation still running. Please wait and try again."

I hit enter and then get:

"There was an error running do_ssh"

I've waited a while and it doesn't seem to help. Any ideas?
Is `ssh-keygen` still running? `ps aux | grep ssh`
Developer of piimg, a utility for working with RPi images.

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Fri Jul 20, 2012 7:45 pm

That returns:

/usr/bin/sshd
/usr/bin/ssh-ag

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 3:55 pm

Ok the pi's been running for over a day now and it raspi-config still says that the ssh key generation is still running.

Looks like something's gone wrong :-(

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 5:26 pm

This is what my auth.log shows

Jul 21 17:16:38 raspberrypi sshd[3206]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jul 21 17:16:38 raspberrypi sshd[3206]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Jul 21 17:16:38 raspberrypi sshd[3206]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 5:32 pm

I followed this: http://stackoverflow.com/questions/7251 ... et-by-peer

and did this "Recreate the ssh_host_dsa_key and ssh_host_rsa_key if needed(ssh-keygen -t 'dsa/rsa') and overwrite these files in /etc/ssh" and it's generated the keys and now seems to be working.

Still no idea why the keys weren't generated automatically though.

asb
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
Contact: Website

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 5:35 pm

Hi Rob, that is indeed odd - I've never had someone report that failure before. The init.d script which generates the ssh host keys won't delete itself until it regenerated the keys. I don't suppose it's possible you didn't shut down properly after first boot? Could you please paste the contents of /var/log/regen_ssh_keys.log

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 5:46 pm

I'm fairly sure it shutdown fine, it didn't complain about anything.

/var/log/regen_ssh_keys.log is empty

Also if i try and go the the SSH option in raspi-config it still says that it's trying to generate the keys.

Vortex
Posts: 12
Joined: Wed Mar 07, 2012 11:18 pm

Re: SSH won't start - error running do_ssh

Sat Jul 21, 2012 10:38 pm

I am running into the same problem

And ssh-keygen -t 'dsa/rsa' gives me an error: Unknown key pair :S

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sun Jul 22, 2012 7:05 am

Sorry, they're meant to be run separately

ssh-keygen -t 'dsa'
ssh-keygen -t 'rsa'

and you need to overwrite the keys already there

asb
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
Contact: Website

Re: SSH won't start - error running do_ssh

Sun Jul 22, 2012 6:41 pm

RobParker wrote:I'm fairly sure it shutdown fine, it didn't complain about anything.

/var/log/regen_ssh_keys.log is empty

Also if i try and go the the SSH option in raspi-config it still says that it's trying to generate the keys.
There must have been some changes which weren't committed for some reason or FS corruption. The script run at first boot will: 1) generate ssh host keys, 2) enable ssh, 3) delete itself so it won't be run again. It logs all output to /var/log/regen_ssh_keys.log and raspi-config refuses to run its ssh config menu unless that log file contains "finished" (to avoid a race condition where you disable ssh, then the background ssh host key generation finishes and enables it again).

RobParker
Posts: 38
Joined: Fri Jan 13, 2012 4:24 pm

Re: SSH won't start - error running do_ssh

Sun Jul 22, 2012 7:10 pm

Is there an easy way to make it think it ran ok so I get the options back for raspi-config?

asb
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
Contact: Website

Re: SSH won't start - error running do_ssh

Sun Jul 22, 2012 7:13 pm

RobParker wrote:Is there an easy way to make it think it ran ok so I get the options back for raspi-config?
rm /var/log/regen_ssh_keys.log

I'll try and see if there's a better way to avoid and/or handle this corner case.

thingfish
Posts: 1
Joined: Sun Jul 22, 2012 7:15 pm

Re: SSH won't start - error running do_ssh

Sun Jul 22, 2012 7:37 pm

I had the same problem trying to install ssh from raspi-config as well as purging and installing open-ssh. Either way, the keys in /etc/ssh/ were all 0 bytes.

I was able to get sshd to run by generating the keys with ssh-keygen and copying them from .ssh/ to /etc/ssh with the appropriate name. E.g. cp id_dsa.pub /etc/ssh/ssh_host_dsa_key.pub

akkarin
Posts: 4
Joined: Fri Jun 22, 2012 4:19 pm

Re: SSH won't start - error running do_ssh

Mon Jul 23, 2012 2:27 pm

I got the same problem. The first boot SSH works fine - then after reboot ssh doesn't come back up for whatever reason.

byildiz
Posts: 1
Joined: Thu Aug 02, 2012 10:56 am

Re: SSH won't start - error running do_ssh

Thu Aug 02, 2012 10:57 am

i have the same problem

dannemanne
Posts: 2
Joined: Thu Aug 02, 2012 1:12 pm

Re: SSH won't start - error running do_ssh

Thu Aug 02, 2012 1:16 pm

I just got the same problem.

If it helps in the troubleshooting, I booted up the Pi yesterday and got to the blue intro screen but did not do anything then. I just powered it down. Then today I booted again and finalized it.

Maybe I broke something yesterday by not finalizing it then???

danneman
Posts: 19
Joined: Thu Jun 21, 2012 9:57 am

Re: SSH won't start - error running do_ssh

Thu Aug 02, 2012 10:03 pm

Hi.

I do also have these problems. I had an error at rasp-config when I should enable SSH but I can't remember the error message:cry: I thought I could fix it myself later on but there is no /boot/boot_enable_ssh.rc to use?

does anybody got ssh to work with the new 2012-07-15 image?

dannemanne
Posts: 2
Joined: Thu Aug 02, 2012 1:12 pm

Re: SSH won't start - error running do_ssh

Fri Aug 03, 2012 1:24 am

Yes, I got it to work by following RobParker's instructions of manually generating new SSH keys. To be more precise, I did it like this:

sudo ssh-keygen -t 'dsa'

When it asks were to save it, I typed:

/etc/ssh/ssh_host_dsa_key

You will then have to confirm that you want to overwrite the existing file by pressing y then Enter.
And pressing Enter when question about passphrase appears.

Then repeat the previous commands except replace dsa with rsa.

And when that is done, restart the ssh serivce with the command

sudo service ssh restart

That worked for me

danneman
Posts: 19
Joined: Thu Jun 21, 2012 9:57 am

Re: SSH won't start - error running do_ssh

Fri Aug 03, 2012 6:35 am

Thanks dannemanne! That worked perfectly!

/Daniel

BozCoding
Posts: 1
Joined: Sat Jan 26, 2013 9:38 am

Re: SSH won't start - error running do_ssh

Sat Jan 26, 2013 9:42 am

I also had the same issue, I was using the Armel 8-8-2012 image, didn't have this on a prior install though and using the above instructions sorted me out, for rsa, dsa and ecdsa.

Return to “Beginners”