Page 1 of 1

Need help with the tar command

Posted: Mon Jan 03, 2022 8:19 pm
by jca
I got errors while untaring the symlink archive for the NeoGeo arcade.
I copied NeoGeo-MVS_2021-12-28.tar to /media/usb0 where my games directory resides, sshed into MISTer and typed the following:
cd /media/usb0
tar -xvf *.tar
A bunch of symlinks were untared but it ended up with:
tar: games/mame: Cannot change ownership to uid 1000, gid 40: Operation not permitted
tar: games/mame: Cannot change mode to rwxr-sr-x: Operation not permitted
tar: games: Cannot change ownership to uid 1000, gid 40: Operation not permitted
tar: games: Cannot change mode to rwxr-sr-x: Operation not permitted
tar: Exiting with failure status due to previous errors

Questions:
Were all the symlinks untared? To check for it would be a hell of a job.
How is it possible to avoid such errors? My Linux is rusty.

Re: Need help with the tar command

Posted: Mon Jan 03, 2022 8:38 pm
by lagerfeldt
Have you tried adding "--no-same-owner" to the command?

tar -xvf *.tar --no-same-owner

I assume you're running as root.

Re: Need help with the tar command

Posted: Mon Jan 03, 2022 9:16 pm
by gibs
try with sudo:

sudo tar -xvf *.tar

Re: Need help with the tar command

Posted: Mon Jan 03, 2022 9:17 pm
by Bas
These errors happen because the ExFAT filesystem doesn't know what to do with file ownership or permissions (the 'mode' references you're seeing). They're perfectly harmless in this context.

Re: Need help with the tar command

Posted: Mon Jan 03, 2022 10:56 pm
by jca
Thanks to all.
@lagerfeldt: good to know this option.
@gibs: I was running as root so did not think sudo would help and did not try.
@Bas: correct with ExFAT, I don't know why I did not think it was the cause of the error. I knew it was harmless, just curious if everything was untared and to avoid it in the future. I guess no option would prevent the errors.
As I got 2 errors I guess they are related to the directories (games and mame) and not the symlinks themselves.

Edit:
As I got 2 sets of errors after the symlinks have been untared I guess they are related to the directories (games and mame) and not the symlinks themselves. So I shouldn't have wondered if all the symlinks had been untared or not.