summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-04-08 08:53:39 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-04-08 08:53:39 +0100
commitff0b0ade51bcc90326ec7c3446a11a78cf0b663e (patch)
tree8292b6b1959b41657e815b8d12ba5e45b3d062a2
parent5f82a8534769a5c5a226c190c4e68a53780c4f10 (diff)
downloaddraklive-install-ff0b0ade51bcc90326ec7c3446a11a78cf0b663e.tar
draklive-install-ff0b0ade51bcc90326ec7c3446a11a78cf0b663e.tar.gz
draklive-install-ff0b0ade51bcc90326ec7c3446a11a78cf0b663e.tar.bz2
draklive-install-ff0b0ade51bcc90326ec7c3446a11a78cf0b663e.tar.xz
draklive-install-ff0b0ade51bcc90326ec7c3446a11a78cf0b663e.zip
Avoid out-of-memory error at end of install.
draklive-install mounts the swap partitions of the installed system. On machines with low memory, these will get used during installation. If we unmount the swap partitions before draklive-install exits, there may not be enough free memory to copy back the swapped out data, leading to a kernel out-of-memory error. So let draklive-install-lock-storage unmount them instead, after draklive-install has exited and freed up some memory. When the installer is run from the boot menu, draklive-install-lock-storage is not used, but the swap partitions will be automatically unmounted on reboot.
-rwxr-xr-xdraklive-install12
-rwxr-xr-xdraklive-install-lock-storage3
2 files changed, 11 insertions, 4 deletions
diff --git a/draklive-install b/draklive-install
index 26a6550..a319249 100755
--- a/draklive-install
+++ b/draklive-install
@@ -76,14 +76,16 @@ sub install_live() {
}
sub umount_all {
- my ($fstab) = @_;
+ my ($fstab, $o_except_swap) = @_;
#- make sure nothing is mounted in the new root
foreach (sort { $b cmp $a } grep { /^$::prefix/ } map { (split)[1] } cat_('/proc/mounts')) {
system('umount', $_);
}
#- make sure selected devices aren't mounted, and swap isn't used
- foreach (grep { isSwap($_) } @$fstab) {
- eval { fs::mount::swapoff($_->{device}) };
+ if (!$o_except_swap) {
+ foreach (grep { isSwap($_) } @$fstab) {
+ eval { fs::mount::swapoff($_->{device}) };
+ }
}
foreach (map { $_->{isMounted} && !isSwap($_) ? "/dev/$_->{device}" : () } @$fstab) {
system('umount', $_);
@@ -362,7 +364,9 @@ sub finish_installation {
run_program::rooted($::prefix, 'sed', '-i', '/for draklive-install/d', '/etc/pam.d/polkit-1');
sync_logs();
#- cleanly umount here, it will avoid fs journals to be corrupted after a hackish reboot
- umount_all($fstab);
+ #- but leave swap space, to avoid out-of-memory error on machines with little memory
+ #- draklive-install-lock-storage will unmount swap after we exit and free up some memory
+ umount_all($fstab, 1);
clean_live_system_hds();
}
diff --git a/draklive-install-lock-storage b/draklive-install-lock-storage
index 8d42a5b..a580705 100755
--- a/draklive-install-lock-storage
+++ b/draklive-install-lock-storage
@@ -10,3 +10,6 @@ else
fi
# run without udisks lock if it fails
[ "$?" != 0 ] && $CMD
+
+# draklive-install will leave swap partitions mounted. Unmount them now.
+swapoff -a