It could me any number of things. It could be, like you said, frustration or boredom (lack of excercise.) It could also be him seeking a cooler spot to lie down, or the entertainment of digging in something funky smelling. Some breeds are more prone to it than others, like dachshunds and terrier mixes who were initially bred to seek out buried vermin.
Unfortunately, scolding him doesn't do you much good unless you catch him in the act. If every time you go outside to see him he is a dirty mess and you yell, he's just going to associate you with coming out back and getting mad. It's another story if you catch him face first in your plants. And, usually he does it when you're not looking.
You can try burying a run of chicken wire in his hole, just under the surface. When he goes to dig, he hits the chicken wire and cannot go any farther. This can also be done with bricks or rocks in the holes, but sometimes make him just start digging somewhere else. Or, chili powder in the soil to make things unpleasant. Try providing him a cooler spot to lie down, or a kiddie pool full of a dirt he can dig in. Make it different than the dirt he is digging in (if he's digging soil, use sand, or vice versa.) Bury bones, treats and favorite toys in his new sandbox and encourage him to dig there. There are also chain link dog runs you could set up to contain him away from his favorite spots, or static fences and "traps" that would shock him when he got near the garden, but these are more of a last resort solution.
Unfortunately, scolding him doesn't do you much good unless you catch him in the act. If every time you go outside to see him he is a dirty mess and you yell, he's just going to associate you with coming out back and getting mad. It's another story if you catch him face first in your plants. And, usually he does it when you're not looking.
You can try burying a run of chicken wire in his hole, just under the surface. When he goes to dig, he hits the chicken wire and cannot go any farther. This can also be done with bricks or rocks in the holes, but sometimes make him just start digging somewhere else. Or, chili powder in the soil to make things unpleasant. Try providing him a cooler spot to lie down, or a kiddie pool full of a dirt he can dig in. Make it different than the dirt he is digging in (if he's digging soil, use sand, or vice versa.) Bury bones, treats and favorite toys in his new sandbox and encourage him to dig there. There are also chain link dog runs you could set up to contain him away from his favorite spots, or static fences and "traps" that would shock him when he got near the garden, but these are more of a last resort solution.