  We prove -under certain conditions (local-global compatibility and vanishing
of integral cohomology), a generalization of a theorem of Galatius and
Venkatesh. We consider the case of GL(N) over a CM field and we relate the
localization of the penultimate non vanishing cuspidal cohomology group for a
locally symmetric space to the Selmer group of the Tate dual of the adjoint
representation. More precisely we construct a Hecke-equivariant injection from
the divisible group associated to the first fundamental group of a derived
deformation ring to the Selmer group of the twisted dual adjoint motive with
divisible coefficients and we identify its cokernel as its first
Tate-Shafarevich group. We generalize this to Hida families as well.
