yeah he awaken his rinnegan before he dies, in this "hole" he only are able to live on with the hashi cells.
he self called him a ghost, thats the reason i think he unlocked the rinnegan and then gave him to nagato, after this he lived in this "hole" and wait for a boy that can take care of his lower parts xD.