According to Callen,
There exist particular states (called equilibrium states) of simple systems that, macroscopically, are characterized completely by the internal energy $U$, the volume $V$, and the mole numbers $N_1$, $N_2$, ..., $N_r$ of the chemical components.
Note that these parameters are all extensive parameters. (Other terms, always extensive parameters such as the electric dipole moment, can be added for more complex systems.)
The single, all-encompassing problem of thermodynamics is the determination of the equilibrium state the eventually results after the removal of internal constraints in a closed, composite system...
The values assumed by the extensive parameters in the absence of an internal constraint
are those that maximize the entropy over the manifold of constrained equilibrium states.
Callen formalizes this as the entropy maximization principle $$\left(\frac{\partial S}{\partial X}\right)_U=0\mathrm{~and~}\left(\frac{\partial^2S}{\partial X^2}\right)_U<0,$$
which can be shown to imply free energy minimization. Note again that $X$ is an extensive parameter.
Thus, it appears that the flaw in your statement "At equilibrium, the system should minimize the free energy which required the second derivative to be positive." is not appending "of any extensive variable" after "second derivative". Temperature is not an extensive variable.