Is the headliner attached to a firm backing like cardboard or is it bonded to a foam type of backing that is disintegrating?
If there is some sort of decomposing lining, the headliner needs to be removed and the falling apart stuff vacuumed off.
Otherwise, I've good luck reattaching headliner using 3M #77 spray adhesive. However, the problem is that when the headliner hangs down it sags and stretches and it is pretty much impossible to simply stick it back up and you not have ripples. I've done a fair amount of mechanic work in an area that flooded regularly for a while, and what seemed to happen was an interior would get wet and then direct sunlight would turn the inside into a steam bath, and the headliners would separate and sag. For older vehicles I found a quick and simple fix was to use #77 and replace the nozzle with one that you could fit a tube on, then remove the dome light fixture and spray it around using that opening, let it dry and stick it together. However, as I mentioned you would pretty much always get wrinkles. To attach a headliner in what I consider to be a professional manner it really needs to be removed and done on a workbench IMHO, but if you just want it stuck back up and look nice when given just a quick glance then the spray adhesive approach works acceptably IMHO.