Error when installing ssh-app-osmc

When i started setting up my new Vero V instance i noticed that i couldn’t ssh in to the thing. After digging around and trying to uninstall / install the ssh-app-osmc package from the GUI, purge it with apt en then reinstall it i gave up thinkig i could live with it. But now everytime there is an OSMC-update it tries to install the ssh-server which again fails.

Logs at https://paste.osmc.tv/xogahazeda

Any suggestions/Thoughts?

You can’t uninstall the SSH server - it’s a hard dependency. The app exists so it can be enabled/disabled

Sam

I see. I think i managaed to purge it using apt?

I guess the root to the problem is that it didn’t manage to successfully install/initiate7enable it in the first place then?

And it does say install/uninstall in the “app store” :man_shrugging:? Does that actually mean enable/disable?

Can you still login via SSH?

If so – can you run sudo apt-get install ssh-app-osmc?

No; i could never log in via SSH.

I have to connect a keyboard to the Vero to try anything command line based.

Installing/uninstalling from the “app-store” results in an Error.

I think i ran sudo apt-get remove and then tried “installing” it from the app-store again :thinking:

(its been a couple days since i tried)

Ok, I think that is your only option for now. Based on the logs something is now stucked due to the dependency on SSH which also mean why it can not be removed.

iH  ssh-app-osmc

Start with sudo apt install -f ssh-app-osmc and report what is output.

osmc@Vero5:~$ sudo apt install -f ssh-app-osmc

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ssh-app-osmc is already the newest version (1.2.5).
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3232 B of archives.
After this operation, 0 B od additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up openssh-server (1:8.4p1-5+debian11u3) ...
grep: ]: No such file or directory
/usr/bin/ucf: 444: [: missing ]
rescue-ssh.service is a disabled or a static unit, not starting it.
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and journalctl -xe" for details.
invoke-rc 4: initscript ssh, action "restart" failed.
* ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Mon 2024-02-26 10:45:16 CET; 16ms ago
        Docs: man:sshd(8)
              man:sshd_config(5)
    Process: 3159 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/Failure)
dpkg: error processing package openssh-server (--configure):
  installed openssh-server package post-installation script subprocess returened error exit status 1
Errors were encountered while processing :
  openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

And the systemctl status ssh.service

osmc@Vero5:-$ systemctl status ssh.service

* ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Mon 2024-02-26 10:45:16 CET; 23m ago
        Docs: man:sshd(8)
              man:sshd_config(5)
    Process: 3168 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/Failure)

Feb 26 10:45:17 Vero5 systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
Feb 26 10:45:17 Vero5 systemd[1]: Stopped OpenBSD Secure Shell server.
Feb 26 10:45:17 Vero5 systemd[1]: ssh.service: Start request repeated to quickly.
Feb 26 10:45:17 Vero5 systemd[1]: ssh.service: Failed with result ´exit code´.
Feb 26 10:45:17 Vero5 systemd[1]: Failed to start OpenBSD Secure Shell server.

And for the giggels: journalctl -xe entries relevant for the install command:

osmc@Vero5:-$ journalctl -xe

Feb 26 10:45:00 Vero5 sudo[2981]:        osmc : TTY=tty1 ; PWD=/home/osmc ; USER=root ; COMMAND=/usr/bin/apt install -f ssh-app-osmc
Feb 26 10:45:00 Vero5 sudo[2981]: pam_unix(sudo:session): session opened for user root(uid=0) by osmc(uid=1000)
Feb 26 10:45:14 Vero5 systemd[1]: Reloading.
Feb 26 10:45:15 Vero5 systemd[1]: Reloading.
Feb 26 10:45:16 Vero5 systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: A start job for unit ssh.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit ssh.service har begun execution.
--
-- The job identifier is 895.
Feb 26 10:45:16 Vero5 sshd[3159]: sshd: no hostkeys available --exiting.
Feb 26 10:45:16 Vero5 systemd[1]: ssh.service: Control prcess exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit ssh.service har exited.
--
-- The process' exit code is 'exited' and its exit status is '1.
Feb 26 10:45:16 Vero5 systemd[1]: ssh.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit ssh.service has entered the 'failed' state with result 'exit-code'.
Feb 26 10:45:16 Vero5 systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: A start job for unit ssh.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit ssh.service has finished with a failure.
--
-- The job identifier is 895 and the job result failed.
Feb 26 10:45:16 Vero5 systemd[1]: ssh.service: Scheduled restart job, restart counter is at 1
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Automatic restarting of unit ssh.service har been scheduled, as the result for
-- the configured Restart= setting for the unit.
Feb 26 10:45:16 Vero5 systemd[1]: Stopped OpenBSD Secure Shell server...
-- Subject: A stop job for unit ssh.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit ssh.service has finished.
--
-- The job identifier is 942 and the job result is done.
Feb 26 10:45:16 Vero5 systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: A start job for unit ssh.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit ssh.service has begun execution.
--
-- The hob identifier is 942
Feb 26 10:45:16 Vero5 sshd[3163]: sshd: no hostkeys available --exiting.
Feb 26 10:45:16 Vero5 systemd[1]: ssh.service: Control prcess exited, code=exited, status=1/FAILURE
(... and so on)

After this it tries to restart the service 5 times, which all fails with the same error.

(There might some typos in this since i had to transcribe it to on a secondary pc :sweat_smile:)

Great efforts, we would have accepted pictures via your mobile :wink:

Not sure where this all got wrong. Let’s check some more points:

ls -lah /usr/bin/ucf
ls -lah /etc/ssh/

osmc&Vero5:~$ ls -lah /usr/bin/ucf

-rwxr-xr--x 1 root root 41K Jun 16 2020 /usr/bin/ucf
osmc&Vero5:~$  ls -lah /etc/ssh

total 600K
drwxr-xr-x  4 root root 4.0K Feb 22 22:36 .
drwxr-xr-x 74 root root 4.0K Feb 26 15:18 ..
-rw-r--r--  1 root root 565K Jul  2  2022 moduli
-rw-r--r--  1 root root 1.7K Jul  2  2022 ssh_config
drwxr-xr-x  2 root root 4.0K Jul  2  2022 ssh_config.d
-rw-------  1 root root    0 Aug  7  2023 ssh_host_ecdsa_key
-rw-r--r--  1 root root    0 Aug  7  2023 ssh_host_ecdsa_key.pub
-rw-------  1 root root    0 Aug  7  2023 ssh_host_ed25529_key
-rw-r--r--  1 root root    0 Aug  7  2023 ssh_host_ed25529_key.pub
-rw-------  1 root root    0 Aug  7  2023 ssh_host_rsa_key
-rw-r--r--  1 root root    0 Aug  7  2023 ssh_host_rsa_key.pub
-rw-r--r--  1 root root 3.3K Jan  5 19:33 sshd_config
-rw-r--r--  1 root root 2.9K Jan  5 19:33 sshd_config.bak
drwxr-xr-x  2 root root 4.0K Jul  2  2022 sshd_config.d
-rw-r--r--  1 root root 3.3K Dec 21 17:09 sshd_config.distributed

The sshd_config.bak i think may stem from me trying to manually either install or remove the server. I dont remember

Maybe you added something that is not working.
Either review the sshd_config or alternative run rm -R /etc/ssh/* and then run again sudo apt install -f ssh-app-osmc

Same outcome as before. And now i have an empty ssh folder :slight_smile:

I do think that the ssh-app-osmc package is the one that is not fully install or removed. Should i try a autoremove before trying to install again?

The ufc error may be something like this : https://forums.raspberrypi.com/viewtopic.php?t=358178

You could try but as @sam_nazarko wrote it is a system dependency package so not sure about the success.
I wonder, assuming you haven’t setup much of the system so far, if it wouldn’t be easier/faster just to do a full reinstall of OSMC?

I think the same – just back things up and reinstall.

autoremove gave the same errors; so i will go for the reinstall when im able and report back.

Thanks for your help!