Actually most people don’t ask why are my pegs slipping, they just say my violin is out of tune and won’t hold a note. There is a myriad of reasons and the violin pegs slipping is usually the culprit. To understand why it happens it’s useful to understand how pegs work.
Pegs have a slightly conical taper to them, this neat design allows them to fit more snugly by pushing them in slightly as you tighten the string. Its not perfect , probably need to move to something like guitar tuners, but hey this is a traditional classical instrument so pegs it is!
The pegs them selves are made of a hardwood, usually ebony so they they don’t wear out and go into the peg box which is maple – also a hard wood but slightly softer. So inevitably though use they start to wear a bit. Wood on wood can get a bit sticky or creaky so they are lubricated with peg paste (or peg dope). Peg past is made from some lubricating and some sticky elements, so they can grip and slide appropriately. A mix of fine clay, rosin and perhaps graphite is in this material. The different makers of peg paste have different combinations and I find using the right one for the climate is important. Peg paste is something replaced yearly with an instruments service.
Home/ teacher solutions can involve some crushed rosin or chalk applied to the pegs – yes it works as a quick fix, but you may end up with stuck pegs.
Over time the wearing of the pegbox takes place , and its an out or round wear, because for the string tension in one direction , meaning the peg develops favourite positions to sit in and may slip to these. The remedy here is to ream the peg box hole slightly to return it to round and shave the peg also if appropriate.
Another thing that happens to pegs /peg box as they wear is the peg sits further in the hole. At some point this is limited by the string that is wound around the hole as it hits the opposite side of the peg box, and so push in as you may the peg will never fit tighter in the box and always slip. this is common on a violin thats been played for some time (years), so on secondhand instruments that have been handed down to the 2nd, 3rd, 4th player its an inevitability. The solution is to drill a new hole in the peg for the string to sit more in the middle of the peg box…no hassle!
One note of caution if your violins pegs are slipping, resist the temptation to push it too hard into the peg box to get it tight. The danger here is you crack the peg box and have a very expensive repair – or in the case of a student violin it will be cheaper to replace it.