How can we install lethe on Ubuntu 18.04?

Solution 1:

You found very interesting peace of software.
Having equivalent of Faronics Deep Freeze on Ubuntu will be great.

Let's start with downloading of the software:

wget https://kent.dl.sourceforge.net/project/lethe/lethe/0.3x/lethe_0.34_all.deb
sudo apt-get install ./lethe_0.34_all.deb

But it will not install with error:

Generating grub configuration file ...
/etc/grub.d/09_lethe: 22: .: Can't open /usr/lib/grub/update-grub_lib
dpkg: error processing package lethe (--configure):
 installed lethe package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 lethe
E: Sub-process /usr/bin/dpkg returned an error code (1)

We need to recreate this file from previous Ubuntu version, or maybe Debian Wheezy (see this link from packages.debian.org):

cat <<\EOF | sudo tee /usr/lib/grub/update-grub_lib
# stub for new grub-mkconfig_lib
# Copyright (C) 2007,2008  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix="/usr"
exec_prefix="${prefix}"
datarootdir="${prefix}/share"

. "${datarootdir}/grub/grub-mkconfig_lib"

grub_warn "update-grub_lib is deprecated, use grub-mkconfig_lib instead"
EOF

and make it executable

sudo chmod +x /usr/lib/grub/update-grub_lib

then install package again:

sudo apt-get install ./lethe_0.34_all.deb

then you should disable AppArmor to get NetworkManager and other stuff working on freezed system:

sudo sed -i "s/aufs=tmpfs$/aufs=tmpfs apparmor=0/" /etc/lethe/09_lethe /etc/grub.d/09_lethe
sudo update-initramfs -u -k all
sudo update-grub

Reboot and enjoy:

GRUB, freezed with Lethe

$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-33-generic root=UUID=2772ff62-4902-4409-a588-cffebbf33209 ro quiet splash aufs=tmpfs apparmor=0

I have tested this method on Ubuntu 16.04 LTS and 18.04 LTS: after installation of Lethe I booted new system, created new file, then rebooted and can't find the file in place. So it really works!