WARNING: The following contains spoilers for Drowning Sorrows in Raging Fire Episode 8, "Truth," now streaming on Funimation.
Long before he became a demon, Sheng Lingyuan and Aluojin's relationship was akin to brothers in Drowning Sorrows in Raging Fire. When they grew older, they fought side by side against the fiends. In fact, they become so close that Sheng Lingyuan is the one to give Aluojin's mask when usually, this would be given to him by a member of his family.
However, a conspiracy hatched by one of Sheng Lingyuan and Aluojin's closest confidants tears the two of them apart. They once stood on the same side and fought for the same cause until their ideals clashed. Sheng Lingyuan was a brother to Aluojin, but he was also a commander and an emperor, and that often means their goals do not align.
Sheng Lingyuan and Aluojin could not have been more different from one another. Sheng Lingyuan is calm and quiet whereas Aluojin is childish, mischievous and often wears his heart on his sleeve. They butted heads often, with Aluojin frequently bearing the punishment for trying to trick the young emperor. It wasn't until Sheng Lingyuan saved him from some fiends that the two eventually became friends. That same day, Sheng Lingyuan made a vow to Aluojin: he would bury all the graveless dead and bring peace to the damned. It's a promise that Sheng Lingyuan later fulfills, albeit not in the way he thought he would.
After the tragic murder of his father, Aluojin launches a war against the fiends with Sheng Lingyuan's help. However, despite how successfully Aluojin and Sheng Lingyuan work together as a team, Aluojin still faces discrimination for who he is. The other soldiers think he should treat the emperor with more deference, and Aluojin still insists on massacring the fiends despite their surrender. It's here that Sheng Lingyuan makes his mistake. He orders them to lie to protect Aluojin, but he also couldn't in good faith allow the half-fiends to die, so he set up an agency to protect them. What ultimately tears the two of them apart isn't a war or Sheng Lingyuan's betrayal -- it's his affection for Aluojin.
Aluojin's thirst for revenge forces the Wu people to retreat and barricade themselves in the ancestral hall, but this turns out to be a trap. Sheng Lingyuan's teacher Dan Li, who heavily disapproved of his student's friendship with Aluojin, killed his father to incite his fury against the fiends. Once the war was won, Dan Li saw no use for Aluojin and the Wu people anymore and launched a genocide against them.
By the time Sheng Lingyuan arrives, it's already too late. Cursed, Aluojin is now a demon, and the Wu people have all been killed and turned into mutated butterflies. Sheng Lingyuan has to choose between the Wu people, who are essentially dead, or the humans. In the end, it's not a choice -- he kills everyone, including Aluojin.
Sheng Lingyuan had broken his promise to Aluojin when he killed him the first time. None of the Wu people who died ever got buried, as shown in Episode 5. Although he had 'released' Aluojin from being a demon by killing him, he had done so with a cursed blade -- the dagger that Aluojin had given him which is imbued with a protection spell. Aluojin, embittered by Sheng Lingyuan's betrayal of his trust and friendship, never ended up finding peace.
Ultimately, it's hard to say whether or not Sheng Lingyuan brought peace to Aluojin when he kills him for the second time because Sheng Lingyuan does lay him to rest in the coffin. Although their second reunion is not as emotionally fraught or as fuelled by pain and misunderstandings as the first, Aluojin is still a vengeful spirit. In his dying moments, his rage dissipates enough that he sounds simply exhausted as he accuses Sheng Lingyuan of picking the humans over him once again.
Subjects often say their blessings to their emperor, wishing for their sovereign to live a long life, but Aluojin's final words add a cruel twist. They sound less like a blessing and more like a curse as he prays that Sheng Lingyuan will live an immortal life -- one in which he will never know peace and will have to live forever with his guilt and sins.