What should be done in case of the avionics failure?
In the U.S. (other jurisdictions may be similar)...

Avionics are a convenience in VFR day flight. You should be able to fly your airplane by sight picture alone. There are aircraft flying today without any electrical system at all. In a fixed-gear aircraft, none of the equipment required by Part 91.205(b) require electric power. There are standard protocols in place if you have to fly to a destination without electric power. 

If you are not on a flight plan or flight following when you lose electric power, stay clear of Classes A, B, and C airspace as well as the 30 nautical mile mode C veil around Class B airports, and the airspace above Class A, B, and C. Stay or descend below 10,000 feet MSL if possible or 2500 feet AGL when not possible to descend below 10,000 feet MSL. 

If you lost all electric power before communicating your situation and intentions to ATC, you can assume that squawking 7600 on your electric transponder will do no good, either. Find a VFR Class D, E, or G airfield where you can land. Land as soon as practicable. Remember, you can not enter Class D airspace (normally a 4 mile radius from the field) until you have established two-way communications with them. You can, however, circle above the traffic pattern or tower at an altitude outside of the usually 2500 foot AGL ceiling of Class D until you get light gun signals from the tower. Wagging your wings or following their instructions will be your acknowledgement of light gun signals. Two-way communication will then be established.

Remember, an active IFR plan will give you clearance to your declared destination or declared alternate(s) at your ETA. Neither a VFR flight plan nor flight following prior to an expressed clearance will give you clearance into A, B, C or D airspace. 

You should follow this plan of action at any Class D, E, or G airport with an operating control tower. Typically (but not always), a Class E or G airfield will not have an operating control tower. At those airfields, follow the AIM recommendations for entering the traffic pattern for a landing. An overhead flyover well above traffic pattern altitude would be advisable beforehand. Be very cautious of existing traffic. And, make your flight path as predictable to other pilots as possible. Although communication is strongly recommended, it is not required.

If you are flying on an IFR flight plan in IMC, follow the directions of Part 91.185.

If you are flying VFR at night, make it a habit to have the phone numbers of nearby towers, TRACON, and ARTCC in your cell phone. Call them to tell them of your predicament. Declare an emergency via cell phone. Then, use your Part 91.3 PIC authority to request clearance to land at any airport where the runway lights will be lit regardless of airspace or class. ATC can coordinate your clearances, then call an airport official or radio a passing airborne aircraft to turn the light on for you. You won’t be able to do it yourself without an operating radio. And, landing at a dark airport without a landing light will be challenging at best.