gcc-avr Package not found

I mistakenly interrupted a board package update in Arduino (through VNC on Raspberry Pi 2) and now I am having problems compiling a sketch to the board.

I attempted to uninstall arduino, then reinstall without success. I also attempted to reinstall gcc-avr and arduino-core.

Error message:
Arduino: 1.8.5 (Linux), Board: "Arduino Nano, ATmega328P"

fork/exec /home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++: no such file or directory
Error compiling for board Arduino Nano.

Additionally, gcc-avr and arduino-core were both set to update manually?

Are there any suggestions on a correction?

To fix this you will need to take some drastic action. Be aware this is somewhat advanced and will remove any boards you have installed via Boards Manager:

  • Click the link on the line following File > Preferences > More preferences can be edited directly in the file. This will open the Arduino15 (or similar name depending on OS) folder.
  • Delete all files and folders under the Arduino15 folder except for preferences.txt. Please be very careful when deleting things from your computer. When in doubt, back up!
  • Restart the Arduino IDE

Verify that you can now use your board before reinstalling any packages via Boards Manager.

vvarrior:
Additionally, gcc-avr and arduino-core were both set to update manually?

I have no clue what that means. I know of avr-gcc but I've never heard of "gcc-avr". I've never heard of "arduino-core". Are you talking about Debian package names? If you provide more details we can probably answer the question.

After a few hours of searching and experimenting, I found the solution. Completely removing and reinstalling Arduino did not fix the problem. I found the solution at avr-g++": file does not exist · Issue #5691 · arduino/Arduino · GitHub

"I fixed it with Board Manager -> Install "Arduino AVR Boards (1.6.19)" -> Restart Arduino IDE -> Install Arduino AVR Boards 1.6.20+ again. Then it worked. Simply reinstalling the complete Arduino IDE didnt help. I first tried to install 1.8.4 over 1.8.3 and still had the same issue."

My Board Manager reported 1.6.20 was installed. Upgrading to 1.6.21 from 1.6.20 did not fix the problem. I had to install 1.6.19, restart Arduino IDE (as mentioned above) then upgraded to 1.6.21.

pert:
I have no clue what that means. I know of avr-gcc but I've never heard of "gcc-avr". I've never heard of "arduino-core". Are you talking about Debian package names? If you provide more details we can probably answer the question.

Yes, debian package names.

Doing all that reinstall nonsense seemed to fix that issue. Now I'm getting this problem:
Error opening serial port '/dev/ttyAMA0'. Try consulting the documentation at Arduino Playground - HomePage

I'm going to "consult the documentation".

Don't ever use Debian packages with Arduino. The Arduino IDE you get from package managers are extremely outdated and modified by some random who doesn't know what they're doing. They will cause you nothing but headaches. You must always download the official Arduino IDE from:

The Arduino IDE and Arduino hardware packages bundle their own toolchains. So whatever avr-gcc you install via the package manager makes no difference for the Arduino IDE because it won't ever be used.

I will remember that for new installs. Thanks for the information.

Not just for new installs. If you're currently using an Arduino IDE you installed via apt-get then you need to remove it and install the official Arduino IDE.