Ssh: connect to host port 22: connection refused - raspberry pi

I have a Raspberry Pi which I want to run Ubuntu Mate 20.04 on, I don't have a monitor and so must run headless. I have downloaded the image and written it to the SD card, adding ssh to the boot partition before booting the device for the first time. But when I try to connect to the device I just get

ssh: connect to host port 22: connection refused

what can I do to get access?

Hi and welcome on our community :slight_smile:

Are you sure you have the good IP address of the raspberry ?
Do you use the user pi ?

ssh pi@ipofrpi

Good luck !

Oh, yes, I know the IP Address, I can get it working with other images. It just seems to be the Mate version that isn't working

Depending on what actually got installed for SSH, you might not have any keys - I know this can result in refusal. To fix it is easy, once you can log in!
Perhaps you can organise a monitor, keyboard etc for a temporary fix.
Derek

Every other image I have tried for the Raspberry Pi works by adding a blank file called ssh to the boot partition before booting the Pi for the first time, except for this one. I don't understand why this one doesn't work?

As a result, I have had to use the Ubuntu server 20.04 image, which booted just fine, and then tried loading the Mate desktop. Unfortunately, doing it this way means that I get the bare minimum desktop rather than the fully featured version which I was hoping for from the Mate image.

Sadly, sometimes we need to pass some time to configure the machine as we want.
I guess, mate, disallow or didn't implemented te blank ssh file integration for security reasons.
As @dandnsmith said, the best for you will be to install UM on a SD card, next boot it and configure with plugged in keyboard & mouse ( i guess openssh-server is missing and need to be installed ), next use it.
If you installed ubuntu mate on this rpi, means you will probably use it's GUI ( otherwise, a ubuntu server will be enough ), that also means, that there will be a keyboard and mouse plugged to it later.

That rather misses the point of the Raspberry Pi, which are largely used headless attached to a network. Besides, I only have a laptop, I don't have an external keyboard or monitor, why would I buy these things to use with a cheap device like a Raspberry Pi?

Effectively you are telling me not to bother with this distribution, which is a shame as I already use Ubuntu Mate on my laptop as it is my preferred version of Linux.

You can do it this way :
On your SD card, edit this file :
/etc/rc.local
Add inside this file the command to enable the ssh service and start it :
service ssh enable
service ssh start

Next, put give it a try :slight_smile:

If still not working, you can try to install openssh-server with the same way adding :
apt install openssh-server -y
service ssh enable
service ssh start
The -y is important, it will not ask user input and do the install.
Once there by ssh, remove those lines :slight_smile:

I hope this to work

Thank you, that is more the sort of help I was hoping to get.

Unfortunately, it hasn't worked, but it was worth a try :wink:

You can try also to add something like :

service ssh status > /home/pi/log.log

to see if it is not running into a error. If the file is not getting created, maybe we can try a different on-startup method.

Unfortunately, I am not getting anything in the log file

[quote="kimharding, post:7, topic:23848"]
That rather misses the point of the Raspberry Pi, which are largely used headless attached to a network
[/quote] I'm not convinced of this - none of my Pi are currently headless, and, further, don'y see point of having Mate if you want headless.
Derek

Single board computer projects can often be network attached devices, where operating headless is the obvious way to go. However, there are times when it is easier to things via a GUI rather than command line using a remote desktop, hence why use Mate in a headless setup. Mate is well suited to this as it because of its light resource use.

But hey, if you are happier using your Pi attached to a keyboard and monitor go with it, that the great thing about single board computers they are so flexible in the ways that you can use them.