How to Make It
Preheat the oven to 350°. Line a rimmed baking sheet with parchment paper.
In a food processor, working in 3 batches, coarsely chop the onions; transfer to a medium bowl. Repeat with the shallots and garlic, chopping them separately and adding them to the onions.
In a large deep nonstick skillet, heat the oil until shimmering. Add the onion mixture and cook over high heat, stirring often, until golden and browned in spots, 25 to 30 minutes.
In a spice mill or mortar, grind the fenugreek seeds. Stir into the onion mixture along with the remaining ingredients. Scrape onto the prepared baking sheet and spread in a thin even layer. Bake, stirring occasionally with a skewer to separate the onions, for about 1 hour, until deeply browned and barely moist.