Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-06 Thread Thomas Goirand
On 12/05/2017 09:58 AM, Raphael Hertzog wrote:
> On Mon, 04 Dec 2017, Thomas Goirand wrote:
>> Could you please review the patch and let me know if you think it's ok,
>> apply to the git, and allow me to upload?
> 
> I think it's wrong because it handles vmlinuz/initrd separately. I pushed
> what I think is a proper fix into git. Can you test the git version and
> confirm that it works for you?
> 
> (I attach the patch applied on top of the last NMU)
> 
> Cheers,

Hi Raphael,

Thanks a lot for your work.

I can confirm that the new version fixes the bug. I tried installing it
before the dist-upgrade using dpkg -i, and also setting-up a Debian
repository holding only this new version of live-tools. In both cases,
the upgraded worked.

Please get this new version of live-tools uploaded to Sid. Thanks a lot
for your work.

Cheers,

Thomas Goirand (zigo)



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-05 Thread intrigeri
Thomas Goirand:
> Do you know if it's possible to generate a Sid live system?

We have weekly builds of testing Live ISO images:
https://get.debian.org/cdimage/weekly-live-builds/amd64/iso-hybrid/ …
so I don't see any reason why building sid Live systems would be
impossible :)



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-05 Thread Raphael Hertzog
On Mon, 04 Dec 2017, Thomas Goirand wrote:
> Could you please review the patch and let me know if you think it's ok,
> apply to the git, and allow me to upload?

I think it's wrong because it handles vmlinuz/initrd separately. I pushed
what I think is a proper fix into git. Can you test the git version and
confirm that it works for you?

(I attach the patch applied on top of the last NMU)

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/
diff --git a/bin/live-update-initramfs b/bin/live-update-initramfs
index 3cdbed3..38d5f27 100755
--- a/bin/live-update-initramfs
+++ b/bin/live-update-initramfs
@@ -55,30 +55,36 @@ case "${_READ_WRITE}" in
# Updating initramfs
/usr/sbin/update-initramfs.orig.initramfs-tools "${@}"
 
-   # FIXME: needs to exclude initrd backup files
-   if [ "$(ls /boot/initrd.img-* | wc -l)" -gt 1 ]
+   if [ "$(ls /boot/vmlinuz-* | wc -l)" -gt 1 ]
then
_NUMBER="1"
 
-   for _INITRD in /boot/initrd.img-*
+   for _VMLINUZ in /boot/vmlinuz-*
do
-   _VERSION="$(basename ${_INITRD} | sed -e 
's|initrd.img-||')"
+   _VERSION="$(basename ${_VMLINUZ} | sed -e 
's|vmlinuz-||')"
 
cp /boot/vmlinuz-${_VERSION} 
/lib/live/mount/medium/live/vmlinuz${_NUMBER}.new
-   cp /boot/initrd.img-${_VERSION} 
/lib/live/mount/medium/live/initrd${_NUMBER}.img.new
-
-   mv 
/lib/live/mount/medium/live/vmlinuz${_NUMBER}.new 
/lib/live/mount/medium/live/vmlinuz${_NUMBER}
-   mv 
/lib/live/mount/medium/live/initrd${_NUMBER}.img.new 
/lib/live/mount/medium/live/initrd${_NUMBER}.img
+   if [ -e /boot/initrd.img-${_VERSION} ]; then
+   cp /boot/initrd.img-${_VERSION} 
/lib/live/mount/medium/live/initrd${_NUMBER}.img.new
+   fi
 
_NUMBER="$((${_NUMBER} + 1))"
done
else
-   cp /boot/vmlinuz-* 
/lib/live/mount/medium/live/vmlinuz.new
-   cp /boot/initrd.img-* 
/lib/live/mount/medium/live/initrd.img.new
+   _VMLINUZ=$(echo /boot/vmlinuz-*)
+   _VERSION="$(basename ${_VMLINUZ} | sed -e 
's|vmlinuz-||')"
+   cp $_VMLINUZ /lib/live/mount/medium/live/vmlinuz.new
+   if [ -e /boot/initrd.img-${_VERSION} ]; then
+   cp /boot/initrd.img-${_VERSION} 
/lib/live/mount/medium/live/initrd.img.new
+   fi
 
-   mv /lib/live/mount/medium/live/vmlinuz.new 
/lib/live/mount/medium/live/vmlinuz
-   mv /lib/live/mount/medium/live/initrd.img.new 
/lib/live/mount/medium/live/initrd.img
fi
+   for f in /lib/live/mount/medium/live/vmlinuz*.new \
+/lib/live/mount/medium/live/initrd*.new; do
+   if [ -e $f ]; then
+   mv $f ${f%.new}
+   fi
+   done
;;
 
false)
diff --git a/debian/changelog b/debian/changelog
index 69a1b46..39dbf1d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+live-tools (1:20171205) UNRELEASED; urgency=medium
+
+  * Improve update-initramfs wrapper to better handle unmatched
+kernels and initrd images. Closes: #882769
+
+ -- Raphaël Hertzog   Tue, 05 Dec 2017 09:31:05 +0100
+
 live-tools (1:20151214+nmu1) unstable; urgency=medium
 
   * Non-maintainer upload.


Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread Thomas Goirand
Hi,

Here's 2 patches to apply to the Git. The first one ACK the last NMU (I
did a debdiff and just applied the result), and the 2nd one is the
actual fix for this bug.

Could you please review the patch and let me know if you think it's ok,
apply to the git, and allow me to upload?

Cheers,

Thomas Goirand (zigo)

>From d8b192c4fee504c0334ee632bc0a631ae26ca0ec Mon Sep 17 00:00:00 2001
From: Thomas Goirand 
Date: Mon, 4 Dec 2017 15:34:35 +0100
Subject: [PATCH 1/2] ACK nmu: 20151214+nmu1

---
 debian/changelog  | 16 
 debian/control|  2 ++
 debian/live-tools.init|  6 --
 debian/live-tools.service | 14 ++
 debian/rules  |  2 +-
 5 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 debian/live-tools.service

diff --git a/debian/changelog b/debian/changelog
index cd25a7c..69a1b46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+live-tools (1:20151214+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add a native live-tools.service unit (Closes: #796627)
+  * Add dh-systemd build-dependency and use "--with systemd" for above.
+  * Source /lib/lsb/init-functions in init script
+- fixes lintian warning: init.d-script-does-not-source-init-functions
+  which means if someone directly invokes the init script under
+  systemd then the systemd LSB hooks will redirect to systemctl.
+  * Add lsb-base dependency because of the above.
+  * Fix up path in init script to make it actually do something
+(/bin/live-media-eject -> /bin/live-medium-eject)
+Thanks to Felipe Sateler for spotting this.
+
+ -- Andreas Henriksson   Thu, 09 Jun 2016 16:07:07 +0200
+
 live-tools (1:20151214) unstable; urgency=medium
 
   [ Carlos Zuferri ]
diff --git a/debian/control b/debian/control
index ea8d408..03983c6 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Live Systems Maintainers 
 Uploaders: Iain R. Learmonth 
 Build-Depends:
  debhelper (>= 9),
+ dh-systemd (>= 1.5),
 Standards-Version: 3.9.6
 Homepage: https://debian-live.alioth.debian.org/live-tools/
 Vcs-Browser: http://anonscm.debian.org/cgit/debian-live/live-tools.git
@@ -13,6 +14,7 @@ Vcs-Git: http://anonscm.debian.org/git/debian-live/live-tools.git
 Package: live-tools
 Architecture: all
 Depends:
+ lsb-base,
  initramfs-tools,
  ${misc:Depends},
 Suggests:
diff --git a/debian/live-tools.init b/debian/live-tools.init
index 1b22e35..3afc682 100644
--- a/debian/live-tools.init
+++ b/debian/live-tools.init
@@ -16,11 +16,13 @@
 # X-Interactive:	true
 ### END INIT INFO
 
+. /lib/lsb/init-functions
+
 case "${1}" in
 	stop)
-		if [ -e /bin/live-media-eject ]
+		if [ -e /bin/live-medium-eject ]
 		then
-			/bin/live-media-eject ${@}
+			/bin/live-medium-eject ${@}
 		fi
 		;;
 
diff --git a/debian/live-tools.service b/debian/live-tools.service
new file mode 100644
index 000..53499b7
--- /dev/null
+++ b/debian/live-tools.service
@@ -0,0 +1,14 @@
+[Unit]
+Documentation=man:live-tools(7)
+Description=live-tools - System Support Scripts
+DefaultDependencies=no
+Before=shutdown.target
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStop=/bin/live-medium-eject
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index 1ef2425..5761e15 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 %:
-	dh ${@} --parallel
+	dh ${@} --parallel --with systemd
 
 override_dh_auto_install:
 	dh_auto_install
-- 
2.11.0

>From 47e1efc42f15f2ade829e7f84a12fe2cbf8eb669 Mon Sep 17 00:00:00 2001
From: Thomas Goirand 
Date: Mon, 4 Dec 2017 15:34:08 +0100
Subject: [PATCH 2/2] Fix crashing update-initramfs when upgrading the live
 system. (Closes: #882769).

---
 bin/live-update-initramfs | 22 +++---
 debian/changelog  |  8 
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/bin/live-update-initramfs b/bin/live-update-initramfs
index 3cdbed3..93dfdbd 100755
--- a/bin/live-update-initramfs
+++ b/bin/live-update-initramfs
@@ -63,21 +63,29 @@ case "${_READ_WRITE}" in
 			for _INITRD in /boot/initrd.img-*
 			do
 _VERSION="$(basename ${_INITRD} | sed -e 's|initrd.img-||')"
-
-cp /boot/vmlinuz-${_VERSION} /lib/live/mount/medium/live/vmlinuz${_NUMBER}.new
 cp /boot/initrd.img-${_VERSION} /lib/live/mount/medium/live/initrd${_NUMBER}.img.new
-
-mv /lib/live/mount/medium/live/vmlinuz${_NUMBER}.new /lib/live/mount/medium/live/vmlinuz${_NUMBER}
 mv /lib/live/mount/medium/live/initrd${_NUMBER}.img.new /lib/live/mount/medium/live/initrd${_NUMBER}.img
-
 _NUMBER="$((${_NUMBER} + 1))"
 			done
 		else
-			cp /boot/vmlinuz-* /lib/live/mount/medium/live/vmlinuz.new
 			cp /boot/initrd.img-* /lib/live/mount/medium/live/initrd.img.new
+			mv /lib/live/mount/medium/live/initrd.img.new 

Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread Thomas Goirand
On 12/04/2017 02:41 PM, Raphael Hertzog wrote:
> Control: reassign -1 live-tools
> 
> On Wed, 29 Nov 2017, Thomas Goirand wrote:
>> Building cpio /boot/initrd.img-4.9.0-4-amd64.new initramfs
>> cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory
>>
>> I still don't see where to search... :/
> 
> I guess that you have live-tools installed?
> 
> I don't really know the purpose of this package but it does divert
> update-initramfs and contains the problematic "cp" that generates
> the message seen above.
> 
> The live-tools package is a Recommends of live-config. Not sure
> if it's get pulled automatically by live-build or not due to this.
> 
> Cheers,

Right, I see it now. In bin/live-update-initramfs line 76 (at least in
the git), we can read:

cp /boot/vmlinuz-* /lib/live/mount/medium/live/vmlinuz.new
cp /boot/initrd.img-* /lib/live/mount/medium/live/initrd.img.new

mv /lib/live/mount/medium/live/vmlinuz.new \
/lib/live/mount/medium/live/vmlinuz
mv /lib/live/mount/medium/live/initrd.img.new \
/lib/live/mount/medium/live/initrd.img

So that's the problematic code. Now, the shell script is supposed to
handle multiple kernels, but it just fails to detect there's more than
one: it just looks for the number of files matching /boot/initrd.img-*,
and expects the same amount of /boot/vmlinuz-*. Though when upgrading
the kernel, there's at some point more than one vmlinuz-* file, but only
a single /boot/initrd.img-*, because the 2nd one hasn't been generated
just yet.

I'm currently writing a patch, and will send it to this bug report for
review from you guys.

Cheers,

Thomas Goirand (zigo)



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread Raphael Hertzog
Control: reassign -1 live-tools

On Wed, 29 Nov 2017, Thomas Goirand wrote:
> Building cpio /boot/initrd.img-4.9.0-4-amd64.new initramfs
> cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory
> 
> I still don't see where to search... :/

I guess that you have live-tools installed?

I don't really know the purpose of this package but it does divert
update-initramfs and contains the problematic "cp" that generates
the message seen above.

The live-tools package is a Recommends of live-config. Not sure
if it's get pulled automatically by live-build or not due to this.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread Thomas Goirand
On 12/04/2017 10:50 AM, intrigeri wrote:
> Hi,
> 
> Thomas Goirand:
>> After booting a Stretch live image, I tried to upgrade it to Sid, and
>> it fails with this error:
> 
> Upgrading a *Live* system from one version of Debian to the other is
> arguably a corner case and this bug does not affect the usability of
> live-boot in the vast majority of cases.

My use case is to use live for the OpenStack CI, when I want to test
with Sid and not stable. Probably not a lot of people do that, but it's
still a use case. Do you know if it's possible to generate a Sid live
system?

> Besides, I would feel wrong
> to see live-boot automatically removed from testing merely because of
> this bug. So perhaps this could be demoted to severity:important?

I don't mind much the severity, but I'd very much prefer if we found out
how to fix! Currently, I still don't understand which script is the
problem. Do you have any idea?

Cheers,

Thomas Goirand (zigo)



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread Steve McIntyre
On Mon, Dec 04, 2017 at 10:50:53AM +0100, intrigeri wrote:
>Hi,
>
>Thomas Goirand:
>> After booting a Stretch live image, I tried to upgrade it to Sid, and
>> it fails with this error:
>
>Upgrading a *Live* system from one version of Debian to the other is
>arguably a corner case and this bug does not affect the usability of
>live-boot in the vast majority of cases. Besides, I would feel wrong
>to see live-boot automatically removed from testing merely because of
>this bug. So perhaps this could be demoted to severity:important?

At best, yes.

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
There's no sensation to compare with this
Suspended animation, A state of bliss



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-12-04 Thread intrigeri
Hi,

Thomas Goirand:
> After booting a Stretch live image, I tried to upgrade it to Sid, and
> it fails with this error:

Upgrading a *Live* system from one version of Debian to the other is
arguably a corner case and this bug does not affect the usability of
live-boot in the vast majority of cases. Besides, I would feel wrong
to see live-boot automatically removed from testing merely because of
this bug. So perhaps this could be demoted to severity:important?

Cheers,
-- 
intrigeri



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-11-28 Thread Thomas Goirand
On 11/28/2017 10:07 AM, Raphael Hertzog wrote:
> update-initramfs -u -v

Here's the (end of) the output of the above command:

Calling hook live
live-boot: core filesystems devicesCopying module directory
kernel/drivers/net
(excluding appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko
irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb
veth.ko wan wimax wireless xen-netback.ko)
 utils udev wget blockdev dns.
Calling hook klibc-utils
/usr/share/initramfs-tools/scripts/local-premount/ORDER ignored: not
executable
/usr/share/initramfs-tools/scripts/init-top/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/init-bottom/ORDER ignored: not executable
Building cpio /boot/initrd.img-4.9.0-4-amd64.new initramfs
cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

I still don't see where to search... :/

Cheers,

Thomas Goirand (zigo)



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-11-28 Thread Raphael Hertzog
On Tue, 28 Nov 2017, Goirand Thomas (aka zigo) wrote:
> I did try to purge and it didn't help. The issue is indeed about 2
> kernels installed, though as I wrote, upgrading linux-image-amd64 first
> works arround the problem. So I'm not sure what's going on, really. Any
> hint/clue ?

Run "update-initramfs -u -v" to get more information on where it's
failing?

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-11-28 Thread Goirand Thomas (aka zigo)


Sent from my Cyanogen phone

On Nov 28, 2017 9:58 AM, Raphael Hertzog  wrote:

> So far you haven't even proven that the problem is in live-boot so 

> please don't be too hasty. 


Sure ! Also, as I found a workaround for my CI, I'm not in such a hurry 
anymore. I also didn't intend to upload cruft... ;)


I did try to purge and it didn't help. The issue is indeed about 2 kernels 
installed, though as I wrote, upgrading linux-image-amd64 first works arround 
the problem. So I'm not sure what's going on, really. Any hint/clue ?


Cheers,


Thomas Goirand (zigo)



On Nov 28, 2017 9:58 AM, Raphael Hertzog  wrote:

Hi Thomas,

On Sun, 26 Nov 2017, Thomas Goirand wrote:
> After booting a Stretch live image, I tried to upgrade it to Sid, and
> it fails with this error:
> 
> update-initramfs: deferring update (trigger activated)
> cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

This is usually a sign that you have multiple kernel images installed
and the (failing) script is only able to cope with one.

But I have no idea what script is involved here.

> Removing the package live-boot-initramfs-tools before the upgrade isn't
> even a workaround, it continues to crash.

Did you try to purge it? (The problematic hook script might still be
installed after removal if it's in /etc)

> I need this to be fixed ASAP, as I'm using Live to test OpenStack, and
> this is a major blocker to me. I probably will attempt to fix it myself
> and NMU the package with no delay if you're fine with that, however,

So far you haven't even proven that the problem is in live-boot so
please don't be too hasty.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-11-28 Thread Raphael Hertzog
Hi Thomas,

On Sun, 26 Nov 2017, Thomas Goirand wrote:
> After booting a Stretch live image, I tried to upgrade it to Sid, and
> it fails with this error:
> 
> update-initramfs: deferring update (trigger activated)
> cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

This is usually a sign that you have multiple kernel images installed
and the (failing) script is only able to cope with one.

But I have no idea what script is involved here.

> Removing the package live-boot-initramfs-tools before the upgrade isn't
> even a workaround, it continues to crash.

Did you try to purge it? (The problematic hook script might still be
installed after removal if it's in /etc)

> I need this to be fixed ASAP, as I'm using Live to test OpenStack, and
> this is a major blocker to me. I probably will attempt to fix it myself
> and NMU the package with no delay if you're fine with that, however,

So far you haven't even proven that the problem is in live-boot so
please don't be too hasty.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



Bug#882769: Cannot upgrade from Stretch: cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

2017-11-26 Thread Thomas Goirand
Package: live-boot-initramfs-tools
Version: 1:20170623
Severity: serious

Hi,

After booting a Stretch live image, I tried to upgrade it to Sid, and
it fails with this error:

update-initramfs: deferring update (trigger activated)
cp: target '/lib/live/mount/medium/live/vmlinuz.new' is not a directory

Removing the package live-boot-initramfs-tools before the upgrade isn't
even a workaround, it continues to crash.

I need this to be fixed ASAP, as I'm using Live to test OpenStack, and
this is a major blocker to me. I probably will attempt to fix it myself
and NMU the package with no delay if you're fine with that, however,
I'd appreciate help here.

Cheers,

Thomas Goirand (zigo)