1

I upgraded 22.04 to 24.04 using the Software Updater GUI (24.04.1 upgrade release). The system is stock Ubuntu with MATE installed as the end-user GUI. The upgrade ran into unrecoverable errors and the system will not reboot, even in safe mode from the boot menu. I have downloaded the 24.04.1 installation ISO image and transferred it onto a USB drive, bootable. The system does boot from this drive and "sees" the original 22.04 files and directories; all of the user files are intact and work with the relevant application from the USB-booted 24.04 system in Try Ubuntu mode. However, the only option that the installation will give me is a clean install, rather than preserving /home /opt and /usr/local. How do I make a 24.04.1 upgrader, not full installer, bootable USB image? If this is not possible, is there a mechanism to preserve the /home /opt /usr/local directories and contents? When the system initially was cleanly installed on a 2 Tbyte NVME internal drive, I recall that the installer REALLY WANTED to make one partition for the Ubuntu image (plus the UEFI secure boot MS partition, not for Ubuntu). If the above is not possible (if it is, please provide full details -- I do not mind typing into a CLI if necessary), there seem to me two possible recourses.

(1) Using try 24.04 and in try mode, mount the NVME disk. Once mounted, remove everything but /home /opt and /usr/local (deleting all the rest of /usr ). Reboot into the installer, have it resize the 22.04 part of the NVME drive (with almost all directories gone), install a minimum 24.04, reboot into 24.04, mount the 22.04 part, and copy from the mounted 22.04 part the contents of /home /opt and /usr/local into /home1 /opt and /usr/local . Assuming all files are now on the new system, fully remove the contents of 22.04 and grow the 24.04 to the full size of the NVME less UEFI boot part plus any overhead that Ubuntu demands (if any). Then manually install all of the rest of the 24.04 system through the CLI apt-get or a GUI package installer/manager.

Other option (2) Get a 22.04 repair installation bootable USB stick (does a repair installation exist?), repair 22.04 to a bootable state, and then try the Software Updater upgrade path to 24.04 once again.

The worst case scenario is to install a new "empty" NVME drive into the machine, do a full fresh install of 24.04, place the existing (unbootable) 22.04 NVME into a USB enclosure, and once done, copy/tar/whatever the needed files from the 22.04 system to the 24.04 system. Repair of the failed 24.04.1 in-situ upgrade would be the easiest. In the case of the physical machine in question, a Dell laptop, replacing the NVME drive is easy because of an external access "door". Any suggestions?

Yasha Karant
  • 1,193

2 Answers2

0

Firstly I would recommend investigating further what caused the installation upgrade to fail. (It might still be fixable.) Were there any errors desplayed that you could add to your question?


What you might do if the above fails?

This next bit is high risk and you should make sure you have made a backup of all of your data and anything else that is not available anywhere else.

From your boot media Ubuntu installation disk OS create three new (ext4) partitions for /opt /home & /usr/local (You might have to resize your broken OS partition to fit them in.) using gparted (graphical partitioning tool). My understanding is that all three of these should not contain anything that interacts directly with the OS dependancy structure. If this is not the case you cannot proceed in this fashion.

/opt is for third-party applications that don't rely on any dependencies outside the scope of said package.

/usr/local is for packages installed on this machine outside the scope of the distribution package manager. (I am not entirely certain there is an option for this in the installer?.)

/home is for user data.


From your boot media installation disk OS move the /opt /home & /usr/local directory:

sudo mount -t auto -v /dev/{partition-name} /mnt/otherDisk

sudo cp /opt /mnt/otherDisk/ (& for the other two).

Make a clean custom install of 24.04 selecting the drives for / /home /opt & /usr/local as per the broken OS and the three new partitions.

After you successfully reboot you will have to re-customise the OS to use all your normal features.


Helpful links

Move /opt to a different, already existing drive

https://unix.stackexchange.com/questions/685/why-put-things-other-than-home-to-a-separate-partition

david
  • 937
0

I do not know the official method that Ubuntu Pro would suggest/provide (Ubuntu Pro being the official support from Ubuntu corporate; Ask Ubuntu is pseudo-support and suggestions in that some questions seem never to be answered nor updated for current releases, even production "enterprise" stable LTS releases). Below I relate what has worked; the target machine with the failed 22.04 to 24.04 upgrade is now working with 24.04 and all relevant non-systems files are present.

  1. I use and install production current Mozilla Firefox and Thunderbird. On a regular basis, export the Firefox password file to a .csv that can later be restored. This was done prior to any of the steps below.

  2. Download the current LTS install ISO from Ubuntu.

  3. Get a "new" USB "thumb" drive ("stick") from a quality manufacturer. (I personally use Sandisk and the like, not an arbitrary manufacturer that may be the least expensive.) Use Startup Disk Creator or the equivalent to produce a bootable USB drive with the step (2) ISO. Note that some of the web sites I have seen state that a 4 GByte drive is sufficient; the current ISO install image is approximately 6 GByte. I used a 16 GByte USB "stick".

  4. Using the vendor interface for the target machine, boot the target machine from the bootable USB drive created in step (3).

  5. Use the "Try Ubuntu" mode after booting.

  6. Verify that you can mount and read the contents of the target machine internal drive. This should show a regular Linux file system with top level directories of / /usr /home and the like. /home /usr/local and /opt are the directories that will be of use in further steps.

  7. Using the repair/service manual for the target machine (not necessarily the end user manual), or reliable sources from the Web, find out how to remove the physical internal drive from the machine. Be certain the target machine has been shut down and power is off; disconnect the target machine from mains (no external power). Again, FOLLOW THE INSTRUCTIONS FOR REMOVAL AND INSTALLATION OF THE DRIVE.

7.1 On the target machine that caused my question and this "answer", there is a door on the bottom of the machine case. Once this door opens, the NVME drive of the machine was accessible and removable.

  1. Remove the internal drive.

  2. Purchase a new internal drive of the same or larger storage capacity and of the type that is compatible with the target machine. (This is very important; for example, Crucial has a configurator on the Crucial web site that will provide information on compatible Crucial drives, memory, etc .) Install the new drive, reconnect mains power, etc . Again, FOLLOW THE INSTRUCTIONS FOR THE HARDWARE -- THIS IS MACHINE SPECIFIC and not answerable herein. In many cases, the service manual will require the service to be done with anti-static methods, included a "grounded" anti-static mat, anti-static wrist band, and anti-static tools. If this is required use it; static electrical charge can permanently damage the electronics of a machine. I have these, grounded to the ground of the building electrical mains. There are adapters to the use the ground of mains.

9.1 In my case, the internal drive was 1 TByte; I installed a new 4 TByte NVME drive.

  1. Install Ubuntu on the target machine with the new drive.

  2. Reboot the machine.

  3. Using an USB adapter enclosure to hold the non-bootable drive, insert the enclosure cable with the drive in the enclosure into a USB port ("jack") on the target machine.

12.1 I have such USB adapter enclosures for SATA drives, for NVME B drives, and NVME M drives. The enclosure is specific for the physical type of drive. I would post here URLs for specific products that I use, but my understanding is that Ask Ubuntu does not permit such.

  1. On the booted Ubuntu, the USB drive from step (12) should appear as mounted. If there are issues, read how to mount such a drive.

13.1 24.04 "automagically" mounted the USB drive. This has been common for Ubuntu for many prior major releases.

  1. Copy the non-systems files from the mounted previous internal drive (steps 12, 13 above) to the current drive. These should only be from /home /usr/local /opt and any other non-systems directories (special names not above); do NOT overwrite or write into any of the systems directories. Do not overwrite any configuration files in any systems directories, etc .

  2. Unmount and remove the USB adapted non-bootable drive.

  3. Reboot the target machine, log in, and do whatever else is required, including apt-get install for which is whatever application one needs.

16.1 In my case, gkrellm is an example of above.

I hope the above is useful when Ubuntu (LTS) upgrade fails but does not damage /home /opt /usr/local .

Yasha Karant
  • 1,193