Solving a problem using Newtonian mechanics and D'Alembert principle yI have to solve that problem with two methods (applying Newtonian mechanics and the D'Alembert principle.
The problem consists in two balls inside a spherical cylinder, it consists in determine the minimum value of $M$ making the tube not to knock down (where $M$ is the mass of the cylinder and $m$ the masses of the two spheres).

I have issues with both methods. With Newtonian method, I don't know what influence has $M$ on the problem, because I can choose a reference point in the center of the cylinder and there will be no torque.
With D'Alembert principle, the problem is I have no idea what virtual displacement I have to choose. 
The Newtonian process brings me to this meaningless expression if the normal force acts on the lower right corner.

 A: If there is no friction between any contact surfaces, then the centres of the spheres, the points of contact and the axis of the cylinder will all lie in the same plane. So this is a 2D problem.
The 2 spheres exert horizontal forces on the cylinder at their points of contact with it. These forces are not aligned, so there is a clockwise torque. The cylinder will (potentially) topple about the lower RH corner. The weight of the cylinder exerts an anti-clockwise torque. Balancing these two torques, it should be possible for you to work out what conditions are required for stability.
You can work out the force $F$ which the cylinder exerts on the upper sphere (and the sphere exerts back on the cylinder) by balancing moments of $F$ and the weight $W$ of the upper sphere about the point of contact between the 2 spheres. If all contacts are frictionless the horizontal force exerted on the lower sphere by the cylinder must also equal $F$. These are the only 2 horizontal forces on the 2 spheres, which are in equilibrium, so they must be equal and opposite (but not necessarily aligned).   
For the D'Alembert Principle, any small displacement of the structure (subject to the given constraints) should require no work when the structure is in equilibrium. You could (I think) displace the walls of the cylinder by increasing or decreasing radius R by a small amount. 
A: You have 2 couples countering each other.
One is the cos of the mass of two balls times 2r divided by difference the of their contact points' heights on the wall of the cylinder. And the other is overturning momentum of the cylinder.
Let's call the angle of the line connecting the center of the 2 balls A.
$A= arccos(2(R-r)/2R $.
Therefore the couple reaction of the walls creates is 
$cos(arccos((R-r)/R).m.2r/(2Rr-R^2)    $  
$m.2r((R-r)/R)/(2Rr-R^2)= m.2r(R-r)/(2Rr-R^2)R$     
Hopefully, I got the arithmetics right on my cell phone.
This should be smaller than $M.R$ - which is the overturning moment of the cylinder. 
