Im currently a math masters student. Im doing good and i obtain good grades. Im interested to pursue PHD. At a masters level course i have never been able to solve all exercises which a lecturer has given. This really bothers me and i feel like i need to solve every single exercise problem easily if i want to pursue PHD since these problems in most cases have known solution, hence how i should be able to do research in mathematics if im not able to solve these known problem? My way of thinking might be too black and white in this sense. So my question: people who have completed a phd or a fellow masters student; were you able to solve every single exercise at classes?
No, that's not the only point. There is a plethora of skills you will need to be a successful research mathematician, and technical skill, while very important, is only one of those.
Actually, the opposite of what you say is true. I sometimes see great students, with excellent grades, who do not become good researchers because they are confused. They used to be able to solve all problems, they were the best in the classroom since childhood. But now, suddenly they are aspiring researchers, and they need to tackle problems which they don't know how to solve. However, it may be that nobody in the world does. Maybe they are asking the wrong question. Then they need to let go of that, and be creative. They need to find a different viewpoint, but they are unable, because they cannot accept that, it feels like failure to them. It happens.
P.S.: Let me add two things. The first is that these students who end up dropping out of academic research need not be miserable. More often than not they choose a different professional path and end up being happy, much happier than they would have been in academia. There is no "failure" here.
The second thing is that I was definitely not able to solve 100% of the problems that were handed to me as a master student.
During my undergraduate studies (which was a 5 year combined BSc+MSc program) I aimed to solve as many problems as possible, but I rarely reached full 100% (and rarely anyone did). Some problems are harder, and simply require more time, and sometimes there was simply not enough time to solve them all. Of course, some students might take less time than others, but I would not view this as a relevant indicator whether one should do a PhD or not.
Having completed my PhD a decade ago, I can say about my peers: There is a correlation between having done well in solving many exercise problems, and doing well during a PhD (and in an academic career in general), but it is definitely not the case that those who solved 95% of the problems were doing worse during their PhD than those who managed to solve 99% (or 100%).
The challenges in research are different: You will have harder problems (in general), but also more time to solve them. In my opinion, a key quality you'd need is the willingness to sit with a problem for weeks until you make progress (depending on your field this might take longer or shorter), and the willingness to learn about your field in great depth.