Truck starts but will not remain running. Also it has violent shake. Cranks right back up and then shuts right back off.
Maybe the ECM doesn’t realize the engine is turning, so it won’t provide spark. In some vehicles spark is automatic during cranking (key in “start”), but after the key is returned to “on” the computer may need to be seeing crankshaft rotation pulses from the crank angle sensor. That’d be my first guess, problem with the cranks angle sensor signal. Could also cause severe misfiring, producing shaking.
If the engine is misfiring, that will generally turn on the check engine light and store a diagnostic code. A completely missing crank angle sensor signal however will often not turn on the check engine light. Is check engine light on? Any stored diagnostic codes?
If that was the case it wouldn’t run for any amount of time.
Fuel pressure drops out? Ignition related component is heating up and cutting out?
When it stalls does it abruptly stop running or does it stumble a bit and then slow down and stop running? Does giving it throttle have any effect?
5.7? Jumped timing chain?