Web lists-archives.com

Re: System won't boot anymore after upgrade to jessie




On Thu, Jan 11, 2018 at 01:05:01AM +0100, deloptes wrote:
> Greg Wooledge wrote:
> 
> > Moreover, the simple zcat|cpio -i no longer works with stretch's initrd
> > images.  They're in a different format, and you have to use
> > lsinitramfs or unmkinitramfs to see or extract their contents.
> > 
> > On a jessie system, the zcat|cpio -i may still work (not sure about
> > backported kernels though).
> 
> I just tested it on stretch
> 
> file /boot/initrd.img-4.14.12eko4
> /boot/initrd.img-4.14.12eko4: gzip compressed data, last modified: Tue Jan 
> 9 22:45:46 2018, from Unix
> 
> $ zcat /boot/initrd.img-4.14.12eko4 | cpio -id
> 76825 blocks
> 
> so if it is gzip format it works perfectly - what format do you mean?

Whatever "4.14.12eko4" is, it's not a stretch kernel image.

wooledg:~$ ls /boot
config-3.16.0-4-amd64      initrd.img-4.9.0-4-amd64   System.map-4.9.0-5-amd64
config-4.9.0-4-amd64       initrd.img-4.9.0-5-amd64   vmlinuz-3.16.0-4-amd64
config-4.9.0-5-amd64       lost+found                 vmlinuz-4.9.0-4-amd64
grub                       System.map-3.16.0-4-amd64  vmlinuz-4.9.0-5-amd64
initrd.img-3.16.0-4-amd64  System.map-4.9.0-4-amd64

wooledg:~$ zcat /boot/initrd.img-3.16.0-4-amd64 | cpio -itv | head -3
drwxr-xr-x  10 root     root            0 Apr 10  2017 .
drwxr-xr-x   5 root     root            0 Apr 10  2017 scripts
-rw-r--r--   1 root     root         9187 Apr 17  2016 scripts/functions

wooledg:~$ zcat /boot/initrd.img-4.9.0-5-amd64 | cpio -itv | head -3

gzip: /boot/initrd.img-4.9.0-5-amd64: not in gzip format
cpio: premature end of archive

wooledg:~$ lsinitramfs /boot/initrd.img-4.9.0-5-amd64 | head -3
kernel
kernel/x86
kernel/x86/microcode

wooledg:~$ file /boot/initrd.img-3.16.0-4-amd64 
/boot/initrd.img-3.16.0-4-amd64: gzip compressed data, last modified: Mon Apr 10 14:03:50 2017, from Unix

wooledg:~$ file /boot/initrd.img-4.9.0-5-amd64
/boot/initrd.img-4.9.0-5-amd64: ASCII cpio archive (SVR4 with no CRC)

In fact, I believe the stretch initrd images are sequences of concatenated
cpio archives, some gzipped, some not, possibly with a NUL byte or
something between them.

wooledg:~$ cpio -itv < /boot/initrd.img-4.9.0-5-amd64
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86/microcode
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86/microcode/.enuineIntel.align.0123456789abc
-rw-r--r--   1 root     root        98304 Apr  9  2017 kernel/x86/microcode/GenuineIntel.bin
194 blocks

Whereas, if you use lsinitramfs, you'll see far more content, from
the subsequent cpio archives in the image.  Or, if you manually
string together multiple cpio commands:

wooledg:~$ { cpio -itv; echo XXXXXXX; zcat | cpio -itv | head -3; } < /boot/initrd.img-4.9.0-5-amd64
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86/microcode
drwxr-xr-x   2 root     root            0 Apr  9  2017 kernel/x86/microcode/.enuineIntel.align.0123456789abc
-rw-r--r--   1 root     root        98304 Apr  9  2017 kernel/x86/microcode/GenuineIntel.bin
194 blocks
XXXXXXX
drwxr-xr-x  10 root     root            0 Jan  5 08:00 .
drwxr-xr-x   5 root     root            0 Jan  5 08:00 scripts
-rw-r--r--   1 root     root         9394 Mar  6  2017 scripts/functions

I don't actually know how many cpio archives are concatenated together
in that image.  At least two, obviously, with the first uncompressed
and the second gzipped.