-
Preheat oven to 350ºF with rack in middle.
-
Pulse onions in 3 batches in a food processor until very coarsely chopped (there may be a few large pieces remaining), transferring to a bowl. Repeat with shallots, then garlic.
-
Heat oil in a deep 12-inch heavy nonstick skillet over high heat until it shimmers, then sauté onions, shallots, and garlic (stir often) until golden and browned in spots, 25 to 30 minutes.
-
Grind fenugreek seeds in grinder or with mortar and pestle. Add to onion mixture along with remaining ingredients, 1 Tbsp salt, and 1 tsp pepper and stir until combined.
-
Transfer to a parchment-paper-lined large 4-sided sheet pan and spread as thinly and evenly as possible. Bake, stirring occasionally with a skewer to separate onions, until well browned and barely moist, 1 to 1 1/4 hours.