2. Given that all terms of the sequence $\left\{a_{n}\right\}$ are positive, and the sum of the first $n$ terms $S_{n}$ satisfies $6 S_{n}=a_{n}^{2}+3 a_{n}+2$. If $a_{2}$, $a_{4}$, and $a_{9}$ form a geometric sequence, then the general term of the sequence $\left\{a_{n}\right\}$ is $a_{n}=$ $\qquad$
$2.3 n-2$
When $n=1$, we have
$6 a_{1}=a_{1}^{2}+3 a_{1}+2 \Rightarrow a_{1}=1$ or $a_{1}=2$.
When $n \geqslant 2$,
$$
\begin{array}{l}
6 S_{n}=a_{n}^{2}+3 a_{n}+2, \\
6 S_{n-1}=a_{n-1}^{2}+3 a_{n-1}+2,
\end{array}
$$
(1) - (2) gives
$$
\begin{array}{l}
\left(a_{n}+a_{n-1}\right)\left(a_{n}-a_{n-1}-3\right)=0 . \\
\because a_{n}>0, \therefore a_{n}-a_{n-1}=3 .
\end{array}
$$

When $a_{1}=1$, $a_{n}=1+3(n-1)=3 n-2$ satisfies $a_{4}^{2}$ $=a_{2} \cdot a_{9}$;
When $a_{1}=2$, $a_{n}=2+3(n-1)=3 n-1$ does not satisfy
$$
\begin{aligned}
a_{4}^{2}= & a_{2} \cdot a_{9} . \\
& \therefore a_{n}=3 n-2 .
\end{aligned}
$$