Violin pegs will loosen over time. This is an unavoidable occurrence caused by humidity or pegs giving into the tension caused by the violin strings. As humidity drops, the pegs will shrink, creating loose pegs. Additionally, if the violin has not been tuned in a while, the pegs can begin to loosen from use. However, do not read these signs as the pegs needing to be replaced. Instead, there are temporary solutions that can keep the pegs in place for a rehearsal or performance.
Dampen a paper towel with rubbing alcohol. Remove the pegs from the violin. On a work surface far from the violin, rub the peg with paper towels. This will remove any oil or lubricant from the pegs. Keep the alcohol away from the violin, as it remove the varnish from the violin. Put the pegs back into the violin. Repeat again if the pegs are still loose.
Rub the sidewalk chalk with a knife to create some chalk dust. Sprinkle a pinch of the dust on the peg and peg box. Unlike chalkboard chalk, sidewalk chalk doesn't contain oils that can damage the violin.
Add a pinch of powdered rosin to the peg to lightly coat it. Do not add too much or the residue can build up in the peg hole.
Make an appointment with a professional. These fixes are temporary and a professional should be sought to avoid damaging the violin.
Do not push the peg down into the peg box, as too much pressure can cause the peg box to break.