TITLE: Principal bundles over groups
QUESTION [7 upvotes]: If we have an extension of groups (say algebraic groups or group schemes) $1\to F\to P\to G\to 1$, then $P$ is a principal $F$-bundle over $G$ (is it locally trivial?). How about going in the opposite direction?

Question. Let $F$ and $G$ be groups. $P$ be a principal $F$-bundle over $G$. When does $P$ carry a structure of a group such that $1\to F\to P\to G\to 1$ is an extension? How to classify all such structures?

Sounds connected with (some kind of) group cohomology of $G$ with coefficients in $F$, but I can't figure out what exactly this group is. Does the obstruction lie in some $H^2$, which is only a pointed set, and if it vanishes then the structures are classified by the corresponding $H^1$? The fact that the principal bundle itself corresponds to an element of $H^1(G, F)$ confuses me a bit.
For example, if $G$ is an abelian variety and $L$ a line bundle on it, then we have the corresponding principal $F=\mathbb G_m$-bundle $P_L$. When does it give an extension of $G$ by $\mathbb G_m$?

REPLY [2 votes]: The 'some $H^2$' which classifies group extensions you are thinking of is actually cohomology $H^1$ with values in the crossed module $F \to Aut(F)$ (or the 2-group corresponding to it). 
See http://ncatlab.org/nlab/show/nonabelian+group+cohomology for more details.