Confucius was warmly received in Lu, but there is no indication that he was given a responsible position.
Little is known about his last years, although this would have been a logical time for him to work on the many texts and documents he supposedly gathered on his journey. Much of his time was devoted to teaching, and he seems to have remained more or less distant from political affairs.
This was an unhappy period for Confucius. His only son died about this time; his favorite disciple, Yen Hui, died the very year of his return to Lu; and in 480 B.C.E. another disciple, Tzu-lu, was killed in battle. Confucius felt all of these losses deeply, and his sadness and frustration must have been intensified by the realization that his political ideas had found no support among the rulers of his own state. Confucius died in 479 B.C.E. His disciples conducted his funeral and observed a mourning period for him.
After further wanderings, he eventually returned to Lu at age 67. Although he was welcomed there and chose to remain, he was not offered public office again, nor did he seek it. Instead he spent the rest of his years teaching and, finally, writing. He died at 72.