dmfaber1 / TunerPi

Raspberry Pi Guitar Tuner
1 stars 0 forks source link

As a Ken, I want to be able to SSH into the Raspberry Pi Zero #2

Closed dmfaber1 closed 3 years ago

dmfaber1 commented 3 years ago

https://www.raspberrypi.org/documentation/configuration/wireless/headless.md

https://www.raspberrypi.org/documentation/remote-access/ssh/

https://desertbot.io/blog/headless-pi-zero-w-wifi-setup-windows

dmfaber1 commented 3 years ago

So I figured it out... Just an issue with Windows not showing the boot partition in explorer. It is there, and the boot partition is FAT32, so it can be viewed. The main partition that is showing up is the OS partition that cannot be viewed. So here is what you need to do:

Open up the windows Disk Management tool, Start Menu -> Create and Format Hard Disk Partitions

Locate the disk that represents the SD card. For me it was Disk 4. If I scroll down I can see blocks representing the partitions on the SD card. Right click on the one that says boot and select explore.

Now you can do the steps to create the ssh file and the wpa_supplicant.conf file for wifi.

faberke611 commented 3 years ago

File Explorer shows the boot drive (D:) (containing several .dat, .elf, *.dtb files), and the SDHC drive (E:), and only complains about the E drive not being formatted

I don't think we finished step 3. I downloaded Ubuntu 18.04 LTS, but when I launch it, I get an error: "The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again". On the web page it says the next step is "Create a user account and password for your new Linux distribution". I never got that far on Sunday.

I believe I need to finish #3 before running the steps under:

  1. https://www.raspberrypi.org/documentation/remote-access/ssh/
  2. https://www.raspberrypi.org/documentation/configuration/wireless/headless.md

I believe I completed #6. Using GitBash, I Generated a new SSH key, Added SSH key to the ssh-agent, created a C:\Users\faber.bashrc file using NotePad, and added code from the link: https://docs.github.com/en/github/authenticating-to-github/working-with-ssh-key-passphrases for "Auto-launching ssh-agent on Git for Windows". My passphrase is faberke611. When I ran GitBash again it created a .bash_profile file.

When I sign into GitHub on my own, I get to: https://github.com/faberke611?tab=projects, and it says I have no projects. When I go to the link you sent, I get to: https://github.com/dmfaber1/TunerPi , but it also says I'm signed in as faberke611. Is there a way to link the TunerPi project to my login?

Dad

On Sun, Jan 17, 2021 at 11:53 AM dmfaber1 notifications@github.com wrote:

So I figured it out... Just an issue with Windows not showing the boot partition in explorer. It is there, and the boot partition is FAT32, so it can be viewed. The main partition that is showing up is the OS partition that cannot be viewed. So here is what you need to do:

Open up the windows Disk Management tool, Start Menu -> Create and Format Hard Disk Partitions

Locate the disk that represents the SD card. For me it was Disk 4. If I scroll down I can see blocks representing the partitions on the SD card. Right click on the one that says boot and select explore.

Now you can do the steps to create the ssh file and the wpa_supplicant.conf file for wifi.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dmfaber1/TunerPi/issues/2#issuecomment-761851886, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPTULS55EBDKROCLA4AYRTS2MPZLANCNFSM4WACE2OA .

dmfaber1 commented 3 years ago

So something with how you set up the Windows Subsystem for Linux isn't working. Really, you don't need this. I like it a lot because I'm a Linux user, and it is super powerful, but really we are just trying to get you an easy to use SSH client. Git bash can be used to do this, and you already have it installed, so I think that is the best route.

So I invited you to the TunerPi project, so it if you accept, it should show up under your projects. It is owned by me, so it will always say dmfaber1/TunerPi.

dmfaber1 commented 3 years ago

But yeah, if you follow the instructions on the two raspberrypi.org/documentation links to create the ssh file and the wpa_supplicant.conf file for wifi, you should be all good to ssh into the raspberry pi using git bash.

Hopefully if everything works correctly, when you plug in the raspberry pi, it should automatically connect to wifi and be ready to connect to. May need to give it several minutes after powering on, but you should be able to connect using the default login info. So if you open up git bash:

ssh pi@raspberrypi Then connect with password: raspberry

Then not a lot you need to worry about doing right away yet, but you can do things like list root filesystem:

ls /

Or update all the linux packages in raspbian:

sudo apt update
sudo apt upgrade
faberke611 commented 3 years ago

test, test

On Sun, Jan 24, 2021 at 6:27 PM dmfaber1 notifications@github.com wrote:

But yeah, if you follow the instructions on the two raspberrypi.org/documentation links to create the ssh file and the wpa_supplicant.conf file for wifi, you should be all good to ssh into the raspberry pi using git bash.

Hopefully if everything works correctly, when you plug in the raspberry pi, it should automatically connect to wifi and be ready to connect to. May need to give it several minutes after powering on, but you should be able to connect using the default login info. So if you open up git bash:

ssh pi@raspberrypi Then connect with password: raspberry

Then not a lot you need to worry about doing right away yet, but you can do things like list root filesystem:

ls /

Or update all the linux packages in raspbian:

sudo apt update sudo apt upgrade

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dmfaber1/TunerPi/issues/2#issuecomment-766469270, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPTULUGE2ZNFYSSLA2PRF3S3S3IJANCNFSM4WACE2OA .

faberke611 commented 3 years ago

Looks like I can respond to dmfaber1/TunerPi email in my gmail, or I can add comments in GitHub. I'm guessing the later is better. I'll start just adding comments and questions on GitHub

dmfaber1 commented 3 years ago

I believe I need to finish #3 before running the steps under:

  1. https://www.raspberrypi.org/documentation/remote-access/ssh/
  2. https://www.raspberrypi.org/documentation/configuration/wireless/headless.md

Hopefully if everything works correctly, when you plug in the raspberry pi, it should automatically connect to wifi and be ready to connect to. May need to give it several minutes after powering on, but you should be able to connect using the default login info. So if you open up git bash:

ssh pi@raspberrypi Then connect with password: raspberry

Then not a lot you need to worry about doing right away yet, but you can do things like list root filesystem:

ls /

Or update all the linux packages in raspbian:

sudo apt update sudo apt upgrade

dmfaber1 commented 3 years ago

SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer.

You will need to define a wpa_supplicant.conf file for your particular wireless network. Put this file in the boot folder,

wpa_supplicant.conf file example:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=<Insert 2 letter ISO 3166-1 country code here>

network={ ssid="" psk="" }

faberke611 commented 3 years ago

Work I did on Feb 10

  1. Checked boot dir of uSD, SSH and wpa_supplicant.conf file were not there. Re-created using Notepad, and copied to boot dir. Same thing, no files seen after powering on board. It may be a Notepad problem. Saw this online: “Depending on the OS and editor you are creating this on, the file could have incorrect newlines or the wrong file extension so make sure you use an editor that accounts for this. Linux expects the line feed (LF) newline character.” Tried a different editor. Same problem, files do not show up after inserting uSD into board, powering up, powering down, reinserting SD into laptop, and checking root dir using File Explorer.
  2. Checked for existing SSH key using Git Bash: “ls -al ~/.ssh” listed “id_ed25519” and “id_ed25519.pub” files. Also see these files under C:\”my user”.ssh dir. Contents are different, is it the private and public keys? How are they used? I’ll send you both files.
  3. Checked contents of .bashrc file, contains code for “Auto-launching ssh-agent”. Checked contents of .bash_profile file. I’ll send you both files.
  4. Under “Adding your SSH key to the ssh-agent”, there is a step for Add your SSH private key to the ssh-agent: “ssh-add ~/.ssh/id_ed25519”. Do I do this once or every time I use Git Bash?
  5. Next step is “Add the SSH key to your GitHub account”. I never did these steps before. After completing steps I got a SSH key listed: Laptop , SHA256:FpSZaVUIpTQtOyMnQmxM7J2qxjZgBIhL+PXM0KaguHw , files.zip Added on Feb 10, 2021
  6. Tried running command again: “git push -u origin main”. Before error was: “Permission denied (publickey)”. Now error is “Updates were rejected…” I can read you the full message later. What is the README.md file and the “git push” command used for?
  7. Power up the board again, typed: “ssh pi@raspberrypi”. Got same error message: “Could not resolve hostname raspberrypi: Name or service not known”. I assume this is due to the SSH and wpa_supplicant.conf problem, or some other WiFi issue.
faberke611 commented 3 years ago

files.zip contain the 4 files I Mentioned

dmfaber1 commented 3 years ago

Been trying to think of other ways to move forward, and it may be just easiest to wait until you are back home and I come visit. It is just really hard to diagnose/troubleshoot with the bad internet and no remote desktop. The only other thing I can think of until we get connetion to the raspberry pi is just general python learning. THis looked pretty good: https://python.land/python-tutorial

dmfaber1 commented 3 years ago

Sounds like you have successfully completed this issue!