Installation stuck at "Creating ext4 file system"

Solution 1:

Boot from Ubuntu installation media.
Select 'Try Ubuntu without installing'.

Open GParted -> press the Windows key and type GParted.
Open GParted and delete all partitions you find on the disk.

Create a new partition - format it with ext4 - a size that fits your needs.
Create a new partition - format it with swap - a size matching the RAM.

On the desktop click Install Ubuntu, when asked choose Something else.
Select the ext4 partition you had created with GParted for Ubuntu before.
Select / as mount point and ext4 file system as format - start the installation.

Update addressing your comment that you receive errors and cannot create partitions :

Open GParted - click on Ignore.
Click on Device on the top menu.
Now click on Create Partition Table.
Select gpt when you have UEFI BIOS.
Select msdos when you have legacy BIOS.
Now you can create new partitions on the disk.

Update addressing your comment that you receive an error partition is currently active :

Screenshot shows that the swap partition is mounted.
Right-click the partition sda5 and click on Swapoff.
Right-click the partition sda2 and click Unmount.
In case it is not possible from Ubuntu media,
do it with the original GParted Live media.