SSH command no longer works

Hi all,

I set up HA on Raspberry Pi 3 and all was fine, but I noticed that the SSH commands to check and restart HA no longer work. It say its not a command. It worked just fine before the last update to a few days ago.

Does not work on OS X or Windows 10 with Putty or OpenSSH.

Any suggestions?

Thanks.

Check you have version 3 of the ssh add-on

It is version 3.0

Is that service/add-on running when you check?
Also check the log for clues as to why it’s not running/working.

I did check it when it was running.

Here is the log from the addon log file.

debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc /dev/pts/0
debug1: Ignoring unsupported tty mode opcode 11 (0xb)
debug1: Ignoring unsupported tty mode opcode 17 (0x11)
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on pts/0 for root from 192.168.1.15 port 54232 id 0
debug1: Setting controlling tty using TIOCSCTTY.
Received disconnect from 192.168.1.15 port 54232:11: disconnected by user
Disconnected from user root 192.168.1.15 port 54232
debug1: do_cleanup
debug1: session_pty_cleanup: session 0 release /dev/pts/0
debug1: Forked child 330.
debug1: Set /proc/self/oom_score_adj to 0
debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 192.168.1.3 port 49931 on 172.30.33.0 port 22
debug1: HPN Disabled: 0, HPN Buffer Size: 87380
debug1: Client protocol version 2.0; client software version OpenSSH_7.6
debug1: match: OpenSSH_7.6 pat OpenSSH* compat 0x04000000
debug1: Remote is NON-HPN aware
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Enabling compatibility mode for protocol 2.0
debug1: permanently_set_uid: 22/22 [preauth]
debug1: ssh_sandbox_child: prctl(PR_SET_SECCOMP): Invalid argument [preauth]
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: algorithm: curve25519-sha256 [preauth]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none [preauth]
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: rekey after 134217728 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: rekey after 134217728 blocks [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user root service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: Config token is loglevel
debug1: Config token is permitrootlogin
debug1: Config token is authorizedkeysfile
debug1: Config token is passwordauthentication
debug1: Config token is permitemptypasswords
debug1: Config token is subsystem
debug1: userauth-request for user root service ssh-connection method keyboard-interactive [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: keyboard-interactive devs  [preauth]
debug1: auth2_challenge: user=root devs= [preauth]
debug1: kbdint_alloc: devices '' [preauth]
debug1: userauth-request for user root service ssh-connection method password [preauth]
debug1: attempt 2 failures 1 [preauth]
Failed password for root from 192.168.1.3 port 49931 ssh2
debug1: Unable to open the btmp file /var/log/btmp: No such file or directory
debug1: userauth-request for user root service ssh-connection method password [preauth]
debug1: attempt 3 failures 2 [preauth]
Accepted password for root from 192.168.1.3 port 49931 ssh2
debug1: monitor_child_preauth: root has been authenticated by privileged process
debug1: monitor_read_log: child log fd closed
debug1: rekey after 134217728 blocks
debug1: rekey after 134217728 blocks
debug1: ssh_packet_set_postauth: called
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc /dev/pts/0
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on pts/0 for root from 192.168.1.3 port 49931 id 0
debug1: Setting controlling tty using TIOCSCTTY.
Read error from remote host 192.168.1.3 port 49931: Connection reset by peer
debug1: do_cleanup
debug1: session_pty_cleanup: session 0 release /dev/pts/0

Really not sure whats going on. Should I roll back to 0.60

This is what I get when I try to run that command.

Successful session, last few lines of log…

debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on pts/0 for root from 10.90.11.5 port 64594 id 0
debug1: Setting controlling tty using TIOCSCTTY.

Mine says starting session, yours says read error from remote host… connection reset by peer…

restarted Pi (unplugged power and plugged it back in)

Still same message:

Starting session: shell on pts/0 for root from 192.168.1.3 port 50485 id 0
debug1: Setting controlling tty using TIOCSCTTY.
Read error from remote host 192.168.1.3 port 50485: Connection reset by peer
debug1: do_cleanup
debug1: session_pty_cleanup: session 0 release /dev/pts/0

So what should I do?

Are you using user/password or an RSA key? Can you post the SSH actions from config? (redact key of course)

I’m using a password because I cannot seem to get the RSA Key to work.

What do you mean by SSH action from config? Do you mean the options section from the SSH addons page? If that is the case I only added the password so nothing else has changed from the default config except me adding a password.

There is no config info in the main HA configuration files for SSH if that is what you men.

Have you tried putting hassio first?

core-ssh:~# hassio homeassistant check

That’s what works for me.

Well thank you… that worked. wonder why I have to do that now, I didn’t have to do that before.

On a side note. How do I put in the rsa key. No matter what I put in that field the save button is greyed out. I used Puttygen but not sure how to add this in. I don’t really want to use a password.

What I mean is I added the public key to known hosts, so what do I add to the options section in the addon under “authorized keys” Do I add the key fingerprint, key comment or do I add the same thing I added to the known hosts’ file?

I’m not sure about this, but I think you would past the content of your public key into “authorization_keys” and the content fo your private key in putty.

{
  "authorized_keys": [ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNqqi1mHLnryb1FdbePrSZQdmXRZxGZbo0gTfglysq6KMNUNY2VhzmYN9JYW39yNtjhVxqfW6ewc+eHiL+IRRM1P5ecDAaL3V0ou6ecSurU+t9DR4114mzNJ5SqNxMgiJzbXdhR+j55GjfXdk0FyzxM3a5qpVcGZEXiAzGzhHytUV51+YGnuLGaZ37nebh3UlYC+KJev4MYIVww0tWmY+9GniRSQlgLLUQZ+FcBUjaqhwqVqsHe4F/woW1IHe7mfm63GXyBavVc+llrEzRbMO111MogZUcoWDI9w7UIm8ZOTnhJsk7jhJzG2GpSXZHmly/a/buFaaFnmfZ4MYPkgJD [email protected]],
  "password": ""
}

But I’m using password myself, so I may be wrong here.

it works now

thanks

1 Like

Hi I would like to open this string because i have the same problem.
I try to fellow some youtube video to install MQTT or anything else, the command they use on home assistant Putty doesn’t work on my HassIO Putty. is the command different.
For example I am trying to run sudo apt-get update this is what i get.

core-ssh:~# sudo apt-get update
-bash: sudo: command not found

when i run this like i read from the post it says ok.
core-ssh:~# hassio homeassistant check
ok

You can’t apt-get on hassio.

How can I use it?

all of the commands are proceeded by “hassio”

core-ssh:/# hassio help
NAME:
hassio - Commandline tool to allow interation with hass.io

USAGE:
hassio [global options] command [command options] [arguments…]

VERSION:
1.3.1

AUTHOR:
Home-Assistant [email protected]

COMMANDS:
homeassistant, ha info, logs, check, restart, start, stop, update
supervisor, su info, logs, reload, update
host, ho reboot, shutdown, update
hardware, hw info, audio
network, ne info, options
snapshots, sn list, info, reload, new, restore, remove
addons, ad list, info, logo, changelog, logs, stats,
reload, start, stop, install, uninstall, update
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
–debug, -d Prints Debug information
–help, -h show help
–version, -v print the version

For example, to list out the hardware :

core-ssh:/# hassio hw info
{
“result”: “ok”,
“data”: {
“serial”: [
“/dev/ttyAMA0”,
“/dev/ttyACM0”
],
“input”: [],
“disk”: [],
“gpio”: [
“gpiochip0”,
“gpiochip128”,
“gpiochip100”
],
“audio”: {
“0”: {
“name”: “bcm2835_alsa - bcm2835 ALSA”,
“type”: “ALSA”,
“devices”: {
“0”: “digital audio playback”,
“1”: “digital audio playback”
}
}
}
}
}