Random SD card initialization fails at boot

Hi there.
Im using an Arduino Mega and an Ethernet shield v1. In the shield I use both the network and SD card capabiltiies

Right after powerup, first thing I do is initialize the sdcard. 9/10 times I get things going on perfectly.
But then, suddenly, one SD initialization fails.

This happens, with basically same “rate”, in 3 complete prototypes I have assembled.

With this I mean it’s not related to wiring or using a wrong CS pin or so. It works, I read my config file from the card, write logs to the card, but then suddenly, once a day, it fails to initilize during startup

I’ve tried the usual startup:
SD.begin(4);

I’ve tried this first:
Sd2Card card;
if (card.init(SPI_FULL_SPEED, 4))
if (card.init(SPI_HALF_SPEED, 4))
if (card.init(SPI_QUARTER_SPEED, 4))

I found that function to (I guess) low-level initialize the card at different SPI speeds so I try to use the highest one that wors…I basically get the same result, it randomly fails to init

Any hint on what it could be?

Thanks
PD: It’s not the ethernet shield, tried v2 and got the exact same result

I've tried this first: Sd2Card card; if (card.init(SPI_FULL_SPEED, 4)) if (card.init(SPI_HALF_SPEED, 4)) if (card.init(SPI_QUARTER_SPEED, 4))

So, if the card reader successfully initializes at full speed, initialize it at half speed. Only if that works, initialize it at one quarter speed.

I fail to see why you want to do that.

Basically trying to initialize it at the maximum speed it would want to take. If "it doesn't like" full speed, try at half, if not, try quarter. If everything goes ok, I'd prefer it to be working at full speed.

TBH when it fails, it fails at any speed, and when it works, it works right away at full speed so that code doesn's really help much...

But it was doing exactly the same when I had a single initilization statement at full (or half) speed.

Currently I still get some random boot-ups when the SD fails to start and it's jeopardizing my project as I have all the config data in my SD, so it starts working with default parameters which are not valid...

Any help will be appreciated

Thanks