Bug#988496: live-boot: /etc/resolv.conf empty when using resolvconf

2021-05-14 Thread Benjamin Drung
Package: live-boot
Version: 1:20210208
Severity: important
Tags: patch

Hi,

We are using live-boot together with resolvconf. Our
/etc/network/interfaces is generated on boot and uses a static config
without DHCP. So the DCHP client in the initrd will be the only DHCP
client.

Once the system is booted, /etc/resolv.conf stays empty.

When using resolvconf, writing the resolv.conf settings into
`/etc/resolvconf/resolv.conf.d/base` is not enough. `/etc/resolv.conf`
pointing to `/run/resolvconf/resolv.conf` will stay empty.

So in addition to copying resolv.conf into
`/etc/resolvconf/resolv.conf.d/base`, generate
`/run/resolvconf/resolv.conf` by adding the head and tail.

A tested patch is attached that generates /run/resolvconf/resolv.conf
when using resolvconf.

-- 
Benjamin Drung

Senior DevOps Engineer and Debian & Ubuntu Developer
Compute Platform Operations

1&1 IONOS SE | Greifswalder Str. 207 | 10405 Berlin | Deutschland
E-Mail: benjamin.dr...@ionos.com | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Hüseyin Dogan, Dr. Martin Endreß, Claudia Frese, Henning
Kettler, Arthur Mai, Matthias Steinberg, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet
>From 1e463cc32f4599617b52e4a872f0e26b46e47ab0 Mon Sep 17 00:00:00 2001
From: Benjamin Drung 
Date: Wed, 12 May 2021 13:19:26 +0200
Subject: [PATCH] Generate /run/resolvconf/resolv.conf when using resolvconf

When using resolvconf, writing the resolv.conf settings into
`/etc/resolvconf/resolv.conf.d/base` is not enough. `/etc/resolv.conf`
pointing to `/run/resolvconf/resolv.conf` will stay empty.

So in addition to copying resolv.conf into
`/etc/resolvconf/resolv.conf.d/base`, generate
`/run/resolvconf/resolv.conf` by adding the head and tail.

Signed-off-by: Benjamin Drung 
---
 components/9990-main.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/components/9990-main.sh b/components/9990-main.sh
index b50952f..3fcfc9f 100755
--- a/components/9990-main.sh
+++ b/components/9990-main.sh
@@ -189,6 +189,15 @@ Live ()
then
log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
cp -v /etc/resolv.conf "${DNSFILE}"
+   if test -e "${rootmnt}/etc/resolvconf/resolv.conf.d/head" && \
+   test -e 
"${rootmnt}/etc/resolvconf/resolv.conf.d/base" && \
+   test -e 
"${rootmnt}/etc/resolvconf/resolv.conf.d/tail"; then
+   mkdir -p /run/resolvconf
+   cat "${rootmnt}/etc/resolvconf/resolv.conf.d/head" \
+   "${rootmnt}/etc/resolvconf/resolv.conf.d/base" \
+   "${rootmnt}/etc/resolvconf/resolv.conf.d/tail" \
+   > /run/resolvconf/resolv.conf
+   fi
log_end_msg
fi
 
-- 
2.27.0



Bug#930419: Regression: Resolving DNS names does not work any more

2019-06-12 Thread Benjamin Drung
Package: live-boot
Version: 1:20180603
Severity: important
Tags: patch

Hi,

libnss_dns.so and libnss_files.so are needed to resolve DNS names. They
are not included any more in the initramfs since the files were moved
from /lib to /usr/lib. A patch to fix it is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

1&1 IONOS Cloud GmbH | Greifswalder Str. 207 | 10405 Berlin | Germany
E-mail: benjamin.dr...@cloud.ionos.com | Web: www.ionos.de

Head Office: Berlin, Germany
District Court Berlin Charlottenburg, Registration number: HRB 125506 B
Executive Management: Christoph Steffens, Matthias Steinberg, Achim
Weiss

Member of United Internet
>From 85521ffd0062f8dcc3d727ccde1dac94d53dcb68 Mon Sep 17 00:00:00 2001
From: Benjamin Drung 
Date: Wed, 12 Jun 2019 13:03:09 +0200
Subject: [PATCH] Also search for libnss_*.so files in /usr/lib

The libnss_*.so were moved from /lib to /usr/lib and were not found any
more (breaking resolving the FQDN with "hostname -f").

Therefore also search for libnss_*.so files in /usr/lib.

Signed-off-by: Benjamin Drung 
---
 backend/initramfs-tools/live.hook | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/backend/initramfs-tools/live.hook 
b/backend/initramfs-tools/live.hook
index 1817814..b37f54f 100755
--- a/backend/initramfs-tools/live.hook
+++ b/backend/initramfs-tools/live.hook
@@ -236,11 +236,11 @@ fi
 
 [ "${QUIET}" ] || echo -n " dns"
 
-# /lib/libnss_dns.so.*:a   DNS
-# /lib/libnss_files.so.*:  /etc/hosts and /etc/passwd
-# /lib/libnss_compat.so.*: /etc/passwd
+# libnss_dns.so.*:DNS
+# libnss_files.so.*:  /etc/hosts and /etc/passwd
+# libnss_compat.so.*: /etc/passwd
 
-for _SHLIB in $(find /lib -name 'libnss_dns.so.*' -o -name 'libnss_files.so.*')
+for _SHLIB in $(find /lib /usr/lib -name 'libnss_dns.so.*' -o -name 
'libnss_files.so.*')
 do
copy_exec "${_SHLIB}"
 done
-- 
2.20.1



Bug#886328: live-boot: Please use /run/live instead of /lib/live/mount

2018-03-15 Thread Benjamin Drung
Am Freitag, den 23.02.2018, 19:24 +0100 schrieb Raphael Hertzog:
> Hello,
> 
> On Fri, 05 Jan 2018, intrigeri wrote:
> > Benjamin Drung:
> > > Therefore move /lib/live/mount to /run/live and skip the
> > > intermedia
> > > /live mount points. This reduces code and complexity.
> > 
> > As someone who had to repeatedly bang his head against exactly this
> > part of the live-boot code (last time earlier this week), I can
> > only
> > agree with the proposed simplification idea. I didn't do a full
> > code
> > review though.
> 
> I'm not familiar enough with this part either and I am unlikely to
> find
> any obvious mistake. But I committed the patch anyway
> 
> It would be nice if we could test the live-boot in git before I
> upload
> it.

I have finally tested git master and found one missing rename of
/live/overlay (probably caused by applying my patches in a different
order which causes merge conflicts). See
https://salsa.debian.org/live-team/live-boot/merge_requests/6
for a fix.

> Benjamin, did you test your changes with persistence enabled?

No, I haven't. Thanks for everyone else who does.

Am Dienstag, den 13.03.2018, 13:05 + schrieb Luca Boccassi:
> On Tue, 2018-03-13 at 10:49 +0100, Raphael Hertzog wrote:
> > On Mon, 12 Mar 2018, Luca Boccassi wrote:
> > > Or maybe have a backward-compatible symlinks?
> > 
> > This seems entirely reasonable. Can you work on this?
> 
> Yes no problem, I'll give it a shot and send a PR for review before
> the
> end of the week.

Thanks for doing it. I will be happy to review it.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg



Bug#884355: live-boot: Please support live-{top,premount,bottom} hooks

2018-03-15 Thread Benjamin Drung
Am Freitag, den 23.02.2018, 19:20 +0100 schrieb Raphael Hertzog:
> Hi,
> 
> On Thu, 14 Dec 2017, Benjamin Drung wrote:
> > initramfs-tools support hooks for top, premount, bottom when
> > booting
> > with boot=local or boot=nfs. Please add similar support to live-
> > boot
> > when booting with boot=live. A patch (for git) is attached.
> 
> I will gladly apply your patch but I think it's time to clean up the
> mess with this:
> 
> > --- a/components/9990-initramfs-tools.sh
> > +++ b/components/9990-initramfs-tools.sh
> > @@ -73,3 +73,25 @@ panic()
> > . /scripts/functions
> > panic "$@"
> >  }
> > +
> > +# Note: Other components source /scripts/functions before sourcing
> > this file.
> > +# /scripts/functions overrides the mount_* functions (to no-ops).
> > Thus fix
> > +# the mount_* options here again.
> 
> This kind of duplication is just ugly. I looked around and saw this:
> $ grep -r -E 'functions|9990-initramfs-tools.sh' components/
> components/9990-initramfs-tools.sh:# Override maybe_break from
> scripts/functions
> components/9990-initramfs-tools.sh:   .
> /scripts/functions
> components/9990-initramfs-tools.sh:# Override panic from
> scripts/functions
> components/9990-initramfs-tools.sh:   . /scripts/functions
> components/9990-fstab.sh: # FIXME: stop hardcoding overloading
> of initramfs-tools functions
> components/9990-fstab.sh: . /scripts/functions
> components/9990-fstab.sh: . /lib/live/boot/9990-initramfs-
> tools.sh
> components/9990-misc-helpers.sh:  # the output of setup_loop is
> evaluated in other functions,
> components/9990-netbase.sh:   # FIXME: stop hardcoding
> overloading of initramfs-tools functions
> components/9990-netbase.sh:   . /scripts/functions
> components/9990-netbase.sh:   . /lib/live/boot/9990-initramfs-
> tools.sh
> 
> I have the feeling that all those problematic include are no longer
> necessary
> nowadays because we first source all the files and then we execute
> functions
> in the expected order. My review has not been thorough but can you
> try to remove
> all those include and see if things still work?
> 
> /script/functions is already sourced in backend/initramfs-
> tools/live.script
> so it should not be required to have it in the components, right?

I have removed the includes (except the ones that are needed to access
the panic function) and the plugin system still works. The tested pull
request: https://salsa.debian.org/live-team/live-boot/merge_requests/6

I have just tested my use case. So I haven't verified that removing the
problematic includes doesn't break anything.

> BTW, I merged all you other patches. For the future, please send
> patches
> as merge requests on the salsa repositories.

Yes. Thanks for merging.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg



Bug#885455: live-boot: Please drop wget from initrd (busybox provides wget)

2018-02-22 Thread Benjamin Drung
Am Mittwoch, den 21.02.2018, 10:08 +0100 schrieb Raphael Hertzog:
> Hello,
> 
> On Wed, 27 Dec 2017, Benjamin Drung wrote:
> > The wget binary depends on many libraries. On Debian 9 (stretch)
> > these
> > are: libffi6, libgnutls30, libhogweed4, libidn11, libidn2-0,
> > libnettle6,
> > libp11-kit0, libpsl5, libtasn1-6, libunistring0. In total 8
> > megabytes.
> > This increases the initramfs size a lot. To save space, use wget
> > from
> > busybox instead. Commit 4328832d0 that adds wget does not give a
> > reason
> > why busybox's wget is not used. A patch is tested and attached.
> 
> The usual reason is for "https" support. Have you tried to use https
> URLs in the various places where we can use URLs?

Okay. I did some tests in a minimal schroot environment:

(stretch)root@konstrukt:~# dpkg -s busybox | grep ^Version
Version: 1:1.22.0-19+b3
(stretch)root@konstrukt:~# busybox wget https://bugs.debian.org/
wget: not an http or ftp url: https://bugs.debian.org/

(buster)root@konstrukt:~# dpkg -s busybox | grep ^Version
Version: 1:1.27.2-2
(buster)root@konstrukt:~# busybox wget https://bugs.debian.org/
Connecting to bugs.debian.org (209.87.16.39:443)
Connecting to www.debian.org (5.153.231.4:443)
index.html   100% |***| 18089   0:00:00 ETA

So busybox in stretch does not support HTTPS, but it supports HTTPS in
testing/unstable.

I also verified that running wget on a https URL inside the minimal
boot=live initramfs works.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg



Bug#886337: live-boot-initramfs-tools: Please support building smaller initrd

2018-01-04 Thread Benjamin Drung
Package: live-boot-initramfs-tools
Version: 1:20170623
Severity: normal
Tags: patch

Hi,

Please add several environment variables to strip down the initrd size
(for minimal systems that do not need all features). This allows me to
reduce the initrd size from 8.5 MiB to 8.0 MiB when also using busybox's
mount (see Debian bug #868559) and wget (see Debian bug #885455). A
tested patch is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 0e3f0bd0705a8395c93bf212d7b7051fb87319da Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 4 Jan 2018 15:05:37 +0100
Subject: [PATCH] Support building smaller initrd

Add several environment variables to strip down the initrd size (for
minimal systems that do not need all features). This allows me to reduce
the initrd size from 8.5 MiB to 8.0 MiB when also using busybox's
mount (see Debian bug #868559) and wget (see Debian bug #885455).

Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com>
---
 backend/initramfs-tools/live.hook | 86 +++
 manpages/en/live-boot.7   | 25 
 2 files changed, 77 insertions(+), 34 deletions(-)

diff --git a/backend/initramfs-tools/live.hook 
b/backend/initramfs-tools/live.hook
index 97f4c5e..41ba7f0 100755
--- a/backend/initramfs-tools/live.hook
+++ b/backend/initramfs-tools/live.hook
@@ -53,12 +53,15 @@ do
 done
 
 # udev dependencies
-for FILE in /lib/udev/*_id
-do
-   copy_exec "${FILE}"
-done
+if [ "${MINIMAL-}" != "y" ]
+then
+   for FILE in /lib/udev/*_id
+   do
+   copy_exec "${FILE}"
+   done
+fi
 
-if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
+if [ -e /lib/udev/rules.d/60-cdrom_id.rules ] && [ "${DISABLE_CDROM-}" != "y" ]
 then
mkdir -p "${DESTDIR}/lib/udev/rules.d"
cp -p /lib/udev/rules.d/60-cdrom_id.rules "${DESTDIR}/lib/udev/rules.d"
@@ -103,7 +106,7 @@ manual_add_modules hfsplus
 # Filesystem: jffs2
 manual_add_modules jffs2
 
-if [ -x /usr/bin/rsync ]
+if [ -x /usr/bin/rsync ] && [ "${MINIMAL-}" != "y" ]
 then
copy_exec /usr/bin/rsync /bin
 fi
@@ -120,25 +123,37 @@ manual_add_modules aufs
 manual_add_modules overlay
 
 # Filesystem: vfat
-manual_add_modules nls_cp437
-manual_add_modules nls_iso8859-1
-manual_add_modules nls_utf8
-manual_add_modules nls_ascii
-manual_add_modules vfat
+if [ "${DISABLE_FAT-}" != "y" ]
+then
+   manual_add_modules nls_cp437
+   manual_add_modules nls_iso8859-1
+   manual_add_modules nls_utf8
+   manual_add_modules nls_ascii
+   manual_add_modules vfat
+fi
 
 # Filesystem: ntfs
-manual_add_modules ntfs
+if [ "${DISABLE_NTFS-}" != "y" ]
+then
+   manual_add_modules ntfs
+fi
 
 [ "${QUIET}" ] || echo -n " devices"
 # Hardware: cdrom
-manual_add_modules ide-cd
-manual_add_modules ide-generic
-manual_add_modules ohci1394
-manual_add_modules sbp2
-manual_add_modules sr_mod
+if [ "${DISABLE_CDROM-}" != "y" ]
+then
+   manual_add_modules ide-cd
+   manual_add_modules ide-generic
+   manual_add_modules ohci1394
+   manual_add_modules sbp2
+   manual_add_modules sr_mod
+fi
 
 # Hardware: usb
-manual_add_modules sd_mod
+if [ "${DISABLE_USB-}" != "y" ]
+then
+   manual_add_modules sd_mod
+fi
 
 # Hardware: network
 auto_add_modules net
@@ -194,24 +209,27 @@ then
 fi
 
 # FUSE kernel module
-manual_add_modules fuse
-
-# FUSE filesystem: httpfs2
-if [ -x /usr/bin/httpfs2_ssl ]
-then
-   [ "${QUIET}" ] || echo -n " httpfs:ssl"
-   copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
-elif [ -x /usr/bin/httpfs2 ]
+if [ "${DISABLE_FUSE-}" != "y" ]
 then
-   [ "${QUIET}" ] || echo -n " httpfs"
-   copy_exec /usr/bin/httpfs2 /bin/httpfs
-fi
+   manual_add_modules fuse
 
-# FUSE filesystem: curlftpfs
-if [ -x /usr/bin/curlftpfs ]
-then
-   [ "${QUIET}" ] || echo -n " ftpfs"
-   copy_exec /usr/bin/curlftpfs /bin
+   # FUSE filesystem: httpfs2
+   if [ -x /usr/bin/httpfs2_ssl ]
+   then
+   [ "${QUIET}" ] || echo -n " httpfs:ssl"
+   copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
+   elif [ -x /usr/bin/httpfs2 ]
+   then
+   [ "${QUIET}" ] || echo -n " httpfs"
+   copy_exec /usr/bin/httpfs2 /bin/httpfs
+   fi
+
+   # FUSE filesystem: curlftpfs
+   if [ -x /usr/bin/curlftpfs ]
+

Bug#886328: live-boot: Please use /run/live instead of /lib/live/mount

2018-01-04 Thread Benjamin Drung
Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Currently live-boot mounts following things:

  /lib/live/mount/medium: the live media mounted read-only
  /lib/live/mount/rootfs/filesystem.{squashfs,ext*,...}: the root fs image
  /lib/live/mount/overlay: the copy-on-write content from aufs
  /lib/live/mount/findiso: the loop-mounted iso image when using findiso
  /lib/live/mount/persistence/*: persistent devices with copy-on-write overlay

Some of these mounts are mounted in /live before they are moved to their
correct place. Since the final root filesystem is mounted in /root and
run-init switches to it, special care needs to be taken when moving the
mount points around.

/lib/live/mount/overlay is not accessible any more in the live system:

$ df -h
/dev/loop0 169M  169M 0 100% /lib/live/mount/rootfs/root.squashfs
tmpfs  744M 0  744M   0% /lib/live/mount/overlay
overlay1,5G 1001M  536M  66% /

The early initramfs stage mounts tmpfs on /run which doesn't need to be
moved once the final root filesystem is in place. The mount points do
not need much space and can live on /run/live without problems. Since
these mount points are run-time variable data, they fit perfectly for
/run and comply with FHS 3.0.

Therefore move /lib/live/mount to /run/live and skip the intermedia
/live mount points. This reduces code and complexity. A tested patch is
attached.

See also for the previous larger layout change:
https://lists.debian.org/debian-live/2012/10/msg00021.html

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 3f97c0d3153c2073eb93473eeb26d2f8153f6464 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Thu, 4 Jan 2018 11:02:32 +0100
Subject: [PATCH] Use /run/live instead of /lib/live/mount

Currently live-boot mounts following things:

  /lib/live/mount/medium: the live media mounted read-only
  /lib/live/mount/rootfs/filesystem.{squashfs,ext*,...}: the root fs image
  /lib/live/mount/overlay: the copy-on-write content from aufs
  /lib/live/mount/findiso: the loop-mounted iso image when using findiso
  /lib/live/mount/persistence/*: persistent devices with copy-on-write overlay

Some of these mounts are mounted in /live before they are moved to their
correct place. Since the final root filesystem is mounted in /root and
run-init switches to it, special care needs to be taken when moving the
mount points around.

/lib/live/mount/overlay is not accessible any more in the live system:

$ df -h
/dev/loop0 169M  169M 0 100% /lib/live/mount/rootfs/root.squashfs
tmpfs  744M 0  744M   0% /lib/live/mount/overlay
overlay1,5G 1001M  536M  66% /

The early initramfs stage mounts tmpfs on /run which doesn't need to be
moved once the final root filesystem is in place. The mount points do
not need much space and can live on /run/live without problems. Since
these mount points are run-time variable data, they fit perfectly for
/run and comply with FHS 3.0.

Therefore move /lib/live/mount to /run/live and skip the intermedia
/live mount points. This reduces code and complexity.

See also for the previous larger layout change:
https://lists.debian.org/debian-live/2012/10/msg00021.html

Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com>
---
 backend/initramfs-tools/live.hook  |  2 +-
 components/0001-init-vars.sh   |  2 +-
 components/2010-remove-persistence |  2 +-
 components/9990-main.sh| 20 +++
 components/9990-misc-helpers.sh| 24 +++---
 components/9990-overlay.sh | 41 +++---
 6 files changed, 25 insertions(+), 66 deletions(-)

diff --git a/backend/initramfs-tools/live.hook 
b/backend/initramfs-tools/live.hook
index 1ce922d..97f4c5e 100755
--- a/backend/initramfs-tools/live.hook
+++ b/backend/initramfs-tools/live.hook
@@ -8,7 +8,7 @@ set -e
 
 # Reading configuration file from filesystem and live-media
 for _FILE in /etc/live/boot.conf /etc/live/boot/* \
-/lib/live/mount/media/live/boot.conf 
/lib/live/mount/media/live/boot/*
+/run/live/medium/live/boot.conf /run/live/medium/live/boot/*
 do
if [ -e "${_FILE}" ]
then
diff --git a/components/0001-init-vars.sh b/components/0001-init-vars.sh
index 7e69956..603cf43 100755
--- a/components/0001-init-vars.sh
+++ b/components/0001-init-vars.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-mountpoint="/live/medium"
+mountpoint="/run/live/medium"
 alt_mountpoint="/media"
 LIVE_MEDIA_PATH="live"
 HOSTNAME="host"
diff --git a/components/2010-remove-persistence 
b/components/2010-remove-persistence
index 5dcf0c0

Bug#885466: live-boot: Please support setting upperdir tmpfs mount point size

2017-12-27 Thread Benjamin Drung
Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Hi,

Resizing the upperdir tmpfs mount will not affect mounted overlays.
The tmpfs size must be configured when mounting it. Therefore please add
a overlay-size configuration option. A tested patch is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 7735def74f55c617ee7f82f6c540f15e2e8adee7 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Fri, 22 Dec 2017 12:34:20 +0100
Subject: [PATCH] Support setting upperdir tmpfs mount point size

Resizing the upperdir tmpfs mount will not affect mounted overlays.
The tmpfs size must be configured when mounting it. Therefore add a
overlay-size configuration option.

Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com>
---
 components/9990-cmdline-old | 5 +
 components/9990-overlay.sh  | 4 ++--
 manpages/en/live-boot.7 | 2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/components/9990-cmdline-old b/components/9990-cmdline-old
index a565ce1..03e8fc6 100755
--- a/components/9990-cmdline-old
+++ b/components/9990-cmdline-old
@@ -161,6 +161,11 @@ Cmdline_old ()
ramdisk_size="${_PARAMETER#ramdisk-size=}"
;;
 
+   overlay-size=*)
+   OVERLAY_SIZE="${_PARAMETER#overlay-size=}"
+   export OVERLAY_SIZE
+   ;;
+
persistence)
PERSISTENCE="true"
export PERSISTENCE
diff --git a/components/9990-overlay.sh b/components/9990-overlay.sh
index 8fd0cfd..00dd6a9 100755
--- a/components/9990-overlay.sh
+++ b/components/9990-overlay.sh
@@ -240,12 +240,12 @@ setup_unionfs ()
then
cowdevice="tmpfs"
cow_fstype="tmpfs"
-   cow_mountopt="rw,noatime,mode=755"
+   cow_mountopt="rw,noatime,mode=755,size=${OVERLAY_SIZE-50%}"
fi
 
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
-   mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
+   mount -t tmpfs -o rw,noatime,mode=755,size=${OVERLAY_SIZE-50%} 
tmpfs "/live/overlay"
root_backing="/live/persistence/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
diff --git a/manpages/en/live-boot.7 b/manpages/en/live-boot.7
index 72184cc..db36641 100644
--- a/manpages/en/live-boot.7
+++ b/manpages/en/live-boot.7
@@ -104,6 +104,8 @@ disables the "persistence" feature, useful if the 
bootloader (like syslinux) has
 Do not prompt to eject the live medium.
 .IP "\fBramdisk\-size\fR" 4
 This parameter defines a custom ramdisk size (it's the '\-o size' option of 
tmpfs mount). By default, there is no ramdisk size set, so the default of mount 
applies (currently 50% of available RAM). Note that this option has currently 
no effect when booting with toram.
+.IP "\fBoverlay\-size\fR=\fISIZE\fR" 4
+The size of the tmpfs mount (used for the upperdir union root mount) in bytes, 
and rounded up to entire pages. This option accepts a suffix % to limit the 
instance to that percentage of your physical RAM or a suffix k, m or g for Ki, 
Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga (gibi)). By 
default, 50% of available RAM will be used.
 .IP "\fBswap=true\fR" 4
 This parameter enables usage of local swap partitions.
 .IP "\fBpersistence\fR" 4
-- 
2.14.1



Bug#885455: live-boot: Please drop wget from initrd (busybox provides wget)

2017-12-27 Thread Benjamin Drung
Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Hi,

The wget binary depends on many libraries. On Debian 9 (stretch) these
are: libffi6, libgnutls30, libhogweed4, libidn11, libidn2-0, libnettle6,
libp11-kit0, libpsl5, libtasn1-6, libunistring0. In total 8 megabytes.
This increases the initramfs size a lot. To save space, use wget from
busybox instead. Commit 4328832d0 that adds wget does not give a reason
why busybox's wget is not used. A patch is tested and attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From d17fb6226a7f99d98b4a39275e85f31a762868b9 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Tue, 19 Dec 2017 16:06:58 +0100
Subject: [PATCH] Drop wget (busybox provides wget)

The wget binary depends on many libraries. On Debian 9 (stretch) these
are: libffi6, libgnutls30, libhogweed4, libidn11, libidn2-0, libnettle6,
libp11-kit0, libpsl5, libtasn1-6, libunistring0. In total 8 megabytes.
This increases the initramfs size a lot. To save space, use wget from
busybox instead. Commit 4328832d0 that adds wget does not give a reason
why busybox's wget is not used.
---
 backend/initramfs-tools/live.hook | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/backend/initramfs-tools/live.hook 
b/backend/initramfs-tools/live.hook
index 9af9eea..41811c3 100755
--- a/backend/initramfs-tools/live.hook
+++ b/backend/initramfs-tools/live.hook
@@ -139,13 +139,6 @@ then
copy_exec /bin/udevadm
 fi
 
-# Program: wget
-if [ -x /usr/bin/wget ]
-then
-   [ "${QUIET}" ] || echo -n " wget"
-   copy_exec /usr/bin/wget /bin
-fi
-
 # Program: blockdev
 if [ -x /sbin/blockdev ]
 then
-- 
2.14.1



Bug#885453: live-boot: Please strip double slashes from path

2017-12-27 Thread Benjamin Drung
Source: live-boot
Version: 1:20170623
Severity: normal
Tags: patch

Hi,

please strip double slashes from path. You already provide and partially
use the trim_path function. Patch is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 84d2835d2797cc850328bc50994b9da381609e39 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Fri, 22 Dec 2017 19:03:58 +0100
Subject: [PATCH] Strip double slashes from path

---
 components/9990-overlay.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/9990-overlay.sh b/components/9990-overlay.sh
index d1b9cef..8fd0cfd 100755
--- a/components/9990-overlay.sh
+++ b/components/9990-overlay.sh
@@ -110,7 +110,7 @@ setup_unionfs ()
;;
esac
 
-   mpoint="${croot}/${imagename}"
+   mpoint=$(trim_path "${croot}/${imagename}")
rootfslist="${mpoint} ${rootfslist}"
 
mkdir -p "${mpoint}"
@@ -288,9 +288,9 @@ setup_unionfs ()
fi
 
for dir in ${cow_dirs}; do
-   unionmountpoint="${rootmnt}${dir}"
+   unionmountpoint=$(trim_path "${rootmnt}${dir}")
mkdir -p ${unionmountpoint}
-   cow_dir="/live/overlay${dir}"
+   cow_dir=$(trim_path "/live/overlay${dir}")
rootfs_dir="${rootfs}${dir}"
mkdir -p ${cow_dir}
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != 
"tmpfs" ]
-- 
2.14.1



Bug#884355: live-boot: Please support live-{top,premount,bottom} hooks

2017-12-14 Thread Benjamin Drung
Source: live-boot
Version: 1:20170623
Severity: wishlist
Tags: patch

Hi,

initramfs-tools support hooks for top, premount, bottom when booting
with boot=local or boot=nfs. Please add similar support to live-boot
when booting with boot=live. A patch (for git) is attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 11ccfa795851a5652a55fec37c059864c7951458 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Wed, 13 Dec 2017 18:40:37 +0100
Subject: [PATCH] Support live-{top,premount,bottom} hooks

initramfs-tools support hooks for top, premount, bottom when booting
with boot=local or boot=nfs. Add similar support to live-boot when
booting with boot=live.

Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com>
---
 backend/initramfs-tools/live.script | 56 +
 components/9990-initramfs-tools.sh  | 22 +++
 2 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/backend/initramfs-tools/live.script 
b/backend/initramfs-tools/live.script
index ff2915a..5bec741 100755
--- a/backend/initramfs-tools/live.script
+++ b/backend/initramfs-tools/live.script
@@ -1,13 +1,59 @@
-#!/bin/sh
-
-#set -e
+# Live system filesystem mounting  -*- shell-script -*-
 
 . /bin/live-boot
 
-. /scripts/functions
+live_top()
+{
+   if [ "${live_top_used}" != "yes" ]; then
+   [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-top"
+   run_scripts /scripts/live-top
+   [ "$quiet" != "y" ] && log_end_msg
+   fi
+   live_top_used=yes
+}
+
+live_premount()
+{
+   if [ "${live_premount_used}" != "yes" ]; then
+   [ "$quiet" != "y" ] && log_begin_msg "Running 
/scripts/live-premount"
+   run_scripts /scripts/live-premount
+   [ "$quiet" != "y" ] && log_end_msg
+   fi
+   live_premount_used=yes
+}
+
+live_bottom()
+{
+   if [ "${live_premount_used}" = "yes" ] || [ "${live_top_used}" = "yes" 
]; then
+   [ "$quiet" != "y" ] && log_begin_msg "Running 
/scripts/live-bottom"
+   run_scripts /scripts/live-bottom
+   [ "$quiet" != "y" ] && log_end_msg
+   fi
+   live_premount_used=no
+   live_top_used=no
+}
+
 
-mountroot ()
+mountroot()
 {
# initramfs-tools entry point for live-boot is mountroot(); function
Live
 }
+
+mount_top()
+{
+   # Note, also called directly in case it's overridden.
+   live_top
+}
+
+mount_premount()
+{
+   # Note, also called directly in case it's overridden.
+   live_premount
+}
+
+mount_bottom()
+{
+   # Note, also called directly in case it's overridden.
+   live_bottom
+}
diff --git a/components/9990-initramfs-tools.sh 
b/components/9990-initramfs-tools.sh
index eb11d23..241c620 100755
--- a/components/9990-initramfs-tools.sh
+++ b/components/9990-initramfs-tools.sh
@@ -73,3 +73,25 @@ panic()
. /scripts/functions
panic "$@"
 }
+
+# Note: Other components source /scripts/functions before sourcing this file.
+# /scripts/functions overrides the mount_* functions (to no-ops). Thus fix
+# the mount_* options here again.
+
+mount_top()
+{
+   # Note, also called directly in case it's overridden.
+   live_top
+}
+
+mount_premount()
+{
+   # Note, also called directly in case it's overridden.
+   live_premount
+}
+
+mount_bottom()
+{
+   # Note, also called directly in case it's overridden.
+   live_bottom
+}
-- 
2.14.1