Remove giblets and neck, if present, from chicken; rinse chicken inside and out; pat dry with paper towels.
Place onion and garlic in cavity; squeeze juice from lemon and set aside; add lemon to cavity.
Tie legs together with kitchen string; tuck wings under back; brush all over with oil; sprinkle with thyme, rosemary, salt and pepper; place, breast side up, on rack in roasting pan; roast, uncovered; in 325F (160C) oven for 1 ½ hours.
Roast, basting occasionally with pan juices, until juices run clear when thigh is pierced and meat thermometer inserted in thigh registers 185F (85C), about 1 ½ hours; transfer chicken to platter and tent with foil; let stand for 10 minutes before carving.
Skim fat from pan juices; sprinkle flour over juices; cook over medium-high heat, whisking, for 1 minute; gradually pour in chicken stock and reserved lemon juice, whisking until smooth and thickened, about 3 minutes; pour into warmed gravy boat.
Cut string holding legs together; discard onion, lemon and garlic; using kitchen scissors, cut chicken into 2 breast and 2 leg portions; cut each breast in half diagonally; cut through each leg at joint to separate into drumsticks and thighs; serve with gravy.