Need help with the tar command

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Need help with the tar command

Unread post 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.
User avatar
lagerfeldt
Posts: 170
Joined: Mon Jan 03, 2022 8:32 pm
Location: Denmark
Has thanked: 33 times
Been thanked: 85 times
Contact:

Re: Need help with the tar command

Unread post 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.
gibs
Posts: 66
Joined: Sun May 09, 2021 11:04 pm
Has thanked: 8 times
Been thanked: 14 times

Re: Need help with the tar command

Unread post by gibs »

try with sudo:

sudo tar -xvf *.tar
Bas
Top Contributor
Posts: 606
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 77 times
Been thanked: 302 times

Re: Need help with the tar command

Unread post 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.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: Need help with the tar command

Unread post 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.
Post Reply