kill(all);

A "d" deflection is imposed at B; calculate the deflection at C by resorting to a F fictitious force, and the second Castigliano's theorem.
The structure, due to the imposed displacement at B, is natively once statically indeterminate.
The reaction force exerted at B by the linear actuator is hence parametrically defined as "R", and the structure is reduced to a twice transversely loaded cantilever beam to obtain a statically determinate principal system.

             ___________
               |     |
               |_____|
                 | |          |F
 /   \|        d \_/          V
|    \|======================== C
 \_\ \|A          B           |
CA /              |R         --- f
      A           V
      |
      |YA

      |--s->
      |---- l ----|---- l ----|

Bending moments are assumed positive if the upper fibers are stretched, and evaluated based on the equilibrium of the [0,s] beam segment.

MfAB: CA - YA*s $

MfBC: CA - YA*s + R*(s-l) $

Beam strain energy, derived from the above bending moment expression.

U : expand(
        integrate( MfAB^2/2/E/J, s, 0,  l) +
        integrate( MfBC^2/2/E/J, s, l,2*l)
    );

reaction forces at A may be determined as a function of R and F according to the following equilibrium equations

eqty : +YA-R-F=0$

eqrAz : +CA + YA*0-R*l-F*2*l=0$

prieq_sols : linsolve([eqty,eqrAz],[CA,YA]);

it is NECESSARY to substitute the "YA", "CA" reactions -- the ones proper of the principal structure -- within the strain energy expression BEFORE the application of the Castigliano theorem, otherwise we obtain

[wrong_vtB, wrong_vtC] : [diff(U,R),diff(U,F)];

wrong expressions, those, which are NOT emended by later substituting the principal structure equilibrium solutions

[wrong_vtB, wrong_vtC] : ev([wrong_vtB, wrong_vtC],prieq_sols);

so, we FIRST substitute those solutions within U

U : ev(U,prieq_sols);

or, more compactly

U : expand(U);

then, we apply the second Castigliano's theorem

[vtB, vtC] : [diff(U,R),diff(U,F)];

now we may enforce the imposed deflection at B through the following inhomogeneous kinematic compatibility equation

kinecomp_sols : linsolve(  vtB=d  ,R);

and evaluate the "f" deflection at C

f : expand( ev(vtC,kinecomp_sols) );

thus obtaining a linear function of both d and F.

The fictitious nature of F can be finally made explicit

f : ev (f, F=0);

however, the problem under scrutiny is prone to a further, sneaky error; we might have in fact substituted the expression of R according to the kinematic compatibility equations within U BEFORE applying the Castigliano's theorem.

wrong_U:expand(
    ev(U,kinecomp_sols) 
);

thus obtaining

furtherwrong_f : diff(wrong_U,F);

and

ffurtherwrong_f : ev (furtherwrong_f, F=0);

The fallacy of the above Castigliano's theorem application lies in the fact that -- according to "wrong_U" -- the strain energy is NOT "expressed as a function of a set of generalized loads" alone, as required, but it is also as a function of the "d" displacement.

Such a error is strictly related to the inhomogeneous nature of the kinematic equation imposed; the 

furtherwrong_f;

is in fact the exact displacement at C for the following statically indeterminate structure

                         |F
\|           d=0         V
\|======================== C
\|A         __^__        |
            ///// B     --- f
 |--s->
 |---- l ----|---- l ----|

since the related strain energy expression

expand(
    ev(U,ev(kinecomp_sols,d=0)) 
);

is a function of generalized forces alone.