| 1 |
This package is, frankly, a collection of hacks, hung on a reasonable |
| 2 |
framework to which you can add more hacks to save memory. The memory saving |
| 3 |
hacks are divided into four groups, which run at different times: |
| 4 |
initialisation, post anna run, and pre partitioning. |
| 5 |
|
| 6 |
Initialisation hacks are in the debian-installer-startup.d/*lowmem script, |
| 7 |
in the lowmemcheck package. The is what decides if the system is low on |
| 8 |
memory, and it creates /var/lib/lowmem as a flag indicating the system |
| 9 |
should be in lowmem mode. Other hacks test for this file. There are |
| 10 |
actually different low memory levels, as determined by the number in the |
| 11 |
file. 1 is standard low memory mode, 2 turns on additional lowmem hacks |
| 12 |
that can make the installation more difficult for the user. |
| 13 |
|
| 14 |
Post anna run hacks are in the lowmem package, which is queued for install |
| 15 |
by anna on lowmem systems, and provides a menu item. |
| 16 |
|
| 17 |
Pre partitioning hacks are also in the lowmem package, and are run as |
| 18 |
the partitioner is starting up. |
| 19 |
|
| 20 |
Current hacks: |
| 21 |
|
| 22 |
disable framebuffer |
| 23 |
Running w/o framebuffer saves lots of memory. The unifont.bgf |
| 24 |
is also removed, saving much ram. |
| 25 |
|
| 26 |
remove translations, force English |
| 27 |
Happens at both init, and also trimtemplates is called by |
| 28 |
udpkg when unpacking packages. |
| 29 |
|
| 30 |
Saves a significant, but not huge amount of memory. |
| 31 |
(Used to save more, but cdebconf has gotten pretty good at |
| 32 |
dropping unused translations on its own.) |
| 33 |
|
| 34 |
truncate log files |
| 35 |
Happens after anna run. By now the log files may be rather |
| 36 |
large, and so this truncates them and restarts the tails. |
| 37 |
|
| 38 |
Saves a few hundred K of memory, at the expense of |
| 39 |
diagnostics. |
| 40 |
|
| 41 |
remove debconf templates after load |
| 42 |
This is done at initialisation by rootskel. After |
| 43 |
initialisation, udpkg takes care of it. It's not in lowmem, |
| 44 |
because this is a safe, simple trick that's worth doing on |
| 45 |
even systems with lots of memory. |
| 46 |
|
| 47 |
Saves a few hundred K of memory. |
| 48 |
|
| 49 |
allow user more control over what udebs are loaded |
| 50 |
This hack is enabled in level 2 lowmem mode. It makes anna |
| 51 |
not install standard priority udebs by default, and the |
| 52 |
user can choose which to install. Careful selection by the |
| 53 |
user can allow for installs with as little as 24 mb of |
| 54 |
memory. |
| 55 |
|
| 56 |
remove all keymaps |
| 57 |
After keyboard is selected, not needed. Done post-anna. |
| 58 |
|
| 59 |
remove selected modules |
| 60 |
Pre partitioning, only kernel modules for filesystems, |
| 61 |
raid, lvm, and the like are needed anymore. This hack |
| 62 |
deletes some other modules to save memory. This frees |
| 63 |
up several megabytes for the partitioner to run in, but |
| 64 |
unfortunately runs too late (after all these udebs are |
| 65 |
unpacked to the initrd) to reduce the overall amount of |
| 66 |
memory needed to install by more than the memory footprint |
| 67 |
of the partitioner. Therefore, removing even more modules |
| 68 |
at this point is not likely to help save any more memory. |
| 69 |
|
| 70 |
Possible future hacks: |
| 71 |
|
| 72 |
remove locale definition |
| 73 |
Removing /usr/lib/locale might be worth it. If done after |
| 74 |
the main cdebconf is running, we should not even notice |
| 75 |
this 300k of stuff is gone, unless cdebconf is started |
| 76 |
on another VT or the like. It does cause cdebconf to not |
| 77 |
display borders properly and some other display ugliness |
| 78 |
for wide characters. |
| 79 |
|
| 80 |
progressive udeb installation |
| 81 |
Anna can install udebs on demand, so use this to defer |
| 82 |
loading some udebs until we know we need them, and |
| 83 |
particularly until after partitioning has enabled swap. |
| 84 |
|
| 85 |
For example, have os-prober only load its kernel module |
| 86 |
udebs on demand. |
| 87 |
|
| 88 |
find swap partitions and auto-swapon |
| 89 |
Try to scan disks for existing swap partitions and swapon. |
| 90 |
This will make later partitioning a bit more difficult, and |
| 91 |
requires a previous install. |
| 92 |
|
| 93 |
let user choose a partition to use as swap |
| 94 |
Scan disks for existing small-ish partitions, list them, |
| 95 |
and offer to turn them into swap space. |
| 96 |
|
| 97 |
Updating lowmem levels |
| 98 |
---------------------- |
| 99 |
|
| 100 |
To update the various lowmem levels, the process is to perform installations |
| 101 |
with tight memory constraints. If the installer does not crash before the base |
| 102 |
system installation, the amount of memory can be considered fine for the lowmem |
| 103 |
level being tested. When possible, the xen platform should be tried as well. |
| 104 |
|
| 105 |
To limit the amount of available memory for an installations, this can be |
| 106 |
either done by specifying emulator settings (e.g. qemu -m option) or by booting |
| 107 |
the kernel with the 'mem=...' option (which will work for real machines). |
| 108 |
|
| 109 |
The levels are set in debian-installer-startup.d/S15lowmem. In order to test |
| 110 |
lower limits than currently allowed, one can set e.g. lowmem=+0 to force the use |
| 111 |
of level 0. |
| 112 |
|
| 113 |
The free memory required to use LVM and encryption should be set in the |
| 114 |
partman-base package, in ./partman, in load_extra() and in the partman-crypto |
| 115 |
package, in ./lib/crypto-base.sh, in crypto_check_mem(). Use Portuguese as |
| 116 |
language (because that will ask for country and timezone) and choose Guided |
| 117 |
partitioning with all partitions separate to test this, first with LVM only to |
| 118 |
set the LVM level, then with LVM+crypto to set the crypto level. |
| 119 |
|
| 120 |
The level1 value should be set to the lowest amount of memory that will support |
| 121 |
an install not in lowmem mode. (This is the max memory footprint of the |
| 122 |
installer in non lowmem mode up to running the partitioner and swapon.) Use |
| 123 |
Portuguese as language (because that will ask for country and timezone) and |
| 124 |
choose Guided partitioning with all partitions separate to test this! |
| 125 |
(without LVM nor encryption) |
| 126 |
|
| 127 |
The level2 value should be set to the lowest amount of memory that will support |
| 128 |
an install in lowmem mode. (This is the max memory footprint of the installer |
| 129 |
in lowmem mode up to running the partitioner and swapon.). The lowmem mode can |
| 130 |
be forced by booting with lowmem=1. |
| 131 |
Again, choose Guided partitioning on encrypted LVM with all partitions separate. |
| 132 |
|
| 133 |
The distinction between these two levels are extremely minimal since all unused |
| 134 |
debconf translations are dropped after anna. In most cases, the two levels can |
| 135 |
probably be set to the same value. Exception is when an architecture uses |
| 136 |
DEBCONF_DROP_TRANSLATIONS=0. This can be necessary for installs where running |
| 137 |
languagechooser is postponed (as is currently the case for installs to arm NAS |
| 138 |
devices). |
| 139 |
|
| 140 |
In both cases, you need to set min to absolute minimum amount of memory needed |
| 141 |
for an install, booting with lowmem=2, loading only the nic-modules udeb, |
| 142 |
partitioning by hand, etc. |
| 143 |
|
| 144 |
Ideally, constraints should be tested for both netboot and businesscard images |
| 145 |
(businesscard CD will use slightly more memory before partitioning that netinst |
| 146 |
because of mirror selection). |
| 147 |
|
| 148 |
NB: the minimum value should be updated in the manual in build/arch-options. |
| 149 |
For architectures for which the level could not be tested, set lowmem-unchecked |
| 150 |
in the lowmem variable. |
| 151 |
|
| 152 |
NB: the minimum value should be updated in debian-installer/build/boot/x86/f2.txt |
| 153 |
|
| 154 |
NB: the minimum memory required to run the graphical installer must |
| 155 |
also be tested. See rootskel (src/lib/debian-installer.d/S60frontend). |
| 156 |
|