On Wed, 2017-08-02 at 21:29 +0200, noone never wrote:
> Please find my answers inline.
Thanks! In particular for...
> [...]
> > The message:
> > Couldn't find DTB in /usr/lib/linux-image-4.9.0-3-marvell or
> > /etc/flash-kernel/dtbs
> > is interesting since the double space in "DTB in" is supposed to
> > contain $dtb_name, i.e. the path to look for, but it doesn't not.
> > Please could you attach the full output of running `sh -x
> > /usr/sbin/flash-kernel`, maybe that will include a clue as to where
> > things have gone astray.
>
> Log is attached
... this.
Looking at uses of dtb in you trace:
$ grep dtb ~/tmp/flash-kernel-log.txt
[...]
+ dtb_name=kirkwood-sheevaplug.dtb
+ '[' -n kirkwood-sheevaplug.dtb ']'
+ echo 'Using DTB: kirkwood-sheevaplug.dtb'
Using DTB: kirkwood-sheevaplug.dtb
So dtb_name is successfully assigned and reported here.
+ handle_dtb
+ '[' xkirkwood-sheevaplug.dtb = x ']'
+ local dtb
+ local dtb_name
But here it is redeclared as a local shadowing the original, but
unassigned.
++ find_dtb_file
++ local dtb
++ case "$dtb_name" in
+++ find /etc/flash-kernel/dtbs -name
++ dtb=
++ dtb=
++ error 'Couldn'\''t find DTB in /usr/lib/linux-image-4.9.0-3-marvell or /etc/flash-kernel/dtbs'
++ echo 'Couldn'\''t find DTB in /usr/lib/linux-image-4.9.0-3-marvell or /etc/flash-kernel/dtbs'
Couldn't find DTB in /usr/lib/linux-image-4.9.0-3-marvell or /etc/flash-kernel/dtbs
and we end up using the blank version here.
I have a suspicious this was introduced by the fix to #836697 in [0]
which seems to have added the shadowing "local dtb_name".
It's a bit naughty but if you edit /usr/share/flash-kernel/functions
and near the top of handle_dtb() change the:
local dtb
local dtb_name
into
local dtb
local dtb_name=$(basename $dtb_name)
and then remove the "dtb_name=$(basename $dtb_name)" from both halves
of the following if statement, does that fix it?
Martin, does that fix seem correct to you?
I think the "local dtb" bit could also move into the else have with the
"dtb=$(find_dtb_file)" as well, but that would be an unrelated change.
This ultimately seems to be down to a difference in the behaviour of
/bin/dash vs /bin/bash, which I suppose is why it has not been widely
seen:
$ cat > t.sh <<EOF
c() {
echo "c.a = \"$a\""
}
b() {
local a
echo "b.a = \"$a\""
}
a() {
local a=foo
echo "a.a = \"$a\""
b
c
}
a
EOF
$ dash t.sh
a.a = "foo"
b.a = "foo"
c.a = "foo"
$ bash t.sh
a.a = "foo"
b.a = ""
c.a = "foo"
I s uppose you have /bin/sh as a link to /bin/bash on your system still.
So an alternative workaround would probably be "sudo dpkg-reconfigure
dash" and make dash the system shell.
Ian.
[0] https://anonscm.debian.org/cgit/d-i/flash-kernel.git/commit/?id=0eb2ec06735e4a5712796836f7061190dfcf3a37
sheeva:~# dpkg-reconfigure dash Removing 'diversion of /bin/sh to /bin/sh.distrib by bash' Adding 'diversion of /bin/sh to /bin/sh.distrib by dash' Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash' Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash' sheeva:~# sh -x /usr/sbin/flash-kernel > flash-kernel-log.txt^C sheeva:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: gnupg-curl imagemagick-common libapt-inst1.5 libapt-pkg4.12 libasprintf0c2 libasyncns0 libilmbase6 libjasper1 libjpeg8 liblensfun-data liblensfun0 liblinear1 libopenexr6 libpth20 libpulse0 libsctp1 libuuid-perl libxapian22 linux-image-3.2.0-4-kirkwood lksctp-tools lockfile-progs python-debianbts python-httplib2 python-pysimplesoap python-reportbug python-soappy python-support Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 4 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Setting up initramfs-tools (0.130) ... update-initramfs: deferring update (trigger activated) Setting up linux-image-4.9.0-3-marvell (4.9.30-2+deb9u2) ... /etc/kernel-img.conf:4: W: ignoring unknown parameter relative_links /etc/kernel-img.conf:6: W: ignoring unknown parameter do_bootfloppy /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-4.9.0-3-marvell I: The initramfs will attempt to resume from /dev/sda3 I: (UUID=6fcd0aea-6301-4c47-a3fd-9f5eb2c1f8b5) I: Set the RESUME variable to override this. W: mdadm: /etc/mdadm/mdadm.conf defines no arrays. Using DTB: kirkwood-sheevaplug.dtb Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Installing new kirkwood-sheevaplug.dtb. Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. flash-kernel: deferring update (trigger activated) /etc/kernel/postinst.d/zz-flash-kernel: Using DTB: kirkwood-sheevaplug.dtb Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. flash-kernel: deferring update (trigger activated) Setting up linux-image-marvell (4.9+80+deb9u1) ... Setting up linux-image-kirkwood (4.9+80+deb9u1) ... Processing triggers for initramfs-tools (0.130) ... update-initramfs: Generating /boot/initrd.img-4.9.0-3-marvell I: The initramfs will attempt to resume from /dev/sda3 I: (UUID=6fcd0aea-6301-4c47-a3fd-9f5eb2c1f8b5) I: Set the RESUME variable to override this. W: mdadm: /etc/mdadm/mdadm.conf defines no arrays. Using DTB: kirkwood-sheevaplug.dtb Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. flash-kernel: installing version 4.9.0-3-marvell flash-kernel: appending /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb to kernel Generating kernel u-boot image... done. Taking backup of uImage. Installing new uImage. Generating initramfs u-boot image... done. Taking backup of uInitrd. Installing new uInitrd. Taking backup of dtb. Installing new dtb. Processing triggers for flash-kernel (3.79) ... Using DTB: kirkwood-sheevaplug.dtb Installing /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb into /boot/dtbs/4.9.0-3-marvell/kirkwood-sheevaplug.dtb Taking backup of kirkwood-sheevaplug.dtb. Installing new kirkwood-sheevaplug.dtb. flash-kernel: installing version 4.9.0-3-marvell flash-kernel: appending /usr/lib/linux-image-4.9.0-3-marvell/kirkwood-sheevaplug.dtb to kernel Generating kernel u-boot image... done. Taking backup of uImage. Installing new uImage. Generating initramfs u-boot image... done. Taking backup of uInitrd. Installing new uInitrd. Taking backup of dtb. Installing new dtb. W: APT had planned for dpkg to do more than it reported back (6 vs 13). Affected packages: initramfs-tools:armel linux-image-4.9.0-3-marvell:armel sheeva:~# uname -a Linux sheeva... 3.16.0-4-kirkwood #1 Debian 3.16.43-2+deb8u2 (2017-06-26) armv5tel GNU/Linux sheeva:~# reboot ... sheeva:~# uname -a Linux sheeva... 4.9.0-3-marvell #1 Debian 4.9.30-2+deb9u2 (2017-06-26) armv5tel GNU/Linux