Added a COMPRESSLEVEL parameter to initramfs.conf, a -l flag to
mkinitramfs, and updated initramfs.conf.5 and mkinitramfs.8 to match.
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Now initramfs files are compressed with gzip
But we can use another compression, i.e. LZO, LZ4, and ZSTD.
Then which one is the best?
compression ratio
ZSTD > GZIP > LZO > LZ4
decompression speed
LZ4 > LZO = ZSTD > GZIP
I suggest choosing ZSTD, instead of GZIP since
- better compression ratio than current GZIP
- also better decompression speed than current GZIP
With gzip
$ file /boot/initrd.img-5.9.0-*
/boot/initrd.img-5.9.0-3-amd64: gzip compressed data, from Unix, original size modulo 2^32 197680640
/boot/initrd.img-5.9.0-4-amd64: gzip compressed data, from Unix, original size modulo 2^32 197594112
$ du -h /boot/initrd.img-5.9.0-*
59M /boot/initrd.img-5.9.0-3-amd64
59M /boot/initrd.img-5.9.0-4-amd64
With zstd
$ file /boot/initrd.img-5.9.0-*
/boot/initrd.img-5.9.0-3-amd64: Zstandard compressed data (v0.8+), Dictionary ID: None
/boot/initrd.img-5.9.0-4-amd64: Zstandard compressed data (v0.8+), Dictionary ID: None
$ du -h /boot/initrd.img-5.9.0-*
40M /boot/initrd.img-5.9.0-3-amd64
40M /boot/initrd.img-5.9.0-4-amd64
Yes, 59MB initramfs file becomes 40MB (2/3)! plus bonus, better decompression speed.
However, there's a problem to do so - zstd package's Priority is not standard one - it's "optional".
> Package: gzip
> Version: 1.10-2
> Priority: required
> Package: zstd
> Version: 1.4.5+dfsg-4
> Priority: optional
It means there is not zstd package in every environment. And, just raise its Priority
means bloat minimal system size that is a problem we want to avoid.
Now initramfs-tools has a hack to avoid zstd (and other compression tools)
absence in mkinitramfs command.
> if ! command -v "${compress}" >/dev/null 2>&1; then
> compress=gzip
> echo "No ${compress} in ${PATH}, using gzip"
> fi
Set COMPRESS=zstd in /etc/initramfs/initramfs.conf and no zstd installed,
there's no problem.
> $ sudo update-initramfs -u
> update-initramfs: Generating /boot/initrd.img-5.9.0-4-amd64
> No zstd in /usr/bin:/sbin:/bin, using gzip
(above message is patched with #971270)
So, just set default compression as zstd can bring a better result for many users,
IMO (Not sure raising zstd package Priority (to standard) is required or not).
Add support for zstd compression and decompression.
Always use multithreaded compression, as zstd still
generates identical archives.
The zstd cmdline tool is usually able to decompress
gzip, xz, lzma and lz4 so make sure to try the tool
early.
Signed-off-by: Norbert Lange <nolange79@gmail.com>
LZ4 creates bigger archives than XZ, but decompression time is only half
as long on a ASRock E350M1 with an SSD, shaving off half a second from
the overall boot time of four seconds.
The patch is taken from Ubuntu [1] and has the change-log entries below.
> initramfs-tools (0.130ubuntu4) bionic; urgency=medium
>
> [ Benjamin Tegge ]
> * mkinitramfs: support lz4 as compress method (LP: #1488620)
>
> [ Balint Reczey ]
> * unmkinitramfs: support lz4 as compress method
>
> -- Balint Reczey <rbalint@ubuntu.com> Wed, 11 Apr 2018 23:37:21 +0200
[1]: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1488620
Closes: https://bugs.debian.org/893845
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Using 10% of RAM for /run is a good default, but not suitable for all
systems. 10% might be too small for system with less memory (e.g.
virtual machine with 160 MiB RAM) or too big (VM host with 256/512 GiB
RAM). A too small /run partition leads to not enough space on it. If the
/run partition is huge, systemd's journald will consume lot of memory,
because it defaults to using at most 15% of the respective file system
of /run/log/journal.
Adjusting the size of /run via an entry in /etc/fstab is not sufficient
since journald calculates it limits before systemd remounts /run with
the small size. Therefore journald could occupy the full /run partition
with its logs.
Allow specifying the size of /run by adding a RUNSIZE configuration
variable and a initramfs.ramsize= boot argument. Mounting /run must be
done after reading the configuration.
Closes: #862013
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
Some systems are working alright with the old default of BUSYBOX=y and
no busybox installed. We should only force use of busybox if another
package installing initramfs scripts needs it.
Change the default from BUSYBOX=y to BUSYBOX=auto, and give that the
old semantics.
Closes: #809204
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Currently we silently fall back to klibc if BUSYBOX=y but we can't
find it. This can result in an unusable initramfs, so fail instead
of continuing.
This mitigates bug #783297.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
/usr/share/initramfs-tools/modules looks like it could be a live
configuration file, but it is not. Add a short comment to the file,
then strip it when copying to /etc/initramfs-tools.
Closes: #752789
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Specifying root=/dev/nfs doesn't really do anything without also either
specifying boot=nfs or changing BOOT= in initramfs.conf:
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
At which point, you could just as well not specify root=/dev/nfs at all.
This breaks the historical method for network booting with nfsroot with the
kernel arguments:
ip=dhcp root=/dev/nfs
I guess the check to make sure BOOT wasn't already set was changed in order to
fix putting boot= anywhere in the boot commandline:
http://bugs.debian.org/453294
But it seems to me the correct thing to do in that case would be to specify
boot=live after root=/dev/nfs... since the order of the argument processing
matters, rather than preferring the result of one argument over another.
Why is BOOT=local defined in initramfs.conf at all?
What about only setting BOOT=local if $BOOT is undefined, after all the
argument processing is done.
Closes: #677157
Signed-off-by: maximilian attems <max@stro.at>
Also add info to relevant config file.
Reference: <20110216144546.GA20971@dali>
Reported-by: trentbuck@gmail.com
Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
"It seems to me that the "Loading essential drivers" step is
unconditionnaly loading all modules listed in
/etc/initramfs-tools/modules by the user, since the whole user list is
inserted into in conf/modules inside the image."
LP: #177263
Reported-by: Marc Herbert <marc.herbert@gmail.com>
Signed-off-by: maximilian attems <max@stro.at>
initramfs-tools currently requires a device to be hard-coded, but this
is not much use if the network device is not known ahead of time. If
the device specified in either /etc/initramfs-tools/initramfs.conf or
on the ip=xxx kernel command line.
usefull for multiple net devices.
Based on patch by Tim Small <tim@seoss.co.uk>
Closes: #566295, #575766
Reviewed-by: Vagrant Cascadian <vagrant@freegeek.org>
Signed-off-by: maximilian attems <maks@debian.org>
Albin Tonnerre sent a patch fixing the initramfs LZO decompression,
so heres my fix for initramfs-tools to have compete compression
support. Tell me if you want me to open a new bugreport.
On a side note: this will only work with a patched kernel (might be
upstream with 2.6.34), its a good idea to include a warning for those
running 2.6.33 from experimental
[ adding it on TODO of Lenny linux-2.6 2.6.32 ]
Signed-off-by: maximilian attems <maks@debian.org>
this version uses /etc/initramfs-tools/initramfs.conf to determine
the compression method, checks kernel and userspace support with
fallback to gzip. Since LZO didnt work for me at all with 2.6.33
I left that out for now.
(closes: #533903)
[ minor changes in mkinitramfs code ]
Signed-off-by: maximilian attems <maks@debian.org>
we don't need to any more. TODO: lilo might still want .bak's.
[ merge 0.92bubuntu9 + fix manpage
note: indeed the precaution seems no longer needed these days,
but is potentially harmful when /boot space is small. ]
Signed-off-by: maximilian attems <maks@debian.org>
Please mention in initramfs.conf that the values specified there can
be overriden via /etc/mkinitramfs/conf.d. This is important since d-i
will now use /etc/initramfs-tools/conf.d/driver-policy to set MODULES.
- add myri10ge, smc911x and hptiop modules
- fix check_minkver() logic
- escape resume variables
- fix SEE ALSO section in all manpages
- source /usr/share/initramfs-tools/conf.d/*
- check against modules.dep before running depmod
- more verbose output
- open console with -i for dash interactive
- fix resume param by LABEL or UUID
- lvm has new prereq mdadm
- update-initramfs fix -v calling
- functions/scripts replace basename usage with shell expansion
- cleanup of activate_vg() in lvm boot script
- use less of busybox utilities
- conf.d for BUSYBOX=y usage for the packages
- don't poke on conffile for RESUME
- use printf instead of expr (ooh ash and dash are *fun*)
- fix update-initramfs to use current_version when no other
version exists around
Based on a patch from maximilian attems, thanks!
* Handle module arguments in /etc/mkinitramfs/modules
* Do hookscripts at generation time. Drop things into
/usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks
* Make sure local-bottom and nfs-bottom get created
Thanks to Karl Hegbloom for these three patches!
* Prune stray echo from call_scripts
* Load raid1 for now so that md setups will work.
* Detect ide modules load
Thanks to Jeff Waugh for initial testing of this!