$ file vmlinuz
vmlinuz: Linux kernel x86 boot executable bzImage, version 4.14.244 (root@d0ea4514eda5) #1 SMP Thu Aug 31 01:23:02 PDT 2023, RO-rootFS, swap_dev 0x3, Normal VGA
I try to use extract_vmlinux
and vmlinux-to-elf
to extract vmlinux from vmlinuz, but report the following errors respectively:
$ vmlinux-to-elf vmlinuz vmlinux
Traceback (most recent call last):
File "/usr/local/bin/vmlinux-to-elf", line 63, in
ElfSymbolizer(
File "/usr/local/lib/python3.8/dist-packages/vmlinux_to_elf/elf_symbolizer.py", line 44, in __init__
kallsyms_finder = KallsymsFinder(file_contents, bit_size)
File "/usr/local/lib/python3.8/dist-packages/vmlinux_to_elf/kallsyms_finder.py", line 177, in __init__
self.find_linux_kernel_version()
File "/usr/local/lib/python3.8/dist-packages/vmlinux_to_elf/kallsyms_finder.py", line 225, in find_linux_kernel_version
raise ValueError('No version string found in this kernel')
ValueError: No version string found in this kernel
$ ./extract_vmlinux vmlinuz > vmlinux
extract_vmlinux: Cannot find vmlinux.
Then I tried manual extraction:
$ od -A d -t x1 vmlinuz | grep 'fd 37 7a 58 5a 00'
3254032 fd 37 7a 58 5a 00 44 65 73 74 69 6e 61 74 69 6f
$ dd if=vmlinuz of=vmlinuz_unxz bs=1 skip=3254032
116928+0 records in
116928+0 records out
116928 bytes (117 kB, 114 KiB) copied, 1.10249 s, 106 kB/s
$ xz -d vmlinuz_unxz
xz: vmlinuz_unxz: Compressed data is corrupt
What went wrong? Any suggestions to extract vmlinux?
Thank you!
Asked by pipik
(1 rep)
Aug 16, 2024, 02:14 AM
Last activity: Aug 16, 2024, 02:31 AM
Last activity: Aug 16, 2024, 02:31 AM