If your solution is not a null geodesic then it is wrong for a massless particle.
The reason you go astray is that Lagrangian you give in (1) is incorrect for massless particles. The general action for a particle (massive or massless) is:
$$ S = -\frac{1}{2} \int \mathrm{d}\xi\ \left( \sigma(\xi) \left(\frac{\mathrm{d}X}{\mathrm{d}\xi}\right)^2 + \frac{m^2}{\sigma(\xi)}\right), $$
where $\xi$ is an arbitrary worldline parameter and $\sigma(\xi)$ an auxiliary variable that must be eliminated by its equation of motion. Also note the notation
$$ \left(\frac{\mathrm{d}X}{\mathrm{d}\xi}\right)^2\equiv \pm g_{\mu\nu} \frac{\mathrm{d}X^\mu}{\mathrm{d}\xi}\frac{\mathrm{d}X^\nu}{\mathrm{d}\xi}, $$
modulo your metric sign convention (I haven't checked which one is right for your convention). Check that for $m\neq 0$ this action reduces to the usual action for a massive particle. For the massless case however, you get
$$ S = -\frac{1}{2} \int \mathrm{d}\xi\ \sigma(\xi) \left(\frac{\mathrm{d}X}{\mathrm{d}\xi}\right)^2. $$
The equation of motion for $\sigma$ gives the constraint
$$ \left(\frac{\mathrm{d}X}{\mathrm{d}\xi}\right)^2 = 0, $$
for a null geodesic. This is necessary and consistent for massless particles, as you know.
The equation of motion for $X^\mu$ is (EDIT: Oops, I forgot a term here. Note that $g_{\mu\nu}$ depends on $X$ so a term involving $\partial_\rho g_{\mu\nu}$ comes into the variation. Try working it out for yourself. I'll fix the following equations up later):
$$ \frac{\mathrm{d}}{\mathrm{d}\xi}\left(\sigma g_{\mu\nu}\frac{\mathrm{d}X^{\mu}}{\mathrm{d}\xi}\right)=0, $$
but you can change the parameter $\xi\to\lambda$ so that $\sigma \frac{\mathrm{d}}{\mathrm{d}\xi} = \frac{\mathrm{d}}{\mathrm{d}\lambda}$, so the equation of motion simplifies to
$$ \frac{\mathrm{d}}{\mathrm{d}\lambda}\left(g_{\mu\nu}\frac{\mathrm{d}X^{\mu}}{\mathrm{d}\lambda}\right)=0, $$
which you should be able to solve to get something satisfying the null constraint.