[SOLVED] ssh - connection refused - after moving /var

This forum is for topics dealing with problems with software specifically in the ARMv6h repo.

[SOLVED] ssh - connection refused - after moving /var

Postby nuxnik » Mon Oct 27, 2014 8:34 pm

Hello
New to Arch Linux
1+ year experience with Lubuntu (PC & laptop) & Raspian (Raspberry Pi).
40+ years as computer geek.
Have been running Raspian on my Raspberry Pi.
Under Raspian, I was able to move "/" to a USB Hard Drive. and set up a separate /Var partition on the same HD. Ssh into the RasPi - no problems.
Decided to try installing Arch Linux on the RasPi. And basically do the same setup
1) Just installed Arch on SD and ran it. Ssh works fine out of the box. Same for wired lan connection.
2) On reboot ssh worked fine..
3) Then used dd to copy /var from the SD to another partition on the HD, and redefined fstab to point to the hard drive. (basically copied the Raspian version that already worked).
4) On reboot, could not use ssh. "connection refused".
4) Able log on to Pi. Access /var files no problem. Also able to ping on both server (Raspi) and client (Lubuntu desktop) from the other. But no ssh.
5) Changed fstab back to only using /var on the SD = ssh works.
6) changed fstab to point to HD = connection refused.
7) Nothing in Dmessg to show any other problems..
I am stumped.
What am I missing ?
Last edited by nuxnik on Sun Nov 23, 2014 12:30 am, edited 1 time in total.
nuxnik
 
Posts: 11
Joined: Mon Oct 27, 2014 8:27 pm

Re: ssh - connection refused - after moving /var from SD to

Postby Geoff » Mon Oct 27, 2014 9:13 pm

Maybe the ssh daemon was started before /var was mounted. You would probably need an initrd to sort that out, which could be more trouble than it's worth just to have a separate /var partition.
Geoff
 
Posts: 231
Joined: Wed Mar 09, 2011 5:14 pm

Re: ssh - connection refused - after moving /var from SD to

Postby WarheadsSE » Mon Oct 27, 2014 9:39 pm

That's precisely the problem here, I believe
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: ssh - connection refused - after moving /var from SD to

Postby nuxnik » Mon Oct 27, 2014 9:55 pm

Why would the ssh daemon care where /var gets mounted, before of after it starts ?
Also, I do NOT have this problem with Debian or Raspian.

Also would't Fstab be implemented before the ssh daemon ?
nuxnik
 
Posts: 11
Joined: Mon Oct 27, 2014 8:27 pm

Re: ssh - connection refused - after moving /var from SD to

Postby Geoff » Tue Oct 28, 2014 3:52 am

$this->bbcode_second_pass_quote('nuxnik', 'W')hy would the ssh daemon care where /var gets mounted, before of after it starts ?

You *might* be able to get away with making a "/var/empty/" directory on the root partition, as I think the ssh daemon expects that empty directory to exist for use only as a chroot jail. If so, it shouldn't really matter if that directory later gets hidden under the /var mount point. However, it might not be only the ssh daemon that needs /var early on, so who knows what else may break.
Geoff
 
Posts: 231
Joined: Wed Mar 09, 2011 5:14 pm

Re: ssh - connection refused - after moving /var from SD to

Postby nuxnik » Tue Oct 28, 2014 1:28 pm

Folks,

I really don't want a workaround
I want this to work as intended.
And I want to understand why it's not working.

1) Ssh should not care where Fstab defines /Var. After all it has NO problem with where / is mounted. And that is ALSO defined in fstab
2) I also created another partition with the /backup mount point. It was also implemented before the /var move. and ssh had no problems doing the connection after that change
2) ssh does not care where I have moved / since it works just fine after doing so. It also had no problems with that move either
3) I do not see why the ssh daemon would start before fstab is implemented. After all it's working fine with the fstab redirection of / and creation of /backup.

So I can only conclude that this is something else, that has nothing to do with the daemon.

Also since I have not yet implemented secure access and am only accessing things with the root account, those should not be issues either

Just to make sure I did not miss something, here is my /etc/fstab

$this->bbcode_second_pass_code('', '
[root@raspi ~]# cat /etc/fstab
#
# Partition UUID obtained using 'blkid' & 'lsblk'
# mmcblk0
# |-mmcblk0p1 vfat Arch-boot F362-708C
# `-mmcblk0p2 ext4 Arch-root b338f4b0-9ac9-4140-b6b7-862b04a63c0d
# sda
# |-sda1 swap sg-swap afca69a3-1b4f-4333-b76a-8e231536b329
# |-sda2 (Extended Partition sda3 & sda4 are reserved for primary partitons)
# |-sda5 ext4 ArchLinux-root 9ba83b05-bbeb-4718-a439-5f6a964a678f
# |-sda6 ext4 Raspian-root 98d95923-0f76-4dd0-93f7-3c3e16b5e796
# |-sda7 ext4 Unused--root 171418de-a5f2-40ef-9d81-ae286f8a08d2
# |-sda8 ext4 Var da19bd8a-041e-4b37-9ff2-48ab260192b6
# `-sda9 ext4 Pi-boot-backups 76630427-57fc-4bae-9d31-824815703eb7
#
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
# UUID=F362-708C /boot vfat defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 0

#
# swap on HD partition #1
# /dev/sda1 none swap sw 0 0
UUID=afca69a3-1b4f-4333-b76a-8e231536b329 none swap sw 0 0

# /(root) partitions
##
## Arch Linux - sda5
## /dev/sda5 / ext4 defaults 0 0
UUID=9ba83b05-bbeb-4718-a439-5f6a964a678f / ext4 defaults 0 0

#
#
# /var partition
# /dev/sda8 /var ext4 defaults 0 0
# UUID=da19bd8a-041e-4b37-9ff2-48ab260192b6 /var ext4 defaults 0 0

#
#
# /backup partition
# /dev/sda9 /backup ext4 defaults 0 0
UUID=76630427-57fc-4bae-9d31-824815703eb7 /backup ext4 defaults 0 0
')
nuxnik
 
Posts: 11
Joined: Mon Oct 27, 2014 8:27 pm

Re: ssh - connection refused - after moving /var from SD to

Postby WarheadsSE » Tue Oct 28, 2014 3:33 pm

Do these other distros use an initrd?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: ssh - connection refused - after moving /var from SD to

Postby nuxnik » Tue Oct 28, 2014 5:34 pm

There is only one way to boot the Raspberry Pi
All the distros are forced to use the same method

The /boot partition is FAT
The / partition is extX
The cmdline.txt point to the / partition

Have not looked at other flavors such as PUppy or Pidora (fedora for Pi)
nuxnik
 
Posts: 11
Joined: Mon Oct 27, 2014 8:27 pm

Re: ssh - connection refused - after moving /var from SD to

Postby WarheadsSE » Wed Oct 29, 2014 12:38 pm

For giggles: restart the sshd.service after you have logged in locally. See if it works then. Also, is there any log available from the sshd that might be even slightly viable?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: ssh - connection refused - after moving /var from SD to

Postby nuxnik » Sat Nov 22, 2014 7:25 pm

Hello,

After a few weeks of distraction from other problems, I finally returned to this problem

On advice from another source I ran the command

$this->bbcode_second_pass_code('', '
journalctl -u sshd |tail -50
')


I got this:
$this->bbcode_second_pass_code('', '
..
Nov 05 05:18:41 raspi systemd[1]: Started OpenSSH Daemon.
Nov 05 05:18:41 raspi sshd[154]: /var/empty must be owned by root and not group or world-writable.
Nov 05 05:18:41 raspi systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Nov 05 05:18:41 raspi systemd[1]: Unit sshd.service entered failed state.
Nov 05 05:18:41 raspi systemd[1]: sshd.service holdoff time over, scheduling restart.
Nov 05 05:18:41 raspi systemd[1]: Stopping OpenSSH Daemon...
')

It had an interesting entry indicating that the /var/empty directory did not belong to root.
And that said directory needed to be restricted to the root.

So I did a:
$this->bbcode_second_pass_code('', '
chown root /var/empty
')
rebooted
But the problem persisted

I then deleted and recreated /var/empy with:
$this->bbcode_second_pass_code('', '
rmdir /var/empty
mkdir /var/empty
')

rebooted.

And the problem went away...
nuxnik
 
Posts: 11
Joined: Mon Oct 27, 2014 8:27 pm


Return to ARMv6h

Who is online

Users browsing this forum: No registered users and 7 guests