Deformations of Calabi-Yau manifolds

The answer in general is no. Nakamura has constructed here (pp.90, 96-99, solvmanifolds of type III-(3b)) an example of a compact complex (non-Kähler) manifold $M$ with $TM$ holomorphically trivial (so in particular $K_M$ is holomorphically trivial) which has arbitrarily small deformations $M_t$ with negative Kodaira dimension.

On the other hand, if $M$ is compact Kähler with $K_M$ holomorphically trivial, then its sufficiently small deformations $M_t$ are Kähler (Kodaira-Spencer) and still have $K_{M_t}$ holomorphically trivial. Indeed, we have $c_1(K_{M_t})=0$ in $H^2(M_t,\mathbb{Z})$ (a topological condition), so by the Calabi-Yau theorem they admit Ricci-flat Kähler metrics $g_t$. On the other hand $\dim H^0(M_t,K_{M_t})=h^{n,0}(M_t)$ is locally constant hence equal to $1$, so you have a nontrivial holomorphic section $\Omega_t$ of $K_{M_t}$. A Bochner formula gives $\Delta_{g_t}|\Omega_t|^2_{g_t}=|\nabla \Omega_t|^2_{g_t},$ which can be integrated on $M_t$ to see that $\Omega_t$ is parallel with respect to $g_t$, hence it must be nowhere vanishing. This gives you a holomorphic trivialization of $K_{M_t}$.

Prompted by Piotr Achinger's comment below, let me also note the following generalization. If $M$ is compact complex with Hodge-de Rham (aka Frölicher) spectral sequence degenerating at $E_1$ (this is true for all compact Kähler manifolds), and with $K_M$ holomorphically trivial, then its sufficiently small deformations $M_t$ also have spectral sequence degenerating at $E_1$ (again by Kodaira-Spencer), and $K_{M_t}$ holomorphically trivial. Indeed, it is well-known that the degeneration at $E_1$ is equivalent to the equality $$b_k(M)=\sum_{p+q=k}h^{p,q}(M),$$ for all $k$, so in particular the Hodge numbers $h^{p,q}(M_t)$ are locally constant. As above, you get a nontrivial holomorphic section $\Omega_t$ of $K_{M_t}$. Now we don't have Ricci-flat Kähler metrics anymore, but by Proposition 1.6 and 1.1 of this paper, we can find Hermitian metrics $g_t$ on $M_t$ whose first Chern form (i.e. Chern-Ricci curvature) vanishes, and then the Bochner formula goes through essentially as before ($\nabla$ now being the Chern connection of $g_t$), see Lemma 2.1 in that paper.


The answer is yes (in char. 0). Indeed, it suffices to show that for an infinitesimal deformation $\mathcal{X}$ of $X$ over an artinian algebra $A$, the cohomology $H^0(\mathcal{X}, \omega_{\mathcal{X}/A})$ is locally free with formation commuting with base change. But this is a Hodge cohomology group, and the required assertion follows from results of Deligne.

See p. 15-16 in these notes from a course by Daniel Litt.