  We compute the decay rates and $H$-energy distributions of $B$ mesons into
the final state $H+X$, where $H$ can be any one of the $S$-wave or $P$-wave
charmonia, at next-to-leading order in the strong coupling. We find that a
significant fraction of the observed $J/\psi$, $\psi'$ and $\chi_c$ must be
produced through $c\bar{c}$ pairs in a colour octet state and should therefore
be accompanied by more than one light hadron. At the same time we obtain
stringent constraints on some of the long-distance parameters for colour octet
production.
