The penetration of magnetic flux into a superconductor above the lower critical field does not necessarily happen in a regular way. It is found that under particular conditions, a chaotic penetration in form of magnetic avalanches occurs. These avalanches are closely related to the so-called thermomagnetic instability, which identifies local heating due to flux line movement as the origin of the effect. In case of MgB2 thin films, these avalanches are found only below T=10K and are suppressed by a covering metallic layer with high thermal conductivity and sufficient thickness. These avalanches are observed in the case of partly gold covered MgB2 films by the magneto-optical Faraday effect. The investigation of avalanches propagating into a gold-covered region revealed a change of the propagation direction depending on the incident angle of these avalanches.