I saw this exception: -
tar: .: Cannot utime: Operation not permitted
tar: Exiting with failure status due to previous errors
earlier when expanding a TAR file ( DB2 9.7 as a matter of fact ) into the /tmp directory of my Ubuntu 10.10 boxen: -
cd /tmp
tar xvf /media/LenovoExternal/Products/DB297/db297linux32.tar
Googling about the exception is actually telling me that TAR cannot update the access and modification times of the files within the archive.
I was running this as a non-root user.
You can guess the rest ...
When I checked the permissions of /tmp, I saw: -
drwxrwxrwt 19 root root 4096 2011-01-04 18:22 tmp/
which suggests, to my simple mind, that I have all the right permissions, although the directory is owned by root.
Needless to say, when I ran the command "as root": -
cd /tmp
sudo tar xvf /media/LenovoExternal/Products/DB297/db297linux32.tar
all was well.
I reproduced this in my home directory: -
mkdir ~/foo
chown root:root ~/foo
chmod a+w ~/foo
cd ~/foo
tar xvf /media/LenovoExternal/Products/DB297/db297linux32.tar
This suggests to me that, despite the global RWX permissions: -
drwxrwxrwx 6 root root 4096 2011-01-04 18:34 foo/
the TAR command barfs if it's asked to update the utime of files within a directory that the user does not own.
Interesting, que ?
Geeking in technology since 1985, with IBM Development, focused upon Docker and Kubernetes on the IBM Z LinuxONE platform In the words of Dr Cathy Ryan, "If you don't write it down, it never happened". To paraphrase one of my clients, "Every day is a school day". I do, I learn, I share. The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions. Remember, YMMV https://infosec.exchange/@davehay
Subscribe to:
Post Comments (Atom)
Note to self - use kubectl to query images in a pod or deployment
In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...
-
Why oh why do I forget this ? Running this command : - ldapsearch -h ad2012.uk.ibm.com -p 389 -D CN=bpmbind,CN=Users,DC=uk,DC=ibm,DC=com -w...
-
Error "ldap_sasl_interactive_bind_s: Unknown authentication method (-6)" on a LDAPSearch command ...Whilst building my mega Connections / Domino / Portal / Quickr / Sametime / WCM environment recently, I was using the LDAPSearch command tha...
-
Whilst building a new "vanilla" Kubernetes 1.25.4 cluster, I'd started the kubelet service via: - systemctl start kubelet.se...
7 comments:
You mentioned it can not updated the times "within the archive" ... whats the permissions on the archive? ie does your user or group have write permissions to the file, or only read?
@Jeremy - sorry, my comment was poorly phrased. What I was trying to say was, as far as I can gather, the TAR command is trying to update the times on the directory into which I'm extracting the archive.
Setting a+w permissions to the archive itself ( which my user/group owns ) made no difference.
Changing the ownership of the directory into which I'm extracting "fixed" the problem.
Therefore, it's my assumption that TAR is trying to write something to the directory in terms of access/modification date/time, and is unable to do so because my user does not own the directory ( although it does have global rwx permissions to it ).
Clear as mud :-)
seems like whenever I hit an error - your blog is on page 1 of google results :)
thanks for documenting it all - it is very helpful
The -m option to tar removes the problem. File dates will be wrong though.
Thank you. This helped me resolve the issue.
I just faced the same problem and fixed it by using a temp-dir for unpacking in the following mini-script:
cd /tmp
rm -rf .unpack
mkdir .unpack
tar -C .unpack -xf mytar.tar
mv .unpack/.* .unpack/* .
rm -rf .unpack
Since the new directory that is untared-to will belong to the current user, tar does not complaint about missing permissions for utime. Moving the files afterwards preserves mtime without needing extra permissions.
@Markus - excellent, many thanks for sharing
Post a Comment