V 14
ode = Cos[y[x]]*y'[x] == 1
ic = y[0] == 2
DSolve[{ode, ic}, y[x], x]
Anything can be done to help DSolve obtain the following solution?
Hand solution
\begin{align*} \cos\left( y\right) y^{\prime} & =1\\ y\left( 0\right) & =2 \end{align*} Integrating gives \begin{align} \int\cos ydy & =\int dx\nonumber\\ \sin y & =x+c \tag{1}% \end{align} Solving for $c$ first from (1) gives $$ \sin\left( 2\right) =c $$ Substituting this into (1) gives \begin{equation} \sin y=x+\sin\left( 2\right) \tag{2} \end{equation} Now we can solve for $y$ using trig relation $\sin\left( y\right) =A\Longrightarrow$ $y=-\arcsin\left( A\right) +2\pi n+\pi$. Using this on the above to solve for $y$ gives $$ y=-\arcsin\left( x+\sin\left( 2\right) \right) +2n\pi+\pi $$ For $n$ integer. Trying $n=0$ gives $$ y=-\arcsin\left( x+\sin\left( 2\right) \right) +\pi $$ Which satisfies the ode and the IC.
Verification
mysol = y -> Function[{x}, -ArcSin[x + Sin[2]] + Pi]
{ode, ic} /. mysol
DSolve[y'[x] == Sec[y[x]], y[x], x]
gives the same warning message that you obtained, but it also gives the solution. I am using version 13.3.1 for MacOS. $\endgroup$