clemenko / rke_airgap_install

a script/method for air gapping the Rancher Stack with Hauler
50 stars 25 forks source link

Error when tar'ing the hauler/ #22

Closed ertimas closed 2 months ago

ertimas commented 2 months ago

Hello, and thanks for maintaining this repo!

Issue

./haul_all_the_things.sh build seemed to succeed

./haul_all_the_things.sh control failed with an error message about mis-matched sha256 for helm the docker registry portion of the "haul."

I ran the lines from haul_all_the_things.sh:function build() one-by-one, as was feasible. When creating the tarfile saw this error repeatedly

image

Suggested fix

Lock the contents of the /opt/hauler to prevent changes during creation of the tar. Update https://github.com/clemenko/rke_airgap_install/blob/main/hauler_all_the_things.sh#L192 to instead be something like:

DIR=/opt/hauler
lock="/run/$(basename ${DIR}_dir).lock"
exec {fd}<>"$lock" && flock -x $fd
pushd $DIR
tar -I zstd -cf /opt/hauler_airgap_$(date '+%m_%d_%y').zst $(ls) > /dev/null 2>&1
popd
flock --unlock $fd

I'm happy to submit a PR if it's helpful!

clemenko commented 2 months ago

Hello. I have never seen that before. Was anything else potentially writing to the directory? Do you have macfee running? Can we din into why this happening to you?

ertimas commented 2 months ago

Thank you for the prompt reply.

VM

Thoughts

No McAffee running. fapolicyd is disabled, and really the only thing that was configured before launching into this.

stat on the files was showing access, but not modification while tar was running. It was weird, and I'm still failing to understand what's happening.

clemenko commented 2 months ago

I just ran it on oracle 8.10 and did not see the error. Can you build a new vm and test again?

ertimas commented 2 months ago

I'm not seeing it on my new VM. Very strange, glad it's gone, and thanks for your time.

clemenko commented 2 months ago

Oh cool. Feel free to open another ticket if you find any more issues.