[SOLVED] sshd not starting after upgrade

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

[SOLVED] sshd not starting after upgrade

Postby DePingus » Wed May 22, 2013 2:12 am

:oops: Let's get the shameful part out of the way first...So I foolishly did a pacman -Syyu and rebooted without reading and now my sshd doesn't start. I can tell only because nmap from a remote system shows the only open ports to be samba; 139 and 445.

I am able to connect the USB flash drive to a different system and look through the logs. I couldn't find anything of relevance in anything but the pacman.log. Here is the pacman.log:
$this->bbcode_second_pass_code('', '[2013-05-21 17:39] [PACMAN] Running 'pacman -Syyu'
[2013-05-21 17:39] [PACMAN] synchronizing package lists
[2013-05-21 17:39] [PACMAN] starting full system upgrade
[2013-05-21 17:41] [PACMAN] upgraded automake (1.13.1-1 -> 1.13.2-1)
[2013-05-21 17:41] [PACMAN] upgraded avahi (0.6.31-7 -> 0.6.31-9)
[2013-05-21 17:43] [PACMAN] upgraded ca-certificates (20130119-1 -> 20130119-2)
[2013-05-21 17:43] [PACMAN] upgraded keyutils (1.5.5-3 -> 1.5.5-4)
[2013-05-21 17:43] [PACMAN] upgraded libsasl (2.1.23-10 -> 2.1.26-2)
[2013-05-21 17:43] [PACMAN] upgraded libldap (2.4.35-2 -> 2.4.35-3)
[2013-05-21 17:43] [PACMAN] upgraded krb5 (1.11.2-1 -> 1.11.2-3)
[2013-05-21 17:43] [PACMAN] upgraded libwbclient (4.0.5-2 -> 4.0.5-3)
[2013-05-21 17:43] [PACMAN] upgraded cifs-utils (6.0-1 -> 6.0-2)
[2013-05-21 17:43] [PACMAN] upgraded cracklib (2.8.22-1 -> 2.8.22-2)
[2013-05-21 17:43] [PACMAN] upgraded freetype2 (2.4.11-2 -> 2.4.12-1)
[2013-05-21 17:44] [ALPM-SCRIPTLET] updating font cache... done.
[2013-05-21 17:44] [PACMAN] upgraded fontconfig (2.10.92-4 -> 2.10.93-1)
[2013-05-21 17:45] [PACMAN] upgraded gnupg (2.0.19-7 -> 2.0.20-2)
[2013-05-21 17:46] [PACMAN] upgraded nettle (2.6-1 -> 2.7-1.1)
[2013-05-21 17:46] [PACMAN] upgraded gnutls (3.1.10-1 -> 3.1.11-1)
[2013-05-21 17:46] [PACMAN] upgraded gpm (1.20.7-2 -> 1.20.7-3)
[2013-05-21 17:48] [PACMAN] upgraded groff (1.22.2-2 -> 1.22.2-3)
[2013-05-21 17:48] [PACMAN] upgraded hwids (20130228-1 -> 20130512-1)
[2013-05-21 17:48] [PACMAN] upgraded iputils (20121221-1 -> 20121221-2)
[2013-05-21 17:48] [PACMAN] upgraded libcups (1.6.2-1 -> 1.6.2-2)
[2013-05-21 17:49] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2013-05-21 17:50] [PACMAN] upgraded linux (3.1.10-19 -> 3.1.10-20)
[2013-05-21 17:52] [PACMAN] upgraded linux-headers (3.1.10-19 -> 3.1.10-20)
[2013-05-21 17:52] [PACMAN] upgraded logrotate (3.8.4-1 -> 3.8.4-2)
[2013-05-21 17:53] [PACMAN] upgraded man-db (2.6.3-1 -> 2.6.3-3)
[2013-05-21 17:53] [ALPM-SCRIPTLET]
[2013-05-21 17:53] [ALPM-SCRIPTLET] ==> The sshd daemon has been moved to /usr/bin alongside all binaries.
[2013-05-21 17:53] [ALPM-SCRIPTLET] ==> Please update this path in your scripts if applicable.
[2013-05-21 17:53] [ALPM-SCRIPTLET]
[2013-05-21 17:53] [PACMAN] upgraded openssh (6.2p1-1 -> 6.2p2-1)
[2013-05-21 17:53] [ALPM] warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
[2013-05-21 17:53] [PACMAN] upgraded pacman-mirrorlist (20130424-1 -> 20130521-1)
[2013-05-21 17:53] [PACMAN] upgraded procps-ng (3.3.7-1 -> 3.3.7-2)
[2013-05-21 17:55] [PACMAN] upgraded sqlite (3.7.16.2-1 -> 3.7.17-1)
[2013-05-21 17:59] [PACMAN] upgraded python2 (2.7.4-1 -> 2.7.5-1)
[2013-05-21 18:01] [PACMAN] upgraded smbclient (4.0.5-2 -> 4.0.5-3)
[2013-05-21 18:02] [PACMAN] upgraded samba (4.0.5-2 -> 4.0.5-3)
[2013-05-21 18:03] [PACMAN] upgraded util-linux (2.23-1 -> 2.23-2)
')
I assume the important part is where sshd was moved to /usr/bin. But I could be wrong. Perhaps my system upgraded itself to systemd and failed to systemctl enable sshd? Or even a combination of the two? Can I symlink or copy sshd from its new location in /usr/bin to its old home? And where would that even be?

Of course, this is a completely headless server and I only have access to the file system by hooking its USB flash drive to a different system. Any ideas what went wrong? How can I start sshd up again by just accessing files (no access to the systemctl command)?
Last edited by DePingus on Wed May 22, 2013 11:51 pm, edited 1 time in total.
DePingus
 
Posts: 22
Joined: Sat Jul 03, 2010 9:41 pm

Re: sshd not starting after upgrade

Postby kmihelich » Wed May 22, 2013 2:21 am

The rc.d scripts for openssh, along with most of the other packages, have been removed or are in the process of being removed. If you're not on systemd, get on systemd.
Arch Linux ARM exists and continues to grow through community support, please donate today!
kmihelich
Developer
 
Posts: 1133
Joined: Tue Jul 20, 2010 6:55 am
Location: aka leming #archlinuxarm

Re: sshd not starting after upgrade

Postby DePingus » Wed May 22, 2013 2:58 am

$this->bbcode_second_pass_quote('kmihelich', 'T')he rc.d scripts for openssh, along with most of the other packages, have been removed or are in the process of being removed. If you're not on systemd, get on systemd.


Thanks. That's pretty much what I figured. And /etc/systemd/system exists on my device; so I assume systemd is installed. The question now is: how can I get sshd started without access to the systemctl command?
DePingus
 
Posts: 22
Joined: Sat Jul 03, 2010 9:41 pm

Re: sshd not starting after upgrade

Postby moonman » Wed May 22, 2013 8:43 am

1. complete reinstall
2. chroot from another arm system
3. chroot from x86 system with qemu-user (may be difficult)

You can try putting this under /etc/rc.d under sshd name and make it executable

$this->bbcode_second_pass_code('', '#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/sshd

PIDFILE=/run/sshd.pid
PID=$(cat $PIDFILE 2>/dev/null)
if ! readlink -q /proc/$PID/exe | grep -q '^/usr/bin/sshd'; then
PID=
rm $PIDFILE 2>/dev/null
fi

case "$1" in
start)
stat_busy 'Starting Secure Shell Daemon'
/usr/bin/ssh-keygen -A
[[ -z $PID ]] && /usr/bin/sshd $SSHD_ARGS
if [[ $? -gt 0 ]]; then
stat_fail
else
add_daemon sshd
stat_done
fi
;;
stop)
stat_busy 'Stopping Secure Shell Daemon'
[[ ! -z $PID ]] && kill $PID &> /dev/null
if [[ $? -gt 0 ]]; then
stat_fail
else
rm_daemon sshd
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
')
Last edited by moonman on Wed May 22, 2013 9:21 am, edited 1 time in total.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: sshd not starting after upgrade

Postby pepedog » Wed May 22, 2013 8:54 am

There could be a problem?
[[ -z $PID ]] && /usr/sbin/sshd $SSHD_ARGS
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: sshd not starting after upgrade

Postby moonman » Wed May 22, 2013 9:22 am

$this->bbcode_second_pass_quote('pepedog', 'T')here could be a problem?
[[ -z $PID ]] && /usr/sbin/sshd $SSHD_ARGS


Yes, I forgot about this one... Fixed the script. That likely is the problem too in his original.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: sshd not starting after upgrade

Postby DePingus » Wed May 22, 2013 11:50 pm

$this->bbcode_second_pass_quote('moonman', 'Y')ou can try putting this under /etc/rc.d under sshd name and make it executable

$this->bbcode_second_pass_code('', '#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/sshd

PIDFILE=/run/sshd.pid
PID=$(cat $PIDFILE 2>/dev/null)
if ! readlink -q /proc/$PID/exe | grep -q '^/usr/bin/sshd'; then
PID=
rm $PIDFILE 2>/dev/null
fi

case "$1" in
start)
stat_busy 'Starting Secure Shell Daemon'
/usr/bin/ssh-keygen -A
[[ -z $PID ]] && /usr/bin/sshd $SSHD_ARGS
if [[ $? -gt 0 ]]; then
stat_fail
else
add_daemon sshd
stat_done
fi
;;
stop)
stat_busy 'Stopping Secure Shell Daemon'
[[ ! -z $PID ]] && kill $PID &> /dev/null
if [[ $? -gt 0 ]]; then
stat_fail
else
rm_daemon sshd
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
')


Dude, brilliant! You saved my system. This script got me in. The original /etc/rc.d/sshd script was gone, I had looked previously thinking the path was wrong after the upgrade. Thanks so much (and pepedog for the assist). Now I can migrate to systemd.
DePingus
 
Posts: 22
Joined: Sat Jul 03, 2010 9:41 pm
Top


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 3 guests