5. Given the sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=1, a_{2}=2, a_{n+1}-3 a_{n}+2 a_{n-1}=1\left(n \geqslant 2, n \in \mathbf{N}^{*}\right)$, then the general term formula of $\left\{a_{n}\right\}$ is $\qquad$ .
$$
\begin{array}{l}
a_{n+1}-3 a_{n}+2 a_{n-1}=1 \Rightarrow a_{n+1}-a_{n}+1=2\left(a_{n}-a_{n-1}+1\right), \\
\text { Also } a_{2}-a_{1}+1=2 \Rightarrow a_{n+1}-a_{n}+1=2^{n} \Rightarrow a_{n+1}-a_{n}=2^{n}-1 .
\end{array}
$$

Therefore, $a_{n}=a_{1}+\sum_{i=1}^{n-1}\left(a_{i+1}-a_{i}\right)=\sum_{i=1}^{n-1} 2^{i}-n+2=2^{n}-n$.