Disconnect all terminals from both batteries, let them sit for 6+ hours, check their voltages. Ideally they'd be identical. This seems unlikely to be a culprit but electrical issues are a bizarro nightmare and this is awfully cheap and easy to check.
Try wiring the solenoid direct to a 12V source, i.e., not thru the harness or connector, and perform this running test again. A bad wire/ground somewhere in the harness could cause intermittent voltage loss at the solenoid and allow it to close for no apparent reason. This is much more likely a culprit than a bad battery. It wouldn't hurt to pull the solenoid and lube it up as well to ensure it can actuate consistently (or maybe it's always lubed with diesel?). If your solenoid actuates consistently, and fully, and a direct 12V source is applied and the truck still dies, that's not the culprit.