  We show that the periods of the holomorphic Eisenstein series of level 1,
parallel weight 2, on a Hilbert modular surface are not rational, even up to
scaling. This is deduced from a study of the mixed Hodge structure on the
cohomology of the Hilbert modular surface, where we find extension classes
related to the units of the real quadratic field. We prove similar results for
Hilbert modular varieties of all dimensions, and produce extensions of Galois
representations in \'etale cohomology. The key point is to study the
restriction of the canonical extension of the Hodge bundle to the boundary of a
smooth toroidal compactification.
