0

I've added the following commands in my /etc/rc.local file to automatically mount kernel's virtual file system, as said on Linux From Scratch (LFS).
And rebooted...

Sections
6.2.2 Mounting and Populating /dev
6.2.3. Mounting Virtual Kernel File Systems

mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run

if [ -h $LFS/dev/shm ]; then
  mkdir -pv $LFS/$(readlink $LFS/dev/shm
fi

Now this is what I get when trying to SSH bakk in:

ssh -vvv -i lfs.pem ubuntu@52.21.192.61   

OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g  1 Mar 2016   
debug1: Reading configuration data /home/heitor/.ssh/config   
debug1: Reading configuration data /etc/ssh/ssh_config   
debug1: /etc/ssh/ssh_config line 19: Applying options for *   
debug2: resolving "52.22.192.60" port 22   
debug2: ssh_connect_direct: needpriv 0   
debug1: Connecting to 52.22.192.60 [52.22.192.60] port 22.   
debug1: Connection established.   
debug1: key_load_public: No such file or directory   
debug1: identity file dev/heitor/linux-from-scratch/lfs-ssh-rescue.pem type -1   
debug1: key_load_public: No such file or directory   
debug1: identity file dev/heitor/linux-from-scratch/lfs-ssh-rescue.pem-cert type -1   
debug1: Enabling compatibility mode for protocol 2.0   
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1   
ssh_exchange_identification: read: Connection reset by peer   

Any help is appreciated.

  • 1
    Is $LFS set anywhere before that? Otherwise you're bind-mounting /dev onto itself, which won't end well… – n.st Oct 21 '16 at 3:14
  • 1
    And you're building a Linux from scratch on an Amazon cloud server? That doesn't sound like the most convenient testing environment… How about a virtual machine on your local box? ;) – n.st Oct 21 '16 at 3:16
  • No, it is not set. I'm gonna have to mount the volume in another instance and fix the script. Right? – Heitor Morgado Oct 21 '16 at 3:22
  • 1
    Let's back off a little. What's the problem you are trying to solve? You shouldn't normally need to do any kind of mounting yourself on a normal Linux distro, and it might be a little early to try building a "Linux From Scratch". ;) – n.st Oct 21 '16 at 3:24
  • What I'm trying to do is SSH back into my instance. Normally Udev mounts things for you, but LFS doesn't have Udev, so I have to mount everything myself. – Heitor Morgado Oct 21 '16 at 12:12
0

I fixed it mounting the volume in another instance, removing the broken commands and mounting it back in my Linux From scratch instance. Now I can ssh back in it normally =)

Thanks for the help everyone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.