a necessary evil
Meaning: If you say something is a necessary evil, you don't like it but you understand that it has to be accepted sometimes or it has to exist.
- Sandra says money's a necessary evil. She thinks it causes many problems, but she can't imagine how the world could work without it.
- My brother regards exercise as a necessary evil. He hates doing it, but he knows he has to do it if he wants to stay healthy.