How to calculate residual covariance in R

#1
I know it is may be a silly question but I am looking for an answer
if I fitted a linear model

c<- lm (y~ a+ b)

I need to get the residual covariance matrix between traits
how can I do that??
Also,
if I am fiting a mixed model
how do I obtain the residual covariance matrix ??