When is $SL(n,R) \rightarrow SL(n,R/q)$ surjective?

A sort of universal example: Let $R$ be the polynomial ring $\mathbb Z[x_{11},x_{12},x_{21},x_{22}]$ and let $q$ be the ideal generated by $x_{11}x_{22}-x_{12}x_{21}-1$. The obvious element of $SL_2(R/q)$ does not come from $SL_2(R)$. You can see this by comparing with the example of the ring $\mathbb R[u,v]$ and the ideal generated by $u^2+v^2-1$, using the ring map taking $(x_{11},x_{12},x_{21},x_{22})$ to $(u,v,-v,u)$. If the resulting matrix came from an element of $SL_2(\mathbb R[u,v]$), then topologically the corresponding map from the circle in $\mathbb R^2$ defined by $u^2+v^2=1$ to $SL_2(\mathbb R)$ would extend to a continuous map $\mathbb R^2\to SL_2(\mathbb R)$, which it doesn't. This example persists to $SL_n$ for $n>2$.


The following example relates to the second part of the question while echoing back the example $R = \mathbb{Z}[X, Y]$ and $q = (X^2 + Y^2 - 1)$ discussed above: Let $k$ be a finite field and let $q$ be any ideal of $R = k[X, Y]$, then the natural map $SL_n(R) \rightarrow SL_n(R/q)$ is surjective for all $n \ge 2$.

This is Theorem 1.7.(2) of "On the groups $SL_2(\mathbb{Z}[x])$ and $SL_2(k[x,y])$" by F. Grunewald, J. Mennicke and L. Vaserstein, 1994 (MR1276133).

In the spirit of the requirements of the first part of the question, I would ask whether $2$ is the smallest Krull dimension we can get for a ring $R$ generated by finitely many elements as a $\mathbb{Z}$-algebra and for which surjectivity of the reduction of matrix coefficients modulo $q$ fails for some ideal $q \subset R$.

The case of $\mathbb{Z}[X]$ is somehow settled by Theorem 1.7.(1) of the same paper: for $R = \mathbb{Z}[X]$, the image of $SL_n(R)$ in $SL_n(R/q)$ is of finite index for every $n \ge 2$. In some sense, it is optimal since F. Grunewald et al. have a recipe to build quotients of $\mathbb{Z}[X]$ with non-trivial $SK_1$ (see Proposition 1.9 of the same paper and this MO post) whereas $SK_1(\mathbb{Z}[X]) = 1$.

As for the general part of the question, the group $SK_0(q)$ (see Definition II.2.6 and Exercise III.2.1 of C. Weible's K-book) is the natural obstruction to the surjectivity of coefficients reduction modulo $q$. You may argue that's kind of tautological though.

Addendum I: T. Goodwillie's example originates from Example 13.5 of "Introduction to algebraic $K$-theory" by J. Milnor, 1971 (MR0349811). To some extent, it is also discussed in "Serre's problem on projective modules" by T. Y. Lam, 2006 (MR2235330), see in particular Proposition I.8.12 and Remark I.8.14.

Addendum II: It follows from Corollary 8.3 of "Stable range in commutative rings" (1967) by D. Estes and J. Ohm that the natural map $SL_n(R) \rightarrow SL_n(R/q)$ is surjective for every ideal $q$ and every $n \ge 2$ if the stable rank of $R$ is at most $2$. (This settles my question above on the minimal Krull dimension of a counter-example since $\text{sr}(R) \le \dim_{Krull}(R) + 1$ by Bass stable range theorem). Theorem 8.8 of the same article gives a surjectivity criterion for $R$ a ring of univariate polynomials over a principal ideal ring.