Improving Repair Ability of the FreeBSD Installer

Project description

This project aims to improve the FreeBSD installer in three aspects: adding a repair menu, adding an upgrade menu and modifying the liveCD environment to facilitate pkg install. The repair menu would allow users to choose existing partitions in a computer to mount and access for further inspection and repair. The upgrade menu would allow users to choose existing systems to upgrade to newer version. Lastly, the liveCD would be modified to allow pkg installation within out of the box.

Approach to solving the problem

Repair Menu

Upgrade Menu

Pkg Installation Support

Deliverables

Milestones

Repair Menu

  1. Grep and mount file systems manually
  2. Add a bsdinstall menu button: Repair
  3. Implement script that lists mountable partitions, and mounts partition upon select

Upgrade Menu

  1. Write an automatic update script
  2. Add a bsdinstall menu button: Update
  3. Implement script that lists updatable partitions, and updates it upon select

Pkg Installation Support

  1. Mount /usr/local tmpfs upon selecting live environment
  2. Configure network with either bsdconfig/bsdinstall/dhcp
  3. Configure pkg so that it works out of the box

Test Plan

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.

What's left to do

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.

The Code

Here is the pull request of my work: freebsd/freebsd-src - GSoC 2024-Improving Installer with Repair and Upgrade Ability

How to run this code

  1. Apply the changes to the corresponding files in /usr/src according to this PR

  2. cd /usr/src

  3. make clean and then make cdrom (or make memstick)

  4. Installation would be built under /usr/obj

Status Report

Date

Description

6/14

Added /usr/local tmpfs. Tried grepping and mounting ufs and zfs partition.

6/26

Added network setting in live environment. Added repair menu listing ufs partitions and zpools.

7/3

Added pkg bootstrap option in live environment. Added simple repair script (fsck, mtree) after target repairing partition mounted.

7/10

Added a selection menu for the repair script to select which repairing commands to use.

8/1

Tried out several approaches to see if I can upgrade a system with base.txz and kernel.txz in the installer.

8/8

Reference freebsd-update and build from source update to devise a prodedure to upgrade with installer.

8/15

Studied freebsd-update and etcupdate, and modified upgrade script.

8/23

Fixed upgrade scriptto avoid excessive memory usage. Wrapped up GSoC work.


CategoryGsoc

SummerOfCode2024Projects/ImprovingRepairAbilityOfTheFreeBSDInstaller (last edited 2024-11-01T00:29:56+0000 by MarkLinimon)