Lu Yi passed the
imperial examinations in the
Jinshi () class in 886, during the reign of Emperor Xuānzong's grandson
Emperor Xizong, and later in the year was part of Emperor Xuānzong's procession to Xingyuan (興元, in modern
Hanzhong,
Shaanxi) Later that year, the chancellor
Wei Zhaodu, who also served as the director of the salt and iron monopolies, made Lu a surveyor under him. In 887, another chancellor,
Kong Wei, made Lu a copyeditor (校書郎,
Xiaoshu Lang) for the imperial histories. Soon thereafter, Lu's mother died, and he left governmental service to observe a mourning period for her. In 889, by which time Emperor Xizong had died and been succeeded by his brother
Emperor Zhaozong, Lu was recalled to government service to serve as the sheriff of Lantian County (藍田, in modern
Xi'an,
Shaanxi), but also to serve as a scholar at Hongwen Pavilion (). Thereafter, he was made
Zuo Shiyi (), an advisory official at the examination bureau of government (門下省,
Menxia Sheng), as well as a scholar at Jixian Pavilion (). Soon thereafter, at the request of Liu Pi () the deputy chief imperial censor, Lu was made an imperial censor with the title
Jiancha Yushi (). In 891, he was made an imperial scholar (翰林學士,
Hanlin Xueshi) as well as
Tuntian Yuanwailang (), a low-level official at the ministry of public works (工部,
Gongbu). In 892, he was made
Cibu Langzhong (), a supervisory official at the ministry of rites (禮部,
Libu) and put in charge of drafting edicts. In 893, he was made
Zhongshu Sheren (), a mid-level official at the legislative bureau (中書省,
Zhongshu Sheng). It was said that Lu thought and wrote quickly, and his writings were both well-written and well-reasoned. On an occasion when Emperor Zhaozong wrote a poem and asked the imperial scholars to write responses, Lu wrote one quickly, impressing Emperor Zhaozong, who compared him to Lu Zhi and Wu Tongxuan (), another talented official who served Emperor Dezong. In 894, Lu Yi was made the deputy minister of census (戶部侍郎,
Hubu Shilang). In 895, he was made the deputy minister of defense (兵部侍郎,
Bingbu Shilang); he was also given the honorary title of
Yinqing Guanglu Daifu () and created the Baron of Jiaxing. In 896, he was made the chief imperial scholar (翰林學士承旨,
Hanlin Xueshi Chengzhi), and soon thereafter
Shangshu Zuo Cheng (), one of the secretaries general of the executive bureau (尚書省,
Shangshu Sheng). == First chancellorship ==