Subject: [alpine-devel] How to rescue your edge box after the mkinitfs incident

From: Natanael Copa <[email-masked]>
Date: Thu, 27 Mar 2014 19:45:22 +0000

Hi,

It turned out that there were 2 bugs in mkinitfs, one that only
affected uClibc and one that affected both uClibc and musl.

I thought I'd write how I rescued my laptop after it became unbootable
after upgrading to broken mkinitfs.

* Boot a rescue boot USB, with alpine v2.7

* Configure network (run setup-alpine -q for setting up the live
  session)

* make sure you have new apk-tools:

    apk upgrade -U

* I have my root on lvm so:
  
    apk add lvm2
    lvchange -a y vg0

* mount the root:

    mount -t /dev/vg0/lv_root /mnt

* mount the boot partition. In my case this is /dev/sda2:

    mount /dev/sda2 /mnt/boot

* I had to mount /mnt/proc otherwise readlink -f wouldn't work in the
  chroot. Not sure if it is needed for uclibc:

    mount --bind /proc /mnt/proc

* Upgrade the broken system:

    apk upgrade -U --root /mnt

* Verify that you get mkinitfs-2.6.0-r3 and check that mkinitfs trigger
  don't give any cpio errors.

* cleanup and reboot.

    umount /mnt/proc /mnt/boot /mnt
    reboot

That should be it.

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Jeff Pohlmeyer <[email-masked]>
Date: Tue, 1 Apr 2014 13:27:04 -0500

> affected uClibc and one that affected both uClibc and musl.

I'm running into another problem, or maybe it's just something wrong with
my installation...

The mkinitfs upgrade creates /etc/mkinitfs/features.d/base.files.apk-new
This new file no longer lists the dependent libraries in /lib/.

I assume this is because "lddtree" is supposed to take care of that now.

But, "lddtree -l /bin/busybox" lists "/lib/ld-uClibc.so.0.9.32" which is
a symbolic link, but for some reason it never resolves that link, so the
newly-created initramfs fails to run /init because of the missing loader.

Seems to me like that is a bug in lddtree, but maybe the "base.files.apk-new"
should still at least list "/lib/ld-uClibc-0.9.33.2.so" until the issue can
be resolved?

 - Jeff

---

---

From: Natanael Copa <[email-masked]>
Date: Wed, 2 Apr 2014 09:02:04 +0200

On Tue, 1 Apr 2014 13:27:04 -0500

> newly-created initramfs fails to run /init because of the missing loader.

Whoops. this is definitively a bug in lddtree yes. It doesnt resolve
the interp symlinks.

I think I fixed it with lddtree-1.25-r1.

> should still at least list "/lib/ld-uClibc-0.9.33.2.so" until the issue can

You could manually add the file to base.file as a temp workaround. (but
it should be fixed now)

Sorry about this.

-nc

---

---

From: Jeff Pohlmeyer <[email-masked]>
Date: Wed, 2 Apr 2014 08:15:47 -0500

On Apr 2, 2014, Natanael Copa wrote:
> On Tue, 1 Apr 2014 Jeff Pohlmeyer wrote:

>> Seems to me like that is a bug in lddtree

> the interp symlinks. I think I fixed it with lddtree-1.25-r1.

Ah, I didn't realize you were maintaining this. I glanced at the lddtree file
and saw the word "gentoo" so I assumed it was an upstream project.

> You could manually add the file to base.file as a temp workaround.

Yes, that's what I did.

> but it should be fixed now

1.25-r1 looks good from here.

> Sorry about this.

No problem, just another "learning experience" for me ;-)

Thanks for the quick fix!

- Jeff

---

---

From: Natanael Copa <[email-masked]>
Date: Wed, 2 Apr 2014 15:32:47 +0200

On Wed, 2 Apr 2014 08:15:47 -0500

> and saw the word "gentoo" so I assumed it was an upstream project.

I have forked it since gentoo upstream was not interested in shell version:
https://bugs.gentoo.org/show_bug.cgi?id=504954

I ported it to posix shell and fixed some issues, like resolving
symlinks. I missed the interp.

...

> Thanks for the quick fix!

Thanks for you patience :)

---

---

From: Alan Messias <[email-masked]>
Date: Thu, 27 Mar 2014 16:46:52 -0300

Is it useful to be placed on wiki.al.o ?

-- 
Atenciosamente,
Alan Messias Cordeiro

*The nice thing about standards is that there are so many to choose from.
And if you really don't like all the standards you just have to wait
another year until the one arises you are looking for. -- A. Tanenbaum,
"Introduction to Computer Networks"*

---

From: Natanael Copa <[email-masked]>
Date: Fri, 28 Mar 2014 17:05:07 +0100

On Thu, 27 Mar 2014 16:46:52 -0300

> Is it useful to be placed on wiki.al.o ?

I first though no, because this should not happen, but on the other
hand, it might be useful to have a general rescue wiki page.

-nc

---