All you need to do is go into the preferences/input and set the mapping type to retropad and then find the P1 map all buttons and fire that up. It should read your pad on first try.
Additionally you may get more specialized help for your needs at the retroarch forums since you aren’t actually using RetroPie so any issues relating to actual linux people here may be less prepared to deal with.