freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

GSoC 2024 - Improving Installer with Repair and Upgrade Ability

Open leafoliage opened this issue 1 year ago • 5 comments

Goals of the project

This project aims to improve the FreeBSD installer in three aspects:

  • Adding a repair menu: allows choosing existing partitions in a computer to mount and access for further inspection and repair
  • Adding an upgrade menu: allows choosing existing systems to upgrade to newer version
  • Providing pkg install support: allows pkg installation within live environment out of the box

Project Work Result

Repair Menu

I implemented a menu that looks for freebsd-ufs partitions and zfs pools. They are listed out so that users can choose which partition to mount. After choosing, users can decided whether they want to perform inspections, such as fsck or mtree, with another menu.

The repair menu can deal with systems that has ufs or zfs installed in the officially recommended way. For a ufs installed system, it mounts the selected partition at /mnt. For a zfs installed partition, it imports the selected pool at the mountpoint /mnt. In both cases, the selected inspection is run one by one after they're chosen.

Upgrade Menu

This menu looks for partitions to upgrade. It utilizes the released files tarball and a pre-built etcupdate tree included in the installer to compare with the existing system and upgrade.

The upgrade menu and script prepares an etcupdate tree of the new release in advance and mount the selected partitions at /mnt/system. It compares base.txz and kernel.txz archive contents with /mnt/system directory contents to decide whether a file should be added, modified or removed, and install the changes accordingly. It then runs etcupdate with the pre-built tree to update etc files, and runs pkg upgrade to upgrade packages.

Pkg Installation Support

Network configuration and pkg bootstrapping is called upon exiting into live environment. A tmpfs is mounted under /usr/local where pkgs are extracted.

Future Works

For the repair menu, there isn't a comprehensive way to detect existing freebsd partitions so that any customly installed system can be detected. Also, there are currently only 2 inspection options for ufs and zfs each, so any suggestion for inspecting partitions is encouraged.

For the upgrade menu, the script lacks a comprehensive ability to detect existing system. The upgrade process itself requires more testing to rule out any error it might cause, and its efficiency of installing modified changes should be improved.

For both parts, unit testing and end-to-end testing are still unsupported and encouraged to be implemented.

Useful Links

See more on the project's wiki page

leafoliage avatar Aug 23 '24 14:08 leafoliage

Tagging @khorben because he's working on something similar

concussious avatar Aug 23 '24 20:08 concussious

Tagging @khorben because he's working on something similar

Thanks! I am a GSoC mentor on this project :)

khorben avatar Aug 23 '24 20:08 khorben

This is really nice! Congratulations!

My two future suggestions:

  1. As freebsd-update is about to go, so is its IDS. It would be nice to mimic its functionality by extending the mtree check to use the entire content of the distfiles to generate the spec file and check all files. (A.K.A. poor man's IDS).
  2. The upgrade menu could include an option to upgrade the ESP. It is a common topic on Discord. There is a script in base that I have found to work well (https://github.com/freebsd/freebsd-src/blob/main/tools/boot/install-boot.sh).

Thank you!

jlduran avatar Aug 25 '24 04:08 jlduran

Really nice, looking forward to using it.

The attribution in the commit message should read Sponsored by: Google LLC (GSoC 2024)

soppelmann avatar Aug 26 '24 20:08 soppelmann

This PR would be split into several smaller PRs for the ease of getting works merged, while this PR stays here as a reference. Based on the features this PR provides, there would be 3 derived PRs: repair menu, upgrade menu and pkg support.

The derived PR for pkg support has been opened at #1424 .

Thanks for all of the suggestions!

leafoliage avatar Sep 15 '24 15:09 leafoliage