If a sub-C*-algebra does not contain the unit, is it contained in a proper ideal?
Suppose that $R$ and $S$ are unital rings and that $S$ is a subring of $R$ in the weak sense where the multiplicative identities $1_R$ and $1_S$ are not assumed to be the same. In fact, assume $1_R \neq 1_S$. Then $S$ cannot contain any invertible element of $R$ (if $s \in S$ and there is an $r \in R$ with $sr=1_R$ then $0 = (1_Rs - 1_Ss)r = 1_R - 1_S$ so $1_R = 1_S$). This is sort of reminiscent of the statement a proper ideal in $R$ cannot contain any invertible element of $R$. My question is whether there must actually be some proper ideal $I$ of $R$ with $S \subset I \subset R$. Actually, I would like to ask the question with the rings replaced by C*-algebras - but a positive answer to the corresponding question about rings would clearly suffice.
Let $A$ and $B$ be unital C*-algebras with $B$ a sub-C*-algebra of $A$, but suppose $1_A \neq 1_B$. Does it necessarily follow that there is a proper closed ideal $I$ of $A$ satisfying $B \subset I \subset A$?
I'm also curious what happens if the assumption that $B$ is unital is dropped. In this case I'm not even certain whether $B$ can contain an invertible element of $A$.
Let $B$ be a non-unital sub-C*-algebra of a unital C*-algebra $A$. Can $B$ contain an invertible element of $A$? If not, does there have to exist a proper closed ideal $I$ of $A$ with $B \subset I \subset A$?
For the first question, consider $2$-by-$2$ matrices, and the subalgebra of matrices of the form $\begin{bmatrix}a&0\\0&0\end{bmatrix}$.
For the first part of the second question, the answer is no. Suppose that $a\in B$ is invertible in $A$. Then by spectral permanence, $a^{-1}$ is in $B+\mathbb C\cdot 1_A$, so $a^{-1}=b+\lambda\cdot 1_A$ for some $b\in B$ and $\lambda\in \mathbb C$. This means that $1_A=a^{-1}a=ba+\lambda a\in B$.
(Note that this is special of C*-algebras, and is not true for general algebras or even general Banach algebras. Consider $X\in X\cdot\mathbb C[X]\subset \mathbb C[X,X^{-1}]$. For a similar Banach algebra example, consider $f(z)=z$ in the algebra $C(\mathbb T)$ of continuous functions on the unit circle in $\mathbb C$, which is invertible in $C(\mathbb T)$ but not in the closed subalgebra generated by $f$.)
For the second part of the second question, the answer is no. Let $C_0(\mathbb R)$ act on $L^2(\mathbb R)$ as multiplication operators. Then it forms a nonunital C*-subalgebra of $B(L^2(\mathbb R))$ contained in no proper ideal (its nonzero elements are noncompact).