Bug#655198: live-installer does not remove live packages in the installed system

2019-01-26 Thread John Crawley

Hello,
I ran into this issue last year making a derivative (BunsenLabs) live  
iso with live-build, and patched live-installer (53) to honour  
/cdrom/live/filesystem.packages-remove and enable the functionality  
described in Live-Manual 8.2.7 [1]


Just for reference, here's what we did:

1) I added finish-install.d/14copy-pkg-lists, which runs just before  
15cdrom-detect, and copies  
/cdrom/live/filesystem.packages-{remove,install} to  
/var/cache/live-installer/ (arbitary choice of directory).


2) finish-install.d/60remove-live-packages now looks at  
/var/cache/live-installer/filesystem.packages-remove for packages to remove.


3) Awk seems not to be available to the d-i hook scripts. I got "not  
found" errors when trying to use the existing code in  
60remove-live-packages, and likewise in a TTY shell during installation.  
No other d-i hooks invoke awk.
I did note, however, that live-installer's postinst script calls it on  
line 153 with no apparent ill-effects. (Maybe when install_live_system  
() is called the cdrom has already been unmounted, so the absence  
of/cdrom/live/filesystem.packages-install masks the unsupported awk?)


Anyway, to separate the first word on a line is a trivial task that can  
be done by 'read', which I substituted thus (now adding the forgotten  
read -r option):


# Remove packages as specified in specific package removal list
for list in /var/cache/live-installer/filesystem.packages-remove; do
if [ -e $list ]; then
while read -r package otherstuff; do
if [ -f /target/var/lib/dpkg/info/${package}.list ]; 
then
packages="$packages $package"
do_initrd=true
fi
done < "$list"
fi
done

4) Instead of purging packages individually I collected them all into a  
list for a single run of

in-target apt-get --yes purge

NOTE) Users of live-build might want to add a binary hook script to make  
sure that any live-only packages that have been provided as local .deb  
files get added to filesystem.packages-remove. Otherwise they are left  
off because local debs are installed in the first run of  
chroot_install-packages.


FWIW I'm attaching the patch on live-installer 53.

[1]  
https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#429


--
John
Description: Remove packages in /cdrom/live/filesystem.packages-remove.
 Packages listed in /cdrom/live/filesystem.packages-remove
 will be uninstalled at the finish-install phase of debian-installer.
 Intended to enable correct functionality of Live-Manual 8.2.7,
 raised and partly patched in Debian bug #655198.
Author: John Crawley 
Last-Update: 2018-03-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+Warning: This udeb package is for building debian-installer images only.
+Do not install it on a normal Debian system.
+
+This is a patched version of live-installer-54
+to make live-build's package.list.chroot_{install,live} syntax work.
+
+Packages listed in /cdrom/live/filesystem.packages-remove
+will be uninstalled at the finish-install phase of debian-installer.
+
+A binary hook needs to be added to live-build's config/hooks/normal
+to ensure that local debs are also added to filesystem.packages-remove
+if they are in *.list.chroot_live
--- /dev/null
+++ b/finish-install.d/14copy-pkg-lists
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+# Copy package install/remove lists from cdrom before it's unmounted.
+
+lists='/cdrom/live/filesystem.packages-remove 
/cdrom/live/filesystem.packages-install'
+cachedir='/var/cache/live-installer'
+
+for list in $lists
+do
+   if [ -e "$list" ]
+   then
+   mkdir -p "$cachedir"
+   cp "$list" "$cachedir"
+   fi
+done
--- a/finish-install.d/60remove-live-packages
+++ b/finish-install.d/60remove-live-packages
@@ -1,20 +1,18 @@
 #!/bin/sh -e
 
 do_manual_removal=true
+packages=
 
 # Remove packages as specified in specific package removal list
-for list in /cdrom/live/filesystem.packages-remove; do
+for list in /var/cache/live-installer/filesystem.packages-remove; do
if [ -e $list ]; then
-   do_manual_removal=
+   while read package otherstuff; do
+   if [ -f /target/var/lib/dpkg/info/${package}.list ]; 
then
+   packages="$packages $package"
do_initrd=true
 
-   for package in $(awk '{ print $1 }' $list); do
-   if [ -f /target/var/lib/dpkg/info/$package.list ]; then
-   packages="$packages $package"
fi
-   done
-
-   in-target apt-get --yes purge $packages
+   done < "$list"
fi
 done
 
@@ -25,12 +23,16 @@ done
 if [ $do_manual_removal ]; then
for package in live-boot 

Bug#655198: live-installer does not remove live packages in the installed system

2012-07-20 Thread Rui Bernardo
On Mon, Jul 09, 2012 at 07:35:56PM +0100, Rui Bernardo wrote:
 Today I've built debian sid live images with live-installer 36. It's 
 working, thanks.
 
 This bug can be closed for wheezy, but what about squeeze?

When I was going to try to fix this bug in squeeze, and after reading 
live-installer changelog, building version 31 udeb file and including it 
in a squeeze live image, it turned out to be obvious that version 31 was 
supposed to be uploaded to squeeze. I suppose that time passed, d-i 
development continued and live-installer 31 never made to squeeze.

live-installer 31 removed the live packages correctly in the end of the 
installation. Version 30, the one in squeeze, does not.

Dear maintainers, could you please upload live-installer version 31 to 
squeeze so it is included in squeeze 6.0.6 and close this bug? tyvm.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#655198: live-installer does not remove live packages in the installed system

2012-07-09 Thread Rui Bernardo
Today I've built debian sid live images with live-installer 36. It's 
working, thanks.

This bug can be closed for wheezy, but what about squeeze?



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#655198: live-installer does not remove live packages in the installed system

2012-05-26 Thread Rui Miguel P. Bernardo
On Fri, Jan 13, 2012 at 6:17 PM, Joey Hess jo...@debian.org wrote:
 Rui Miguel P. Bernardo wrote:
 I've noticed that debian-installer-launcher was not removed in the
 installed system, as were not removed also live-config, live-boot and
 others.

 Related to this is the search for /cdrom/live/filesystem.packages-remove
 file. I suppose the /cdrom is not mounted when
 finish-install.d/60remove-live-packages is executed

 [...]

       15cdrom-detect: logger -t cdrom-detect $@
       15cdrom-detect:# Cannot just tell eject to eject /cdrom as it is not 
 compatible
       15cdrom-detect:# with busybox umount. Instead, unmount the cdrom 
 first, and then
       15cdrom-detect:CDDEV=$(mount | grep on /cdrom | cut -d ' ' -f 1)
       15cdrom-detect: umount /cdrom || true
       15cdrom-detect: db_get cdrom-detect/eject
       60remove-live-packages:for list in 
 /cdrom/live/filesystem.packages-remove; do

 If that's the case then something should be done. Move
 60remove-live-packages to before 15cdrom-detect (or vice-versa), or just
 remove manually the live packages, or something else.

 I agree, it looks broken for 60remove-live-packages to come after cdrom-detect
 cleans up after itself, if it depends on the CD being mounted.

 +do_manual_removal=true
 +
  # Remove packages as specified in specific package removal list
  for list in /cdrom/live/filesystem.packages-remove; do
       if [ -e $list ]; then

 This patch seems correct anyway, so I have applied it, but I don't
 feel it really fixes the bug, the intent seems to be for the list
 of packages to remove to be moved out of live-installer and into
 the creation of the live CD, and this only papers over that not working.

 --
 see shy jo

Hi Joey,

I've also found this bug in squeeze this week, while building a
squeeze live image with live-installer. The live-boot package (and the
others that depends on it) is/are not removed after disk install.

I've been using a patched version 34 live-installer in wheezy. It's
patched with fix for this bug and also with workaround for bug 655198
in wheezy.

I've built a squeeze live image with this patched udeb and,
apparently, all works ok in squeeze with live-installer 34+patch; live
packages are removed after the install. The patched live image can be
downloaded from http://www.adrive.com/public/gDgZaK.html and the
patched udeb(s) from github
(https://github.com/rbern/bravance/blob/master/live-installer_35~2.gbpe79f3c~debian6460%2B0_i386.udeb
and 
https://github.com/rbern/bravance/blob/master/live-installer_35~2.gbpe79f3c~debian6460%2B1_amd64.udeb).
The patched udeb should be copied into config/packages/ directory in
live-build config tree and --debian-installer live option included
in lb config to build with it.

Because squeeze live-installer also has this bug and building squeeze
with version 34 works ok, I would suggest to release a new 35 version
of live-installer and included it in next 6.0.x release. If that can't
happen, then  a fix release with a fresh
live-installer.d/remove-package file with the actual
finish-install.d/60remove-live-packages file (the file was renamed and
changed directory between version 30 and 34) could be done. Diffs:
http://anonscm.debian.org/gitweb/?p=d-i/live-installer.git;a=blobdiff;f=finish-install.d/60remove-live-packages;h=a70466e7e3ce248d509c3b5713c7ff7ce58f7676;hp=2d65ed4604c3ba6db3c474c73ff8c02b71a1d619;hb=HEAD;hpb=33fb8d6830c9b13232597968e2773c2804c723d2

Should I send a patch with this solution in version 30?

I don't know if this can be done, but a fix should be released because
leaving live-* packages in installed systems is not the supposed to
happen.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#655198: live-installer does not remove live packages in the installed system

2012-01-13 Thread Joey Hess
Rui Miguel P. Bernardo wrote:
 I've noticed that debian-installer-launcher was not removed in the 
 installed system, as were not removed also live-config, live-boot and 
 others.

 Related to this is the search for /cdrom/live/filesystem.packages-remove 
 file. I suppose the /cdrom is not mounted when 
 finish-install.d/60remove-live-packages is executed

[...]

   15cdrom-detect: logger -t cdrom-detect $@
   15cdrom-detect:# Cannot just tell eject to eject /cdrom as it is not 
 compatible
   15cdrom-detect:# with busybox umount. Instead, unmount the cdrom first, 
 and then
   15cdrom-detect:CDDEV=$(mount | grep on /cdrom | cut -d ' ' -f 1)
   15cdrom-detect: umount /cdrom || true
   15cdrom-detect: db_get cdrom-detect/eject
   60remove-live-packages:for list in 
 /cdrom/live/filesystem.packages-remove; do

 If that's the case then something should be done. Move 
 60remove-live-packages to before 15cdrom-detect (or vice-versa), or just 
 remove manually the live packages, or something else.

I agree, it looks broken for 60remove-live-packages to come after cdrom-detect
cleans up after itself, if it depends on the CD being mounted.
 
 +do_manual_removal=true
 +
  # Remove packages as specified in specific package removal list
  for list in /cdrom/live/filesystem.packages-remove; do
   if [ -e $list ]; then

This patch seems correct anyway, so I have applied it, but I don't
feel it really fixes the bug, the intent seems to be for the list
of packages to remove to be moved out of live-installer and into
the creation of the live CD, and this only papers over that not working.

-- 
see shy jo


signature.asc
Description: Digital signature


Bug#655198: live-installer does not remove live packages in the installed system

2012-01-08 Thread Rui Miguel P. Bernardo
Package: live-installer
Version: 34
Severity: normal
Tags: d-i patch

Dear Maintainer,

I've noticed that debian-installer-launcher was not removed in the 
installed system, as were not removed also live-config, live-boot and 
others.

The problem was that a missing var initialization of do_manual_removal 
in finish-install.d/60remove-live-packages, preventing the packages to 
be manually removed by default.

do_manual_removal=true

Related to this is the search for /cdrom/live/filesystem.packages-remove 
file. I suppose the /cdrom is not mounted when 
finish-install.d/60remove-live-packages is executed, so the file 
/cdrom/live/filesystem.packages-remove is not found, and I can confirm 
that the file *is* in the image.

/usr/lib/finish-install.d # ls
01kickseed
05crypto
05localechooser
06user-setup
07brltty
07preseed
07speakup
10apt-cdrom-setup
10clock-setup
15cdrom-detect
20final-message
30hw-detect
50config-target-network
55netcfg-network-manager
60cleanup
60remove-live-packages
65partman-md
90base-installer
90console
94save-logs
95umount
97release-dhcp-lease
98exit-installer
99reboot

/usr/lib/finish-install.d # grep /cdrom *
10apt-cdrom-setup:if [ -e /cdrom/.disk/base_installable ]  \
10apt-cdrom-setup:   [ -e /cdrom/.disk/cd_type ]  \
10apt-cdrom-setup:   [ $(cat /cdrom/.disk/cd_type) = not_complete ] 
 \
10apt-cdrom-setup:  sed -i /^deb cdrom:/s/^/#/ 
/target/etc/apt/sources.list
15cdrom-detect: logger -t cdrom-detect $@
15cdrom-detect:# Cannot just tell eject to eject /cdrom as it is not 
compatible
15cdrom-detect:# with busybox umount. Instead, unmount the cdrom first, 
and then
15cdrom-detect:CDDEV=$(mount | grep on /cdrom | cut -d ' ' -f 1)
15cdrom-detect: umount /cdrom || true
15cdrom-detect: db_get cdrom-detect/eject
60remove-live-packages:for list in 
/cdrom/live/filesystem.packages-remove; do

I could not find any mount or umount command in 
/usr/lib/finish-install.d/*, just in 15cdrom-detect. Maybe it's 
15cdrom-detect that umounts the /cdrom. If it is cdrom-detect is 
misleading.

If that's the case then something should be done. Move 
60remove-live-packages to before 15cdrom-detect (or vice-versa), or just 
remove manually the live packages, or something else.

Anyway, to fix/workaroung the original problem by removing manually the 
packages, adding the variable an initial value makes the manual 
removal happen.

Patch attached. Thank you.

From 20ba218a7b3507a5cba54b78e6453b387aa4dc3a Mon Sep 17 00:00:00 2001
From: Rui Miguel P. Bernardo rui.bernardo...@gmail.com
Date: Mon, 9 Jan 2012 06:07:25 +
Subject: [PATCH] Initialize do_manual_removal var.

---
 finish-install.d/60remove-live-packages |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/finish-install.d/60remove-live-packages 
b/finish-install.d/60remove-live-packages
index aab6db2..a70466e 100755
--- a/finish-install.d/60remove-live-packages
+++ b/finish-install.d/60remove-live-packages
@@ -1,5 +1,7 @@
 #!/bin/sh -e
 
+do_manual_removal=true
+
 # Remove packages as specified in specific package removal list
 for list in /cdrom/live/filesystem.packages-remove; do
if [ -e $list ]; then
-- 
1.7.7.1




-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/1 CPU core)
Locale: LANG=pt_PT.UTF-8, LC_CTYPE=pt_PT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
From 20ba218a7b3507a5cba54b78e6453b387aa4dc3a Mon Sep 17 00:00:00 2001
From: Rui Miguel P. Bernardo rui.bernardo...@gmail.com
Date: Mon, 9 Jan 2012 06:07:25 +
Subject: [PATCH] Initialize do_manual_removal var.

---
 finish-install.d/60remove-live-packages |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/finish-install.d/60remove-live-packages b/finish-install.d/60remove-live-packages
index aab6db2..a70466e 100755
--- a/finish-install.d/60remove-live-packages
+++ b/finish-install.d/60remove-live-packages
@@ -1,5 +1,7 @@
 #!/bin/sh -e
 
+do_manual_removal=true
+
 # Remove packages as specified in specific package removal list
 for list in /cdrom/live/filesystem.packages-remove; do
 	if [ -e $list ]; then
-- 
1.7.7.1