North American Aveos have an additional safety feature called the Brake Transaxle Shift Interlock. This is what keeps you from shifting out of park unless your foot is on the brake and also what prevents you from removing the key from the ignition unless the transmission is in park (to prevent you from locking the steering wheel while you're moving).
There is a GM service bulletin on the problem (#070730007) that applies to 2004 - 2006 Aveos.
The actual part that fails is the BTSI Solenoid - p/n 96858794 - the price is under $50. The name is a bit of a misnomer because there are actually two separate components attached to a single connector. One component is the solenoid. It retracts when the brake pedal is pressed allowing you to move the shift lever out of "Park". The other component is a switch that senses when the lever is in Park - and releases the ignition lock allowing you to get the key out. The switch is held in place by some plastic tabs. These tabs break and allow the switch to be pushed out of its place - so it becomes intermittent at sensing the lever in park.
Replacing it isn't hard - but good luck trying to find any reference to the solenoid in the manual. It is shown in the electrical diagrams (page 2-52) and there is a picture of the connector - but no instructions for removing and replacing. The instructions for removing the console are also lacking in detail. Here is the missing info.
You may get some extra clearance by removing the shift knob. This may not be needed, but I did it on mine. To remove the shift knob, rotate the silver ring on the bottom of the knob (it seems to me it is reverse thread) about a half turn. Then, when it loosens, pull up on the knob.
There are three screws holding the console in place - two on each side near the front and one under the coin dish at the rear (remove a plastic tab to get to it).
Pull up on the park brake. Remove the leatherette cover - it unclips and slides over the shift lever (if you've removed the knob). This exposes the adjustment nut. You will probably have to back off the brake to get the console over the lever. Count the threads showing before you back it off - so you can restore it to the safe setting when you put things back together. Don't forget - or you won't have a park brake!! Back the nut off until it allows the brake handle to go almost vertical. Now lift the console off the shift assembly and set it aside. You will have to reach under and unclip the wire that connects to the cigar lighter power jack. There is a tab you squeeze to unlock it.
There are four bolts that hold the shift assembly to the floor. Remove them. Carefully lift the shift assembly off the floor and lay it on its left side. This will expose the screws that hold the solenoid in place. Remove them and lift the old solenoid off the shift assembly. Put the new solenoid in place and screw it in place.
Turn the shift lever onto the other side. You will need to partly remove the black shift bezel (the part that surrounds the lever) in order to get the old switch out of its hole. The bezel is held in place with metal clips. Very carefully pull the bezel back about 1/2". That should give enough clearance to pull the switch out. If the tabs are broken it will come out easily. If not - you may have to slide a blade alongside to retract the switch. Put the new one in its place.
I haven't given details, but make sure the cables and wires are routed as they were. Mine had a tie wrap that held the wires in place.
Then basically put it all back together as you took it apart.
Make sure that you reset the brake adjuster to its original position.
Hopefully this is helpful to someone else.