Skip to content

Instantly share code, notes, and snippets.

@rios0rios0
Last active January 7, 2019 16:26
Show Gist options
  • Save rios0rios0/cafea67941fce3aaa4a32cf237582874 to your computer and use it in GitHub Desktop.
Save rios0rios0/cafea67941fce3aaa4a32cf237582874 to your computer and use it in GitHub Desktop.
.sh - Stop the cryptswap partition for fix bug on Ubuntu 16.04.05 LTS

Bug:

[ FAILURE ] Stopped with error /dev/dm-0

Fix:

Place file on:

/etc/init.d/stop-cryptswap

Then execute:

sudo chmod +x /etc/init.d/stop-cryptswap
sudo update-rc.d cryptswap-stop defaults
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: stop-cryptswap
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 0 6
# Default-Stop:
# Short-Description: Stop the cryptswap partition for fix bug
# Description: Stop the cryptswap, on Ubuntu 16.04.5 LTS
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
. /lib/lsb/init-functions
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/stop-cryptswap -i"
cd /
umask 077
#
# main()
#
case "${1:-''}" in
'start')
sudo /sbin/swapoff -a
sudo /sbin/cryptsetup luksClose cryptswap1
log_daemon_msg "Umount cryptswap1 ===> Success!" "stop-cryptswap"
;;
'stop')
log_daemon_msg "Do nothing..." "stop-cryptswap"
;;
'restart')
set +e; $SELF stop; set -e
$SELF start
log_daemon_msg "Restarting..." "stop-cryptswap"
;;
'reload'|'force-reload')
log_daemon_msg "Do nothing..." "stop-cryptswap"
;;
'status')
log_daemon_msg "Do nothing..." "stop-cryptswap"
;;
*)
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment