Not being able to SSH into Rpi Zero 2 w

March 17, 2024, 23:25

justaccsolol

Hello, i was just trying to SSH into my Pi (after waiting a couple of minutes with a fast Micro SD) and it looks that i wasn't able, just a couple of Hours before i could. I affirmed that the ip was right, it shows in my router, i have tried adding a blank ssh file in the boot filesystem but i still can't ssh it.

justaccsolol

i have tried using a IP scanner too! and reformatted it several times already

k9t33n

have you enabled ssh in the imager?

justaccsolol

Yes i have

k9t33n

then do you have a display and micro hdmi cable?

justaccsolol

Yeah

k9t33n

that's the best way to debug this

k9t33n

then plug both in

k9t33n

it can just be temporary

justaccsolol

Ight

justaccsolol

For the moment boot is normal, no errors yes

justaccsolol

Yet*

justaccsolol

No errors

k9t33n

good then run this command ip a

k9t33n

and show the output ofcourse

justaccsolol

Im running headless

k9t33n

good

justaccsolol

And i don't have a keyboard rn

k9t33n

oh

k9t33n

not any you could borrow from a family member? that is if you live with family

justaccsolol

Nah can't

k9t33n

hmm

k9t33n

Welp this is a dilemma. were you attempting to ssh from your phone?

k9t33n

or laptop?

justaccsolol

My phone and using PuTTY

justaccsolol

In windows

justaccsolol

Both are connected to the same Network

k9t33n

yes

k9t33n

do you have any extenders or anything in your house?

justaccsolol

Never heard of it but prolly no

justaccsolol

I suppose you mean wifi extenders

k9t33n

yes

justaccsolol

Then no

k9t33n

nothing of the kind?

justaccsolol

Nope

k9t33n

ok let me think for a sec

k9t33n

you've set the hostname?

justaccsolol

Ye

k9t33n

then in putty try and ssh to the hostname

justaccsolol

Ight

k9t33n

if that doesn't work try [hostname].local

justaccsolol

doesn't exist

k9t33n

and in the network you can see the hostname?

k9t33n

this is a weird one then

k9t33n

are you on an iPhone?

justaccsolol

no

justaccsolol

android

k9t33n

very strange

justaccsolol

indeed

justaccsolol

i don't have an adaptor

k9t33n

nvm forget that

justaccsolol

i had problems connecting with Wifi in a desktop environment

k9t33n

hmm

k9t33n

no laptop?

justaccsolol

i do have a laptop

justaccsolol

eh this is a problem for future me, its quite late rn

k9t33n

ok

k9t33n

tell future you to open up your laptops command line and enter ssh [hostname].local or try ssh [ip]@[username]

justaccsolol

Will surely do haha

justaccsolol

I was able to ssh my raspi while in school, not sure now!

oops.se

In todays Raspberry Pi OS you don't need to use IP, you can use mDNS aka hostname, ex ssh@<hostname> and <hostname> is the name you gave the Pi when you created the SD card. And second how did you create the SD card? Did you use the "Raspberry Pi Imager"?

k9t33n

I wanted to try both since one wasn't working

oops.se

I think you mean ssh [ip]@[username] that should be ssh [username]@[hostname] and when you omit the user name in ssh [hostname].local it will take that hosts username as the username ssh should use... so it is a good practice to always inlude the username.

k9t33n

ohh i wondered why it automatically knows for me, because both my laptop and pis username are the same. thanks for telling me

oops.se

It uses the environment variable "$USER" and to print that use echo $USER

justaccsolol

just reflashed it, it suddenly works