0

I'm very new in Rpi community and sure enough had to spent the last 24 hours to figure out how to ssh connect from my MacBook to my Pi3 via an ethernet cable. I'm following the steps in the second method in here for this: http://smirshekari.wikidot.com/rpi

Now when I want to update and install packages required for what I'm planning to do in terminal window in usual Ubuntu format (which I expected to work just fine, but they don't!):

sudo apt-get install gphoto2
sudo apt-get update

I get errors like the one below which I believe it is all because of issues in internet connection. I've tried my best to find a solution for it and tested a few suggested methods that I found online, no success yet. Any comment and/or suggestion on that will be appreciated.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  vim-runtime
Suggested packages:
  ctags vim-doc vim-scripts
The following NEW packages will be installed:
  vim vim-runtime
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,198 kB of archives.
After this operation, 30.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf vim-runtime all 2:8.0.0197-4+deb9u1
  Temporary failure resolving 'mirrordirector.raspbian.org'
Err:2 http://mirrordirector.raspbian.org/raspbian stretch/main armhf vim armhf 2:8.0.0197-4+deb9u1
  Temporary failure resolving 'mirrordirector.raspbian.org'
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/v/vim/vim-runtime_8.0.0197-4+deb9u1_all.deb  Temporary failure resolving 'mirrordirector.raspbian.org'
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/v/vim/vim_8.0.0197-4+deb9u1_armhf.deb  Temporary failure resolving 'mirrordirector.raspbian.org'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Chetan Bhargava
  • 1,264
  • 2
  • 15
  • 29
Rotail
  • 111
  • 4
  • That's a good point. No I did not. How should I do that? On UI I know, but I am not sure how can I connect my Pi3 to internet from my MacBook (connected to Pi3 via ethernet cable). Thanks! – Rotail Jan 28 '18 at 22:45
  • I responded based on the assumption that you have a local network with internet access available to both your rpi and your mac. You will need to connect both your mac and your rpi to the network instead of to each other. – Jonathan Jan 28 '18 at 22:52

3 Answers3

1

Thanks for the replies above with which I could resolve the issue. This error was because my Pi3 was not connected to the internet.

To connect Pi3 to internet, I had to:

sudo raspi-config

and from the main menu there, I could insert the name of my wifi along with its password. It is pretty straightforward and self descriptive in that menu.

Rotail
  • 111
  • 4
0

From the article you linked to, it appears your mac is connected to your rpi for ssh, but I don't think you've connected your rpi to the internet yet.

Based on the above assumption, I think you first need to connect your rpi to a local network that has internet access via the ethernet cable. Before you do this however, you can enable SSH in an easier way following these instructions:

  1. Put the SD card in your laptop (via an SD Reader)
  2. Open the SD Card in your Mac Finder
  3. In the top-level directory of the SD Card, add a file with the specific file name ssh and no extension after it.
  4. Safely remove the SD Card from your Mac and put it in the Rpi again (steps courtesy https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0)

Now, when you boot your rpi it will have SSH enabled. You just need to use your router to find its IP address and you can then SSH directly into it over your local network.

With your RPi on the local network, and your local network having internet, the sudo apt-get update command will successfully download the package lists from the mirror sites.

Jonathan
  • 133
  • 5
0

The link is underwhelming. The Pi will have a Link-local address by default, and there is no point in trying to set another manually.

You can easily connect from OS X with ssh pi@hostname.local (the default hostname is raspberrypi) without knowing the IP Address. See How to set up networking/WiFi for more detail.

You have not said HOW you are trying to connect to the internet - it CANNOT be done through the Mac without interfering with ssh.

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • Thanks for the reply. You are right. `ssh pi@raspberrypi` works just fine. NO need to know the numerical ip. Regarding to connecting to internet, I wanted to do it from my terminal in my MacBook as described above. I'm looking for the best way. – Rotail Jan 29 '18 at 00:27
  • @Rotail You CAN use Internet Connection Sharing to connect the Pi to the internet via the Mac, BUT you will need keyboard/screen (or alternative). You CAN NOT use `ssh` from the Mac at the same time as ICS. – Milliways Jan 29 '18 at 01:25