I'm working with the asymptotic behavior of square-free integers and have already proven that if $f$ is an arithmetic function with $F(n) := \sum\limits_{d \mid n}f(d)$, then
\begin{align*}
\sum\limits_{n \leq x}F(n)=x\sum\limits_{d \leq x}\frac{f(d)}{d}+O\left(\sum\limits_{d \leq x}|f(d)|\right).
\end{align*}
I'm trying to use this fact to prove that $\sum\limits_{n \leq x}\frac{\phi(n)}{n}=\frac{6}{\pi^2}x+O(\log{x})$.
I know that $\phi=\mu \ast E$ where $\ast$ is the usual Dirichlet convolution $f \ast g(n)=\sum\limits_{d \mid n}f(d)g\left(\frac{n}{d}\right)$, so I can write
\begin{align*}
\phi(n)=\sum\limits_{d \mid n}\mu(d)E\left(\frac{n}{d}\right)=\sum\limits_{d \mid n}\mu(d)\frac{n}{d}=n\sum\limits_{d \mid n}\frac{\mu(d)}{d},
\end{align*}
leading me to conclude that $\frac{\phi(n)}{n}=\sum\limits_{d \mid n}\frac{\mu(d)}{d}$.
Using my identity from before, I can write
\begin{align*}
\sum\limits_{n \leq x}\frac{\phi(n)}{n}&=x\sum\limits_{d \leq x}\frac{\frac{\mu(d)}{d}}{d}+O\left(\sum\limits_{d \leq x}\left|\frac{\mu(d)}{d}\right|\right) \\
&=x\sum\limits_{d \leq x}\frac{\mu(d)}{d^2}+O\left(\sum\limits_{d \leq x}\left|\frac{\mu(d)}{d}\right|\right) \\
&=x\sum\limits_{d \geq 1}\frac{\mu(d)}{d^2}-x\sum\limits_{d \geq x}\frac{\mu(d)}{d^2}+O\left(\sum\limits_{d \leq x}\left|\frac{\mu(d)}{d}\right|\right) \\
&=x\cdot\frac{1}{\zeta(2)}-x\sum\limits_{d \geq x}\frac{\mu(d)}{d^2}+O\left(\sum\limits_{d \leq x}\left|\frac{\mu(d)}{d}\right|\right) \\
&=\frac{6}{\pi^2}x-x\sum\limits_{d \geq x}\frac{\mu(d)}{d^2}+O\left(\sum\limits_{d \leq x}\left|\frac{\mu(d)}{d}\right|\right).
\end{align*}
My problem is that I don't understand how to get the $O(\log{x})$. Can someone walk me through this?
First $\displaystyle\sum_{d\leqslant x}\left|\frac{\mu(d)}{d}\right|\leqslant\sum_{d\leqslant x}\frac{1}{d}=\mathcal{O}(\log x)$. On the other hand, $$ \left|\sum_{d>x}\frac{\mu(d)}{d^2}\right|\leqslant\sum_{d>x}\frac{1}{d^2}=\mathcal{O}\left(\int_x^{+\infty}\frac{dt}{t^2}\right)=\mathcal{O}\left(\frac{1}{x}\right) $$ which finally leads to $\sum_{n\leqslant x}\frac{\varphi(n)}{n}=\frac{6}{\pi^2}x+\mathcal{O}(\log x)$.