From eba671c54dd9b24a2ce1431aebdac74c8d687e14 Mon Sep 17 00:00:00 2001 From: Cam Cope Date: Sun, 5 Apr 2015 18:35:17 -0700 Subject: [PATCH 1/2] remove /tmp cleanup, fixes lvm rootfs --- lib/vagrant-lxc/action.rb | 2 -- .../action/remove_temporary_files.rb | 23 ------------------- 2 files changed, 25 deletions(-) delete mode 100644 lib/vagrant-lxc/action/remove_temporary_files.rb diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index 49f0707..0b2a82a 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -13,7 +13,6 @@ require 'vagrant-lxc/action/handle_box_metadata' require 'vagrant-lxc/action/prepare_nfs_settings' require 'vagrant-lxc/action/prepare_nfs_valid_ids' require 'vagrant-lxc/action/private_networks' -require 'vagrant-lxc/action/remove_temporary_files' require 'vagrant-lxc/action/setup_package_files' require 'vagrant-lxc/action/warn_networks' @@ -126,7 +125,6 @@ module Vagrant end b2.use ClearForwardedPorts - b2.use RemoveTemporaryFiles b2.use GcPrivateNetworkBridges b2.use Builtin::Call, Builtin::GracefulHalt, :stopped, :running do |env2, b3| if !env2[:result] diff --git a/lib/vagrant-lxc/action/remove_temporary_files.rb b/lib/vagrant-lxc/action/remove_temporary_files.rb deleted file mode 100644 index 81a2f11..0000000 --- a/lib/vagrant-lxc/action/remove_temporary_files.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Vagrant - module LXC - module Action - class RemoveTemporaryFiles - def initialize(app, env) - @app = app - @logger = Log4r::Logger.new("vagrant::lxc::action::remove_tmp_files") - end - - def call(env) - # Continue execution, we need the container to be stopped - @app.call env - - if env[:machine].state.id == :stopped - @logger.debug 'Removing temporary files' - tmp_path = env[:machine].provider.driver.rootfs_path.join('tmp') - env[:machine].provider.sudo_wrapper.run('rm', '-rf', "#{tmp_path}/*") - end - end - end - end - end -end From 5fb0bcbcbc6081a1c1affab3b90ddb493e3556dd Mon Sep 17 00:00:00 2001 From: Cam Cope Date: Mon, 17 Aug 2015 14:23:55 -0700 Subject: [PATCH 2/2] make /tmp a tmpfs --- lib/vagrant-lxc/action/boot.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vagrant-lxc/action/boot.rb b/lib/vagrant-lxc/action/boot.rb index 90b783f..08d331d 100644 --- a/lib/vagrant-lxc/action/boot.rb +++ b/lib/vagrant-lxc/action/boot.rb @@ -26,6 +26,9 @@ module Vagrant config.customize 'mount.entry', '/sys/fs/selinux sys/fs/selinux none bind,ro 0 0' end + # Make /tmp a tmpfs to prevent init scripts from nuking synced folders mounted in here + config.customize 'mount.entry', 'tmpfs tmp tmpfs nodev,nosuid,size=2G 0 0' + env[:ui].info I18n.t("vagrant_lxc.messages.starting") env[:machine].provider.driver.start(config.customizations)