package openssh-server 1:7.2p2-4ubuntu2.6 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1

Bug #1814586 reported by Norbert
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have installed all updates to my system recently.
Then I tried to connect to this system from my LAN and was unable to connect.
So I tried to restart ssh service:

sudo service ssh restart
Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.

фев 04 23:22:00 norbert-vaio systemd[1]: Failed to start OpenBSD Secure Shell server.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Unit entered failed state.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Failed with result 'exit-code'.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
фев 04 23:22:00 norbert-vaio systemd[1]: Stopped OpenBSD Secure Shell server.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Start request repeated too quickly.
фев 04 23:22:00 norbert-vaio systemd[1]: Failed to start OpenBSD Secure Shell server.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Unit entered failed state.
фев 04 23:22:00 norbert-vaio systemd[1]: ssh.service: Failed with result 'start-limit-hit'.

Then I tried to reinstall it

$ sudo apt-get install --reinstall openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/335 kB of archives.
After this operation, 0 B of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 878149 files and directories currently installed.)
Preparing to unpack .../openssh-server_1%3a7.2p2-4ubuntu2.6_amd64.deb ...
Unpacking openssh-server (1:7.2p2-4ubuntu2.6) over (1:7.2p2-4ubuntu2.6) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu21.15) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
WARN: uid is 0 but '/' is owned by 1004
WARN: / is group writable!
Processing triggers for man-db (2.7.5-1) ...
Setting up openssh-server (1:7.2p2-4ubuntu2.6) ...
Unsafe symlinks encountered in /var/run/sshd, refusing.
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
insserv: warning: script 'screen-cleanup' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `screen-cleanup'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `screen-cleanup'
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
insserv: warning: script 'binfmt-support' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `binfmt-support'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `binfmt-support'
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.d: 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 Пн 2019-02-04 23:28:33 MSK; 9ms ago
  Process: 23843 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)
 Main PID: 23206 (code=exited, status=0/SUCCESS)

фев 04 23:28:33 norbert-vaio systemd[1]: Failed to start OpenBSD Secure Shell server.
фев 04 23:28:33 norbert-vaio systemd[1]: ssh.service: Unit entered failed state.
фев 04 23:28:33 norbert-vaio systemd[1]: ssh.service: Failed with result 'exit-code'.
dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

and got this bug.

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: openssh-server 1:7.2p2-4ubuntu2.6
ProcVersionSignature: Ubuntu 4.4.0-138.164-generic 4.4.155
Uname: Linux 4.4.0-138-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.1-0ubuntu2.18
AptOrdering:
 openssh-server: Install
 openssh-server: Configure
 NULL: ConfigurePending
Architecture: amd64
Date: Mon Feb 4 23:26:36 2019
ErrorMessage: subprocess installed post-installation script returned error exit status 1
InstallationDate: Installed on 2010-12-05 (2983 days ago)
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1.5
 apt 1.2.29ubuntu0.1
SourcePackage: openssh
Title: package openssh-server 1:7.2p2-4ubuntu2.6 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1
UpgradeStatus: Upgraded to xenial on 2017-06-24 (589 days ago)
modified.conffile..etc.ufw.applications.d.openssh-server: [deleted]

Revision history for this message
Norbert (nrbrtx) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks for filing this bug in Ubuntu.

There are some interesting warnings in the logs you provided:

WARN: uid is 0 but '/' is owned by 1004
WARN: / is group writable!

and

Setting up openssh-server (1:7.2p2-4ubuntu2.6) ...
Unsafe symlinks encountered in /var/run/sshd, refusing.

More details should be present in /var/log/syslog, /var/log/auth.log and/or in the output of journalctl -xe.

Could you please inspect those and report back, or attach them to this bug?

Changed in openssh (Ubuntu):
status: New → Incomplete
Revision history for this message
Norbert (nrbrtx) wrote :

I have checked about 1004 and got:

    ls -ld /
    drwxrwxr-x 32 1004 1004 4096 Dec 9 23:22 /

- it is really strange.

So I ran

    sudo chown root: /
    ls -ld /
    drwxrwxr-x 32 root root 4096 Dec 9 23:22 /

And reinstalled SSHD again:

    sudo apt-get install --reinstall openssh-server

without errors:

$ systemctl status sshd.service
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Ср 2019-02-06 22:02:53 MSK; 51s ago
  Process: 5011 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 5031 (sshd)
   CGroup: /system.slice/ssh.service
           └─5031 /usr/sbin/sshd -D

Feb 06 22:02:53 norbert-vaio systemd[1]: Starting OpenBSD Secure Shell server...
Feb 06 22:02:53 norbert-vaio sshd[5031]: Server listening on 0.0.0.0 port 22.
Feb 06 22:02:53 norbert-vaio sshd[5031]: Server listening on :: port 22.
Feb 06 22:02:53 norbert-vaio systemd[1]: Started OpenBSD Secure Shell server.

then rebooted.

Revision history for this message
Norbert (nrbrtx) wrote :

Finally I have ran `sudo chmod g-w /` to be completely sure and rebooted again.
As the result I can connect to this machine from my LAN.

Just curious - why did I have 1004:1004 rights on /?

Changed in openssh (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Seth Arnold (seth-arnold) wrote :

The easiest way to get that is to unpack a tarball, zip, package, etc., using sudo. Chances are really good *other* files and directories also have incorrect owner or permissions.

Thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.