This method requires booting from a separate USB/CD
To shrink the root volume it has to be unmounted, to have the root volume unmounted you basically can not use the system.
This method suggests using KDE Partition Manager, but reducing the size of the main partition is not covered
KDE Partition Manager might be dangerous: LVM partition destroyed and Normal partition destroyed.
This method suggests removing existing space and creating a swapfile in /
Seems unnecessary.
TL;DR (backup important data!) - Decrease root and increase swap
This answer is based on Ubuntu 22.04 LTS
Copied my answer from Increase size of encrypted swap.
Here we decrease root -40G AND increase swap +40G:
# Boot Ubuntu Live/Flash/"Try Ubuntu" AND open terminal
# Run subsequent commands as superuser
sudo su
# `sudo` => Execute a command as another user.
# `sudo su [user]` => Run a command with substitute user, default is root.
Encrypted device should NOT be unlocked
lsblk # => list block devices
# └─sda6 => no crypt
/`lvm``
# Unlock encrypted device
cryptsetup open /dev/sda6 crypt # Enter passphrase
# `cryptsetup` => Manage dm-crypt + LUKS encrypted volumes.
# `cryptsetup open <device> <name>` => Opens encrypted lv as <name>
# Get logical volume identifiers
lsblk
# └─sda6 8:6 0 464,6G 0 part
# └─sda6_crypt 253:0 0 464,5G 0 crypt
# ├─vgubuntu-root 253:1 0 463,6G 0 lvm /
# └─vgubuntu-swap_1 253:2 0 980M 0 lvm [SWAP]
# Shrink logical root volume AND filesystem
lvresize --verbose --resizefs -L -40G /dev/mapper/vgubuntu-root
# `lvresize` <volume> => resize a logical volume
# --verbose => Give more info.
# --resizefs => Resize filesystem AND LV with fsadm(8).
# -L => Specifies the new size of the LV,
# +/- add/subtracts to/from current size, g|G is GiB.
# Check filesystem of logical root volume for errors
e2fsck -f /dev/mapper/vgubuntu-root
# `e2fsck`<fs-path> => Check a Linux ext2/ext3/ext4 file system
# -f => Force checking even if the file system seems clean.
# Increase swapsize
lvresize --verbose -L +40G /dev/mapper/vgubuntu-swap_1
After rebooting, Ubuntu should start normally, swap should be adjusted size:
lslbk
# └─sda6 8:6 0 464,6G 0 part
# └─sda6_crypt 253:0 0 464,5G 0 crypt
# ├─vgubuntu-root 253:1 0 423,6G 0 lvm /
# └─vgubuntu-swap_1 253:2 0 41G 0 lvm [SWAP]
If the system monitor still only has the initial 1G it is necessary to rewrite the logical swap device:
swapon --show
# NAME TYPE SIZE USED PRIO
# /dev/dm-2 partition 976M 0B -2
swapoff -v /dev/dm-2
# swapoff /dev/dm-2
mkswap /dev/dm-2
# mkswap: /dev/dm-2: warning: wiping old swap signature.
# Setting up swapspace version 1, size = 41 GiB (43973079040 bytes)
# no label, UUID=...