With the aim of getting a better physical insight in linear regimes in gyrotron, a new linear model was developed. This model is based on a spectral approach for solving the self-consistent system of equations describing the wave-particle interaction in the cavity of a gyrotron oscillator. Taking into account the walllosses self-consistently and including the main system inhomogeneities in the cavity geometry and in the magnetic field, the model is appropriate to consider real system parameters. The main advantage of the spectral approach, compared to a time-dependent approach, is the possibility to describe all the stable and unstable modes, respectively with negative and positive growth rate. This permits to reveal the existence of a new set of eigenmodes, in addition to the usual eigenmodes issued from cold-cavity modes. The proposed model can be used for studying other instabilities such as for instance backward waves potentially excited in gyrotron beam tunnels.