Completely removing references to an encrypted swap partition

Hi,

Recently upgraded the drive in my laptop from 512GB to a terabyte. To clone the old drive I used clonezilla. I had to remove the swap partition as it was blocking me from expanding the data partition to fill the drive. Instead I created a swapfile on the encrypted data partition which is working well.

I commented out the references to the old swap UUID in crypttab and fstab. Also found two references in /etc/opencrypt.conf which I removed and reran mkinitcpio -P. Grepping the /etc directory recursively I can find no further references to the UUID. I also checked /etc/default/grub as mentioned in other posts. Yet an error still persists on boot and shutdown which flashes briefly on the screen. It does not prevent the system starting but would like to remove the error.

Device /dev/disk/by-uuid/<uuid of deleted swap> does not exist or access denied

Can anyone help me find what I’ve missed to completely stop the system looking for this now removed partition?

Welcome at the forum, @yazz :tada:

Please post the content of the files

/etc/default/grub
/etc/fstab

and

/etc/mkinitcpio.conf

Also, please post output of

sudo fdisk -l

and

sudo blkid

/etc/default/grub

GRUB_DEFAULT=saved
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=033cd263-32fc-4a40-96ff-8b199aa4502f:luks-033cd263-32fc-4a40-96ff-8b199aa4502f root=/dev/mapper/luks-033cd263-32fc-4a40-96ff-8b199aa4502f resume=/dev/mapper/luks-033cd263-32fc-4a40-96ff-8b199aa4502f apparmor=1 security=apparmor udev.log_priority=3"
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"
GRUB_ENABLE_CRYPTODISK=y

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

/etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=2343-BC39                            /boot/efi      vfat    umask=0077 0 2
/dev/mapper/luks-033cd263-32fc-4a40-96ff-8b199aa4502f /              ext4    defaults,noatime 0 1
# /dev/mapper/luks-9bd2fcd4-1711-415f-a7e1-4a7c712d7b61 swap           swap    defaults,noatime 0 2
/swapfile none swap defaults 0 0

/etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(piix ide_disk reiserfs)
MODULES=""

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES="/crypto_keyfile.bin"

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect block filesystems)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev block filesystems)
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS=(base udev block mdadm encrypt filesystems)
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS=(base udev block lvm2 filesystems)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev autodetect modconf block keyboard keymap encrypt openswap resume filesystems"

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

fdisk -l

Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 980 1TB                     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 131072 bytes
Disklabel type: gpt
Disk identifier: C8AC9BB9-D616-4544-BAF9-D21AF414F973

Device          Start        End    Sectors   Size Type
/dev/nvme0n1p1   4096     618495     614400   300M EFI System
/dev/nvme0n1p2 618496 1953521663 1952903168 931.2G Linux filesystem


Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: CT1000MX500SSD1 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 42529F72-61A6-1A4B-B6F3-A664BC535CF4

Device     Start        End    Sectors   Size Type
/dev/sda1   2048 1953519615 1953517568 931.5G Linux filesystem


Disk /dev/mapper/luks-033cd263-32fc-4a40-96ff-8b199aa4502f: 931.21 GiB, 999884324864 bytes, 1952899072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 131072 bytes


Disk /dev/loop0: 55.45 MiB, 58142720 bytes, 113560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 307.58 MiB, 322523136 bytes, 629928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

~~snipped some loop drives~~~

Disk /dev/loop39: 287.32 MiB, 301281280 bytes, 588440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/luks-5680c03e-3b5a-4c42-a291-cab5e452dc5a: 931.51 GiB, 1000198897664 bytes, 1953513472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Portable SSD T5 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x443f523e

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1        2048 1953522112 1953520065 931.5G  7 HPFS/NTFS/exFAT

blkid

/dev/nvme0n1p1: UUID="2343-BC39" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="b17054e9-ad00-4a89-b674-c784c0dd3187"
/dev/nvme0n1p2: UUID="033cd263-32fc-4a40-96ff-8b199aa4502f" TYPE="crypto_LUKS" PARTUUID="2be654ce-5c5b-4d0e-ae67-19662af07b88"
/dev/sda1: UUID="5680c03e-3b5a-4c42-a291-cab5e452dc5a" TYPE="crypto_LUKS" PARTUUID="b4a44a48-0aa4-da48-85f7-8eb285fa4440"
/dev/mapper/luks-033cd263-32fc-4a40-96ff-8b199aa4502f: UUID="1bf5bf1e-eabc-4e6e-9410-6cc92ea3c86f" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"

~~~ snipped some loop drives~~~

/dev/loop39: TYPE="squashfs"
/dev/mapper/luks-5680c03e-3b5a-4c42-a291-cab5e452dc5a: UUID="40ad8326-09e7-4155-8473-7c3c588a0e02" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sdb1: LABEL="Samsung_T5" UUID="4E7E-D879" BLOCK_SIZE="512" TYPE="exfat" PARTUUID="443f523e-01

I have commented out the places where the old swap partition was (9bd2fcd4-1711-415f-a7e1-4a7c712d7b61). Grepping the rest of /etc for that uuid i come up empty handed.

I think the following should be removed from your /etc/default/grub file:

In your /etc/mkinitcpio.conf change

exactly into

HOOKS=(base udev autodetect modconf block keyboard keymap encrypt openswap filesystems)

Afterwards execute

sudo update grub
sudo mkinitcpio -P

and reboot.

Thank you for your help. That almost solved it. I tried your solution but the error was still there. So I edited /etc/mkinitcpio.conf again and also removed the openswap reference.

So now my HOOKS line looks like

HOOKS=(base udev autodetect modconf block keyboard keymap encrypt filesystems)

Will mark the post solved. Thanks again.

Now I just need to work out how to remove hibernate from the shutdown menu.

1 Like

To remove hibernate from shutdown menu you need to edit /etc/systemd/sleep.conf

AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no

and /etc/systemd/logind.conf

HibernateKeyIgnoreInhibited=no

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.