WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: extract and recompress core.gz  (Read 312 times)

Offline uekawi

  • Newbie
  • *
  • Posts: 5
extract and recompress core.gz
« on: May 11, 2020, 09:49:54 AM »
Hi guys,

since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"?

When i extract those files, edit stuff, and try to recompress it with: "find | cpio -o -H newc | gzip -2 > core.gz"

i get this message: "cpio: File ./core.gz grew, 524288 new bytes not copied 48622 blocks"

And when i look inside the core.gz archive that was just created, the file inside is of type "unknown" instead of "CPIO archive".

The OS is Ubuntu 20.04 64bit

Thanks

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 7934
Re: extract and recompress core.gz
« Reply #1 on: May 11, 2020, 10:05:24 AM »
Hi uekawi
Welcome to the forum.
... since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"? ...

Try this:
To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/initrd.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327

An alternative link to the Wiki is:
https://www.linuxsecrets.com/tinycorelinux-wiki/wiki:start.html

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10240
Re: extract and recompress core.gz
« Reply #2 on: May 11, 2020, 10:11:02 AM »
Your error sounds like you tried to put the new core.gz inside itself.
The only barriers that can stop you are the ones you create yourself.

Offline uekawi

  • Newbie
  • *
  • Posts: 5
Re: extract and recompress core.gz
« Reply #3 on: May 11, 2020, 10:26:12 AM »
Hi uekawi
Welcome to the forum.
... since the wiki on this site is down, can you please tell me, how do i extract and recompress "core.gz"? ...

Try this:
To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/initrd.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327

An alternative link to the Wiki is:
https://www.linuxsecrets.com/tinycorelinux-wiki/wiki:start.html

thanks @rich and @curuga for your quick reply :D

i did exactly what @rich said and ended up with this command: "find . | cpio -o -H newc | gzip > /tmp/test/core.gz" and i was in the dir "/tmp/tempdir" logged in as root (did sudo su at the beginning).

Now i don't get the error message anymore, thank you for that, but the file inside the newly created core.gz file is now of type "program crash data".



thank you in advance for your help :)

EDIT: typo

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 7934
Re: extract and recompress core.gz
« Reply #4 on: May 11, 2020, 10:34:51 AM »
Hi uekawi
... Now i don't get the error message anymore, thank you for that, but the file inside the newly created core.gz file is now of type "program crash data". ...
No, it's not. You're file manager is probably just looking at the file name and assuming it's a compressed core dump file.
« Last Edit: May 13, 2020, 05:42:11 AM by Rich »

Offline uekawi

  • Newbie
  • *
  • Posts: 5
Re: extract and recompress core.gz
« Reply #5 on: May 13, 2020, 12:25:49 AM »
Thank you so much guys!

i just managed to get it to work.

It indeed was not broken, but i opened the original and the new core.gz in the same file manager and it displayed in two different ways, so i was a little confused.

But as @Rich pointed out, it didn't matter. I repacked it to the iso and everything except the touch screen went fine!