SSH hostname stopped working

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

SSH hostname stopped working

Post by crik91 »

Hi, the SSH hostname (dietpi) stopped working suddenly. I don't know why, not received software updates. Then, I try to update it but not working anyway. I don't know why.
What can I try to solve it?

Thank you!
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

Re: SSH hostname stopped working

Post by crik91 »

Sorry, also Samba via hostname stopped working
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: SSH hostname stopped working

Post by MichaIng »

@crik91
What you mean by hostname? Can't you login anymore with the user "dietpi" or indeed can't you access your device from the local network with the hostname "dietpi", e.g. ping dietpi?

AFAIK the default hostname on DietPi is DietPi (respect capitalisation), but this is something I would change anyway, e.g. according to the external domain name.

If you mean login name, then try to login via root and investigate what has happened to the dietpi user.
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

Re: SSH hostname stopped working

Post by crik91 »

Sorry, I mean that up 2/3 weeks ago I was able to connect via Samba to the raspberry using the name "samba", it was visible in "Network" in WinOS and the same in macOS, it was reachable via smb:\\dietpi but now it's not possible anymore. I don't know why. :cry:
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: SSH hostname stopped working

Post by MichaIng »

Hmm, please run the following command on your DietPi to get the actual hostname:
hostname

Also check in your router settings if the device appears there with certain hostname or if you can assign one there.
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

Re: SSH hostname stopped working

Post by crik91 »

Code: Select all

root@DietPi:~# hostname
DietPi
I can connect via Samba only using the local IP address. Up to 2/3 weeks ago I was able to connect using "smb:\\dietpi" (yes, all lower letters) but now is not working also using "smb:\\DietPi" and the Samba server is not visible in my network as in the past. I don't know what it's changed.
Also in my router, the device was listed as "DietPi" and now something like PC-192-168-0-50 . I really don't know
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: SSH hostname stopped working

Post by MichaIng »

Strange that it worked with lower case in the past, as the hostname is the shown capitalisation.
Ah just saw our Samba docs and indeed it seems to be possible lower case somehow: viewtopic.php?f=8&t=5&start=10#p56

Does the device connect to the network/router via DHCP? Does you router allow to manually add a hostname to the device, so change PC-192-168-0-50 manually to DietPi?

Also according to the docs it should be smb:\\dietpi\dietpi instead of just smb:\\dietpi, I guess since this must include the accepted Samba username.
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

Re: SSH hostname stopped working

Post by crik91 »

In the WinOS PCs I was able to see "dietpi" listed (all lower letters) instead of "DietPi" as in the hostname. Now I can't see "DietPi", "dietpi" or anything else listed in Network.

Now I changed the name of the device in my router and it works again.

Yes, I always used "smb:\\dietpi" because I have 3 USB HDD in my smb.conf and typing just the server I was able to see a list of devices/folders to choose.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: SSH hostname stopped working

Post by MichaIng »

Not sure why suddenly the Pi does not show up by it's hostname anymore, but this is most likely related to the network/router and not the DietPi system itself.

Just to check whether the hosts file as well matches the hostname:
cat /etc/hosts

Perhaps reconnecting the Pi to the network would have also shown it again as its hostname in the network, or did you do reboots in between?
ifdown eth0
ifup eth0

However if it works now with the router assignment no need to further investigate for now.

Ah yeah of course. The second /dietpi in the Samba path just means to access the particular share named "dietpi".
crik91
Posts: 48
Joined: Mon Mar 20, 2017 7:51 am

Re: SSH hostname stopped working

Post by crik91 »

Hi, this is my hosts file:

Code: Select all

root@DietPi:~# cat /etc/hosts
127.0.0.1    localhost
127.0.1.1 DietPi
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
No change after rebooting the eth connection
Post Reply