When do we illustrate inertial forces on inertial frames of reference?

I came across two practice questions wherein an object was attached to an accelerating vehicle, yet only one of these cases required an inertial force to be illustrated on the object's free body diagram. The two situations are as follows:

1) A bead is attached to the roof of an accelerating train by a rope, maintaining an angle to the ceiling. This free body diagram consists of an inertial force opposite to the train's acceleration, which cancels out the bead's horizontal tension from the rope.

2) A box is situated on the bed of a truck, and both systems accelerate together. I initially thought that the free body diagram of the box should contain an inertial force opposite to the truck's acceleration - but this doesn't seem to the be case. If we assume the presence of an inertial force and apply F=ma to the box's horizontal forces, we get:

(static friction force between box + truck) - ma = ma --> frictional force = 2ma.

This is obviously wrong.

What makes these two examples different? And consequently, why is an inertial force necessary for 1), but not 2)?

$$friction - ma = 0$$,
giving the frictional force to be '$$ma$$'. The acceleration of the box in the equation would be '$$0$$' and not '$$ma$$' as the analysis is in the truck's frame of reference in which the box remains stationary.