By default Inkscape uses the "visual" bounding box of objects to snap
them. I.e. a simple line can snap to either of it's borders (and
hence shift a bit from the grid). To make Inkscape precise you can
switch to "geometric" bounding box snapping (Inkscape preferences >
Tools > Selector > Bounding box to use). This way only nodes will
snap and the line will be perfectly on grid.
...
Oooops sorry, the option in only available in the development
versions of Inkscape (the more recent versions). You could probably
get one for Linux quit easily though I don't really know how and where.
Anyway, in 0.45, you have the options directly in the document
snapping properties: Document preferences > Snap. There select: Snap
nodes to grid/guides and deselect Snap bounding boxes to grid/guides.
Then select "Always snap" in both.
... but I can find neither of the settings mentioned.
Any ideas?