[Bug 2112139] [NEW] Manual re- install Ubuntu 25 on Ubuntu 24 FAILED due to mounting crypto_LUKS type of encrypted nvme partition

Kosta 2112139 at bugs.launchpad.net
Thu May 29 18:00:54 UTC 2025


Public bug reported:

Setup:
AMD Ryzen 9 6900HX with Radeon Graphics
mini computer with 1GB SSD nvme
Installed Ubuntu 24 LTS  on "/" (root dir/drive/partition) encrypted with LUKS during install.
The Ubuntu install process created on nvme0n1
nvme0n1p1 - "/boot/efi" - FAT32
nvme0n1p2 - "/boot" ETX4
nvme0n1p3 - "/" - LUKS with EXT4
Due to :
apt update
apt upgrade
My boot was damaged and as a result I got only:
The file "/boot/" was not found
Perhaps the boot loader (WAS NOT GRUB some UEFI I don't know how you did it), so the file perhaps som of the files in /boot/ like vmlinuz.... are not correct in the booting software/config.
Nothing helped - I installed GRUB and got the menu, BUT same :
The file "/boot/" was not found

So I decided to re-install the Ubuntu - but 24 seemed on my flash drive damaged so I used a new USB flash drive and Ubuntu 25 - I repeat version 25.
Using "Manual installation" I got to point to select 
Leave unformatted 
for all 3 drives - well the "/boot" EXT4 did not worked to set it MOUNTPOINT "/boot" .
After install started if failed and the log got (last lines):
          File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/commands/block_meta.py", line 1448, in mount_fstab_data
            raise RuntimeError(msg)
        RuntimeError: Mount failed: /dev/nvme0n1p3 @ /target/ with options defaults
        Mount failed: /dev/nvme0n1p3 @ /target/ with options defaults

The reason for the problem is up of those lines:
Traceback (most recent call last):
          File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/commands/block_meta.py", line 1443, in mount_fstab_data
            util.subp(mcmd, capture=True)
          File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/util.py", line 323, in subp
            return _subp(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^
          File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/util.py", line 172, in _subp
            raise ProcessExecutionError(stdout=out, stderr=err,
        curtin.util.ProcessExecutionError: Unexpected error while running command.
        Command: ['mount', '-t', 'crypto_LUKS', '-o', 'defaults', '/dev/nvme0n1p3', '/target/']
        Exit code: 32
        Reason: -
        Stdout: ''
        Stderr: mount: /target: unknown filesystem type 'crypto_LUKS'.
                       dmesg(1) may have more information after failed mount system call.


PRECESELLY
Command: ['mount', '-t', 'crypto_LUKS', '-o', 'defaults', '/dev/nvme0n1p3', '/target/']

TYPE crypto_LUKS DO NOT EXISTS IN "mount" fs types.
SO I MADE A FIX , BUT I CANNOT APPLY IT DUE TO READ-ONLY of the bootstrap installer of yours.

HERE ARE THE SMALL CHANGES in file: /snap/ubuntu-desktop-
bootstrap/366/lib/python3.12/site-packages/curtin/commands/block_meta.py

#LINE 1416 BEFORE def mount_fstab_data(fdata, target=None):
def getLogicalVolume(dev):
    arrCmd=["/usr/bin/lsblk","-P", dev]
    p = subprocess.Popen(arrCmd, stdout=subprocess.PIPE)
    out, err = p.communicate()
    #print("out= ")
    #print(out)
    mys=out.decode('utf-8') #str(out)
    #print(mys)
    #mys=mys.rstrip()
    arrs=mys.split("\n")
    #print(arrs)
    #print("PARSE LINES")
    #theUUID=''
    sLogicalVolume=''
    for s in  arrs:
       #print("'"+s+"'")
       if s.find('TYPE="lvm"')>0 :
        #print("s = ")
        #print(s)
        s=s.split(" ")[0]
        sLogicalVolume=s[5:]
        if sLogicalVolume.startswith('"'):
            sLogicalVolume=sLogicalVolume[1:]
        if sLogicalVolume.endswith('"'):
            sLogicalVolume=sLogicalVolume[:-1]
    sLogicalVolume="/dev/mapper/"+sLogicalVolume
    #print("sLogicalVolume=")
    #print(sLogicalVolume)
    return sLogicalVolume

#IN def mount_fstab_data(fdata, target=None):
#LINE 1464 MUST BE BEFORE LINE "mcmd = ['mount'] "
     if data.fstype=='crypto_LUKS':
       try:
         sLogicalVol=getLogicalVolume(device)
         device=sLogicalVol
         fdata.fstype='ext4'
       except util.ProcessExecutionError as e:
         LOG.exception(e)
         msg = 'Mount failed: %s @ %s with options %s' % (device, mp, options)
         LOG.error(msg)
         raise RuntimeError(msg)

#YOUR LINES
    mcmd = ['mount']
    if fdata.fstype not in ("bind", None, "none"):
        mcmd.extend(['-t', realFsType]) # THIS LINE IS MODIFIED TO CHANGE THE FS TYPE TO "ext4" - YOU SHALL DO IT BETTER
    mcmd.extend(['-o', options, device, mp])


###END OF CHANGES
YOU MUST DO "cryptoSetup luksOpen ...." call to "luksOpen"/open the encrypted partition and the logical volume will be taken by my function and will be used instead the "device" which in your case is my "/dev/nvme0n1p3" - but shall be logical volume name of the LUKS encrypted i.e. "/dev/mapper/ubuntu--vg-ubuntu--lv" .
I have NO idea how to make the call to "cryptoSetup luksOpen ...." and pass the password to open it THAT MUST BE DONE BY YOU. I could do it manually from the console before to run the bootstrap installer.

Could you please FIX AND MAKE AN UPDATE SO I CAN FIX MY COMPUTER - I
LOST A WEEK trying to fix it?????

(PS I would upload part of the log but your "Browse" button do not work
I will see if there is other option, The logs when I got the crashes was
send by the apport tool automaticaly for several days and incl. today
29.May.2025)

** Affects: curtin
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to curtin.
https://bugs.launchpad.net/bugs/2112139

Title:
  Manual re- install Ubuntu 25 on Ubuntu 24 FAILED due to mounting
  crypto_LUKS type of encrypted nvme partition

Status in curtin:
  New

Bug description:
  Setup:
  AMD Ryzen 9 6900HX with Radeon Graphics
  mini computer with 1GB SSD nvme
  Installed Ubuntu 24 LTS  on "/" (root dir/drive/partition) encrypted with LUKS during install.
  The Ubuntu install process created on nvme0n1
  nvme0n1p1 - "/boot/efi" - FAT32
  nvme0n1p2 - "/boot" ETX4
  nvme0n1p3 - "/" - LUKS with EXT4
  Due to :
  apt update
  apt upgrade
  My boot was damaged and as a result I got only:
  The file "/boot/" was not found
  Perhaps the boot loader (WAS NOT GRUB some UEFI I don't know how you did it), so the file perhaps som of the files in /boot/ like vmlinuz.... are not correct in the booting software/config.
  Nothing helped - I installed GRUB and got the menu, BUT same :
  The file "/boot/" was not found

  So I decided to re-install the Ubuntu - but 24 seemed on my flash drive damaged so I used a new USB flash drive and Ubuntu 25 - I repeat version 25.
  Using "Manual installation" I got to point to select 
  Leave unformatted 
  for all 3 drives - well the "/boot" EXT4 did not worked to set it MOUNTPOINT "/boot" .
  After install started if failed and the log got (last lines):
            File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/commands/block_meta.py", line 1448, in mount_fstab_data
              raise RuntimeError(msg)
          RuntimeError: Mount failed: /dev/nvme0n1p3 @ /target/ with options defaults
          Mount failed: /dev/nvme0n1p3 @ /target/ with options defaults

  The reason for the problem is up of those lines:
  Traceback (most recent call last):
            File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/commands/block_meta.py", line 1443, in mount_fstab_data
              util.subp(mcmd, capture=True)
            File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/util.py", line 323, in subp
              return _subp(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^
            File "/snap/ubuntu-desktop-bootstrap/366/lib/python3.12/site-packages/curtin/util.py", line 172, in _subp
              raise ProcessExecutionError(stdout=out, stderr=err,
          curtin.util.ProcessExecutionError: Unexpected error while running command.
          Command: ['mount', '-t', 'crypto_LUKS', '-o', 'defaults', '/dev/nvme0n1p3', '/target/']
          Exit code: 32
          Reason: -
          Stdout: ''
          Stderr: mount: /target: unknown filesystem type 'crypto_LUKS'.
                         dmesg(1) may have more information after failed mount system call.

  
  PRECESELLY
  Command: ['mount', '-t', 'crypto_LUKS', '-o', 'defaults', '/dev/nvme0n1p3', '/target/']

  TYPE crypto_LUKS DO NOT EXISTS IN "mount" fs types.
  SO I MADE A FIX , BUT I CANNOT APPLY IT DUE TO READ-ONLY of the bootstrap installer of yours.

  HERE ARE THE SMALL CHANGES in file: /snap/ubuntu-desktop-
  bootstrap/366/lib/python3.12/site-
  packages/curtin/commands/block_meta.py

  #LINE 1416 BEFORE def mount_fstab_data(fdata, target=None):
  def getLogicalVolume(dev):
      arrCmd=["/usr/bin/lsblk","-P", dev]
      p = subprocess.Popen(arrCmd, stdout=subprocess.PIPE)
      out, err = p.communicate()
      #print("out= ")
      #print(out)
      mys=out.decode('utf-8') #str(out)
      #print(mys)
      #mys=mys.rstrip()
      arrs=mys.split("\n")
      #print(arrs)
      #print("PARSE LINES")
      #theUUID=''
      sLogicalVolume=''
      for s in  arrs:
         #print("'"+s+"'")
         if s.find('TYPE="lvm"')>0 :
          #print("s = ")
          #print(s)
          s=s.split(" ")[0]
          sLogicalVolume=s[5:]
          if sLogicalVolume.startswith('"'):
              sLogicalVolume=sLogicalVolume[1:]
          if sLogicalVolume.endswith('"'):
              sLogicalVolume=sLogicalVolume[:-1]
      sLogicalVolume="/dev/mapper/"+sLogicalVolume
      #print("sLogicalVolume=")
      #print(sLogicalVolume)
      return sLogicalVolume

  #IN def mount_fstab_data(fdata, target=None):
  #LINE 1464 MUST BE BEFORE LINE "mcmd = ['mount'] "
       if data.fstype=='crypto_LUKS':
         try:
           sLogicalVol=getLogicalVolume(device)
           device=sLogicalVol
           fdata.fstype='ext4'
         except util.ProcessExecutionError as e:
           LOG.exception(e)
           msg = 'Mount failed: %s @ %s with options %s' % (device, mp, options)
           LOG.error(msg)
           raise RuntimeError(msg)

  #YOUR LINES
      mcmd = ['mount']
      if fdata.fstype not in ("bind", None, "none"):
          mcmd.extend(['-t', realFsType]) # THIS LINE IS MODIFIED TO CHANGE THE FS TYPE TO "ext4" - YOU SHALL DO IT BETTER
      mcmd.extend(['-o', options, device, mp])

  
  ###END OF CHANGES
  YOU MUST DO "cryptoSetup luksOpen ...." call to "luksOpen"/open the encrypted partition and the logical volume will be taken by my function and will be used instead the "device" which in your case is my "/dev/nvme0n1p3" - but shall be logical volume name of the LUKS encrypted i.e. "/dev/mapper/ubuntu--vg-ubuntu--lv" .
  I have NO idea how to make the call to "cryptoSetup luksOpen ...." and pass the password to open it THAT MUST BE DONE BY YOU. I could do it manually from the console before to run the bootstrap installer.

  Could you please FIX AND MAKE AN UPDATE SO I CAN FIX MY COMPUTER - I
  LOST A WEEK trying to fix it?????

  (PS I would upload part of the log but your "Browse" button do not
  work I will see if there is other option, The logs when I got the
  crashes was send by the apport tool automaticaly for several days and
  incl. today 29.May.2025)

To manage notifications about this bug go to:
https://bugs.launchpad.net/curtin/+bug/2112139/+subscriptions




More information about the foundations-bugs mailing list