41 Commits

Author SHA1 Message Date
Rich Ercolani
50d945acb8 Add support for specifying compression level
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>
2022-06-20 12:38:33 -04:00
Hideki Yamane
742c8ee507 Use zstd as default compression for initramfs
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).
2020-11-30 20:10:33 +09:00
Ben Hutchings
3616c8f345 conf/initramfs.conf: Fix typo "filesytem"
Closes: #970235
Signed-off-by: Ben Hutchings <benh@debian.org>
2020-09-13 19:27:22 +01:00
Ben Hutchings
4309c3bcd9 Add FSTYPE config parameter to allow overriding filesystem type detection
This is needed for testing, and should also be useful for building
more generic initramfs images.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2020-09-06 23:23:20 +01:00
Ben Hutchings
9877542bcf initramfs.conf: Delete "NFS Section" comment
There are no real sections in this file.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2020-09-06 23:23:20 +01:00
Norbert Lange
e94f410c71 un-,mkinitramfs: add support for zstd
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>
2020-07-29 00:53:38 +02:00
Ben Hutchings
577c94e988 initramfs.conf: Update documentation of the DEVICE variable
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2018-07-18 20:52:24 +01:00
Paul Menzel
e28b865426 mkinitramfs: Add LZ4 support
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>
2018-06-19 10:35:25 +02:00
Benjamin Drung
ae339ffd5e Make size of /run configurable
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>
2018-06-05 19:17:11 +02:00
Ben Hutchings
bf445db3ed Restore automatic selection between busybox and klibc by default
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>
2015-12-31 03:41:08 +00:00
Ben Hutchings
7285ffb144 hooks/busybox: Fail if busybox is wanted but not found
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>
2015-12-06 03:08:13 +00:00
Ben Hutchings
64d39d07c4 Add comment to /usr/share/initramfs-tools/modules that it is not a config file
/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>
2014-10-16 15:25:53 +02:00
Vagrant Cascadian
1355c08328 initramfs-tools Don't override root=/dev/nfs by BOOT=local config
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>
2012-06-15 12:39:51 +02:00
maximilian attems
78cdb26a25 mkinitramfs: Add support for xz compression.
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>
2011-02-22 10:10:23 +01:00
Marc Herbert
478ba8921e Minor documentation fix in /etc/initramfs-tools/modules.
"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>
2010-10-21 13:50:18 +02:00
Michael Prokop
7faeb32bd8 fix typos in manpage, scripts/functions and conf/initramfs.conf - thanks lintian
* paramater -> parameter
* adress -> address
* adress -> address
* overriden -> overridden
* correponds -> corresponds
* correponds -> corresponds
* Overriden -> Overridden
* usualy -> usually

Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-18 15:45:51 +02:00
Michael Prokop
60afd2a944 code cleanup: drop trailing whitespaces.
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-14 12:10:28 +02:00
maximilian attems
2487528907 configure_networking(): work with empty DEVICE string
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>
2010-04-10 15:57:30 +02:00
bert schulze
6e9a3ba17b mkinitramfs: add LZO support
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>
2010-04-09 15:32:12 +02:00
bert schulze
38c90c536d initramfs-tools: support different compression tools in mkinitramfs
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>
2010-04-04 05:50:34 +02:00
Ben Collins
722cb312d3 update-initramfs: Default to not keep .bak backups
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>
2010-03-24 03:06:00 +01:00
maximilian attems
0d74255b03 Redefinde MODULES=most to not carry any fb driver per default.
this allows for a much smaller initramfs and thus faster boot.

Signed-off-by: maximilian attems <maks@debian.org>
2009-07-29 15:28:10 +02:00
Martin Michlmayr
33c9958a54 update initramfs.conf
Now that d-i won't create /etc/initramfs-tools/conf.d/driver-policy
in all cases, I think reference to is mostly useless.
2008-09-15 15:53:36 +02:00
Martin Michlmayr
261ce5623c initramfs.conf: Mention possible value overriding by d-i for example.
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.
2008-09-12 16:34:12 +02:00
maximilian attems
aad955549a update_initramfs tristate variable "all"
allow admin to set that an update-initramfs postinst call
should update any known initramfs.
2007-08-09 21:22:10 +02:00
David Härdeman
1541218fe1 Add support for loading keymaps. (closes: 337663) 2007-04-12 21:56:32 +02:00
maximilian attems
78fe68bcad - allow to disable backup
- new bzr location
- functional copy_dir_modules()
- modprobe a bunch of ppc windfarm modules in thermal
- provide output on error
2006-12-02 18:51:54 +01:00
maximilian attems
849c7c5f29 - add backup handling to initramfs-tools
- allow conservative settings for skipping updated initramfs.
- debug output to screen
- parse mbr for lilo
+ small fixes
2006-10-13 08:52:12 +02:00
maximilian attems
8761821795 - add BUSYBOX section to conf
- 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
2006-07-24 09:13:28 +02:00
maximilian attems
f82a46fac9 - mkinitramfs take care of eventual missing depmod run
- do the migration from mkinitramfs in preinst
- sed the modules file so that it looks pretty some than ours
- polish modules file
- allow BUSYBOX=n
2006-07-07 12:05:34 +02:00
maximilian attems
0d341b8d32 woow pile of stuff turned up:
- 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
2006-07-02 18:57:07 +02:00
maximilian attems
830fd3fa51 sync with ubuntu22 + some handmerges 2006-02-27 00:20:17 +01:00
maximilian attems
0734f56e32 get ready for the release:
remove traling whitespace in the conffile
remove debugging "set -x"
2005-12-12 11:39:11 +01:00
maximilian attems
c4163d08f4 fix wording in initramfs.conf regarding resume option. 2005-12-05 17:43:22 +01:00
maximilian attems
0abf7fae2b fix reference to manpage. 2005-11-02 07:10:28 +01:00
maximilian attems
21555c3e52 reoder initramfs.conf 2005-09-20 12:39:37 +02:00
maximilian attems
8b2a636d8c remove unused BUSYBOX variable 2005-09-19 15:14:15 +02:00
Jeff Bailey
618760b004 Cleanup commit, sorry for the mess 2005-08-16 13:34:13 -04:00
Jeff Bailey
f12ad818ff * Default to currently running kernel version.
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!
2005-06-21 01:31:54 +00:00
Jeff Bailey
287dcae140 Use /sbin, do depmod at boot time, copy all the interesting hardware drivers onto the initramfs 2005-06-17 15:57:54 +00:00
Jeff Bailey
de9c780f57 Initial checkin 2005-06-08 21:13:41 +00:00