Rinse the navy beans in a colander and add the rinsed beans to the Instant Pot along with 2 teaspoons of salt, 1 tablespoon of vegetable oil, garlic cloves and bay leaves.
Fill the Instant Pot with water to cover the beans - to the 2/3 level. Set the Instant Pot to cook for 30 minutes at High Pressure using either the Beans setting or Manual.
If you don't have cooked onions available, simmer finely chopped onions in a pan on low heat in vegetable oil for about half an hour while the beans cook.
Allow the Instant Pot to drop pressure naturally - this will take about an hour.
Remove the bay leaves and discard.
Remove the garlic cloves and mash them with a fork.
Drain the beans in a colander.
Return half the beans to the Instant Pot and mash with a potato masher or fork.
Combine the unmashed beans, cooked onions, mashed garlic, and salt to taste with the mashed beans.
Serve hot.