tar: Exiting with failure status due to previous errors

I got this error while restoring my backup of the rootfs:

I had done:

tar -jxvvf /home/droidzone/documents/rootfs.tar.bz2

Since I was using the verbose option -vv, I couldnt notice what the error mesage was.

I tried the ignore error option with:

tar -ignore-command-error -ignore-failed-read -jxvvf /home/droidzone/documents/rootfs.tar.bz2

But the error happened again.

Removing the verbose option showed the error:

[email protected]:/# tar -ignore-command-error -ignore-failed-read -jxf /home/droidzone/documents/rootfs.tar.bz2 
tar: dev/pts/2: Cannot mknod: Operation not permitted
tar: dev/pts/0: Cannot mknod: File exists
tar: dev/pts/1: Cannot mknod: File exists
tar: dev/pts/ptmx: Cannot mknod: File exists

So if you have block devices and try to restore to them, this error can happen. And it’s in most cases safe to ignore.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Basic usage of tar command

The basic usage is:

To create a non-compressed archive file:

tar -cvvf [filename.tar] [what to compress]

To create a gzipped archive (compressed):

tar -zcvvf [filename.tar.gz] [what to compress]

.tar.gz is often abbreviated as .tgz

To create a bzipped archive (compressed, even smaller):

tar -zcvvf [filename.tar.bz2] [what to compress]

.tar.bz2 is often abbreviated as .tbz2

An non compressed tar file can be converted to a .tar.bz2 by:

bzip2 [filename.tar]

It creates a file filename.tar.bz2 in the same folder


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Tar – compress, excluding certain folders or files

Use the –exclude option. You can use it multiple times.

Eg:

[[email protected]] ~/temp/adt/adt-bundle-linux-x86/sdk/platform-tools $l
total 37828
-rw-rw---- 1 droidzone droidzone   467531 Nov  9 21:53 NOTICE.txt
-rwxrwx--- 1 droidzone droidzone  1117360 Nov  9 21:52 aapt
-rwxrwx--- 1 droidzone droidzone  1226659 Nov  9 21:52 adb
-rw------- 1 droidzone droidzone 10131302 Nov 28 15:06 adbtools.tbz2
-rwxrwx--- 1 droidzone droidzone   269818 Nov  9 21:52 aidl
drwxrwx--- 2 droidzone droidzone     4096 Nov  9 21:53 api
-rwxrwx--- 1 droidzone droidzone   439993 Nov  9 21:52 dexdump
-rwxrwxr-x 1 droidzone droidzone     2603 Nov  9 21:52 dx
-rwxrwx--- 1 droidzone droidzone   176294 Nov  9 21:52 fastboot
drwxrwx--- 2 droidzone droidzone     4096 Nov  9 21:52 lib
-rwxrwx--- 1 droidzone droidzone 24867587 Nov  9 21:52 llvm-rs-cc
drwxrwx--- 4 droidzone droidzone     4096 Nov  9 21:52 renderscript
-rw-rw---- 1 droidzone droidzone       33 Nov  9 21:52 source.properties

[[email protected]] ~/temp/adt/adt-bundle-linux-x86/sdk/platform-tools $tar -jcvvf adbtools.tbz2 * --exclude=renderscript --exclude=lib --exclude=api
-rw-rw---- droidzone/droidzone 467531 2012-11-09 21:53 NOTICE.txt
-rwxrwx--- droidzone/droidzone 1117360 2012-11-09 21:52 aapt
-rwxrwx--- droidzone/droidzone 1226659 2012-11-09 21:52 adb
-rwxrwx--- droidzone/droidzone  269818 2012-11-09 21:52 aidl
-rwxrwx--- droidzone/droidzone  439993 2012-11-09 21:52 dexdump
-rwxrwxr-x droidzone/droidzone    2603 2012-11-09 21:52 dx
-rwxrwx--- droidzone/droidzone  176294 2012-11-09 21:52 fastboot
-rwxrwx--- droidzone/droidzone 24867587 2012-11-09 21:52 llvm-rs-cc
-rw-rw---- droidzone/droidzone       33 2012-11-09 21:52 source.properties

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.