A uniform, flexible chain of length $l$, mass $m$, hangs off a frictionless table-top of height greater than $l$. The length of the part of rope hanging off is $x$. Gravity accelerates the part of the rope that is hanging off, so the length of the hanging part increases, i.e. $x$ is a function of time t. Define $y:=x/l$. The kinetic energy of the system is $$T=\frac{1}{2}m\dot x^2=\frac{1}{2}ml^2\dot y^2,$$ and the potential energy is
$$V=-(my)(g)(\frac{1}{2}x)=-\frac{1}{2}mgly^2.$$ Using Lagrange equation
$$\frac{d}{dt}\left( \frac{\partial L}{\partial \dot y}\right)=\frac{\partial L}{\partial y}$$
with $L=T-V$, we obtain $$l^2\ddot y=gly,$$ and hence $$\ddot x=\frac{g}{l}x.$$ Now assume that friction coefficient between the chain and the table top is $\mu\ne0$. Using above result and $F=ma$, it is very easy to show that the new equation of motion is
$$\ddot x=\frac{g}{l}x-\frac{l-x}{l}\mu g.$$ How can we use only Lagrangian method to find the equation of motion so it accommodates the friction?