Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions linux/fix-broken-distro/BROKEN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Broken Configuration Issues

This document lists all the deliberate errors introduced into the Linux distribution build configuration. The goal is to test whether an LLM agent can identify and fix these issues.

## 1. Architecture Issues

### File: `debootstrap.conf`
- **Issue**: Architecture is set to `i368` instead of valid architecture
- **Correct values**: `i386`, `amd64`, `arm64`, `armhf`, etc.
- **Impact**: Debootstrap will fail immediately as it cannot find packages for invalid architecture
- **Difficulty**: Easy - debootstrap will error clearly

## 2. Missing Critical Packages

### File: `debootstrap.conf`
- **Issue**: No Linux kernel package in INCLUDE_PACKAGES
- **Missing**: `linux-image-amd64` or `linux-image-generic` or similar
- **Impact**: System will be created but cannot boot without a kernel
- **Difficulty**: Medium - build succeeds but system won't boot

## 3. Filesystem Type Error

### File: `fstab`
- **Issue**: Root filesystem type is `ext5` which doesn't exist
- **Correct**: `ext4`, `ext3`, `ext2`, `xfs`, `btrfs`, etc.
- **Impact**: System will fail to mount root filesystem during boot
- **Difficulty**: Easy - well-documented error

## 4. Missing Critical Mount Points

### File: `fstab`
- **Issue**: Missing `/proc`, `/sys`, and `/dev/pts` entries
- **Required entries**:
```
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
```
- **Impact**: System will have non-functional /proc, /sys, and pseudo-terminals
- **Difficulty**: Medium - system may partially boot but be unusable

## 5. Invalid Swap Device

### File: `fstab`
- **Issue**: Swap device `/dev/sda99` is unlikely to exist
- **Impact**: Boot warnings/errors, no swap space
- **Difficulty**: Easy - can be commented out or fixed

## 6. GRUB Installation Typo

### File: `grub-config.sh`
- **Issue**: Command is `grub-instal` instead of `grub-install`
- **Impact**: Script will fail with "command not found"
- **Difficulty**: Easy - clear error message

## 7. Wrong GRUB Device

### File: `grub-config.sh`
- **Issue**: Installing to `/dev/sdc` which may not exist
- **Should be**: `/dev/sda` or `/dev/vda` (for VM)
- **Impact**: GRUB may fail to install or install to wrong device
- **Difficulty**: Medium - depends on build environment

## 8. Missing GRUB Configuration Generation

### File: `grub-config.sh`
- **Issue**: No `grub-mkconfig` command to generate grub.cfg
- **Required**: `grub-mkconfig -o /boot/grub/grub.cfg`
- **Impact**: No boot menu, system cannot boot
- **Difficulty**: Medium - GRUB will be installed but won't boot

## 9. Missing GRUB Environment Block

### File: `grub-config.sh`
- **Issue**: No grubenv creation
- **Required**: `grub-editenv /boot/grub/grubenv create`
- **Impact**: GRUB may fail or have issues saving state
- **Difficulty**: Hard - may work but cause subtle issues

## 10. Missing Kernel Boot Parameters

### File: `grub-config.sh`
- **Issue**: No default kernel parameters configured
- **Required**: Set `root=UUID=xxx ro quiet` or similar
- **Impact**: Kernel may not find root filesystem
- **Difficulty**: Medium - related to fstab and GRUB config

## 11. Invalid Network Interface

### File: `setup-chroot.sh`
- **Issue**: Network interface named `eth99` which won't exist
- **Should be**: `eth0`, `enp0s3`, or use predictable names
- **Impact**: No network connectivity after boot
- **Difficulty**: Easy - but requires understanding modern network naming

## 12. Wrong Kernel Package Name

### File: `setup-chroot.sh`
- **Issue**: Package `linux-image-generic-x86` doesn't exist in Debian
- **Correct**: `linux-image-amd64` for Debian or `linux-image-generic` for Ubuntu
- **Impact**: apt-get will fail to install kernel
- **Difficulty**: Easy - package manager will error

## 13. Interactive Password Command

### File: `setup-chroot.sh`
- **Issue**: `passwd root` command requires interactive input
- **Should use**: `echo "root:password" | chpasswd` or similar
- **Impact**: Build will hang waiting for input
- **Difficulty**: Medium - needs non-interactive alternative

## 14. Missing Locale Generation

### File: `setup-chroot.sh`
- **Issue**: No locale generation configured
- **Required**: Configure `/etc/locale.gen` and run `locale-gen`
- **Impact**: System warnings, potential issues with character encoding
- **Difficulty**: Medium - system may work but with warnings

## 15. Missing Timezone Configuration

### File: `setup-chroot.sh`
- **Issue**: No timezone set
- **Required**: `ln -sf /usr/share/zoneinfo/UTC /etc/localtime`
- **Impact**: Wrong system time, log timestamps
- **Difficulty**: Easy - well-documented

## 16. Missing DNS Configuration

### File: `setup-chroot.sh`
- **Issue**: No `/etc/resolv.conf` created
- **Required**: Configure nameservers
- **Impact**: No DNS resolution, cannot download packages or access internet
- **Difficulty**: Easy - obvious when networking fails

## Summary Statistics

- **Total Issues**: 16
- **Easy to fix**: 7 (typos, obvious errors)
- **Medium difficulty**: 7 (missing configurations, wrong parameters)
- **Hard to fix**: 2 (subtle issues that might work partially)

## Expected Agent Behavior

A successful debugging agent should:
1. Read and understand all configuration files
2. Identify issues through static analysis before running builds
3. Run the build and observe error messages
4. Fix errors iteratively
5. Verify fixes don't introduce new problems
6. Test the final system boots correctly

## Success Criteria

- All 16 issues identified
- All issues fixed correctly
- Final system can complete debootstrap
- System configuration is valid
- Documentation of debugging process
33 changes: 33 additions & 0 deletions linux/fix-broken-distro/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian:bookworm

# Install debootstrap and required tools
RUN apt-get update && \
apt-get install -y \
debootstrap \
qemu-utils \
grub-pc-bin \
grub-efi-amd64-bin \
parted \
dosfstools \
e2fsprogs \
&& rm -rf /var/lib/apt/lists/*

# Create working directory
WORKDIR /workspace

# Copy configuration files
COPY debootstrap.conf /workspace/
COPY fstab /workspace/
COPY grub-config.sh /workspace/
COPY setup-chroot.sh /workspace/

# Copy fixed versions for reference
COPY debootstrap.conf.fixed /workspace/fixed/
COPY fstab.fixed /workspace/fixed/
COPY grub-config.sh.fixed /workspace/fixed/
COPY setup-chroot.sh.fixed /workspace/fixed/

# Make scripts executable
RUN chmod +x /workspace/*.sh /workspace/fixed/*.sh

CMD ["/bin/bash"]
135 changes: 135 additions & 0 deletions linux/fix-broken-distro/EXPERIMENT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Fix Broken Linux Distribution Build
category: linux-distro-debugging
difficulty: hard
estimated_steps: 100

description: |
Debug and fix a deliberately broken Linux distribution build configuration.
The configuration contains 16 common issues spanning architecture settings,
package dependencies, filesystem configuration, bootloader setup, and system
initialization. Tests an agent's ability to identify root causes and fix
complex multi-file system configuration problems.

task_type: debugging
skills_required:
- Linux system administration
- Debootstrap/package management
- Filesystem configuration
- Bootloader (GRUB) setup
- Multi-file dependency analysis
- Build system debugging

tools_needed:
- debootstrap
- grub-pc-bin
- qemu-utils (optional, for boot testing)
- Docker (for isolated build environment)

success_criteria:
- Identify all 16 configuration errors
- Fix architecture specification
- Add missing kernel package
- Correct filesystem types
- Add critical mount points
- Fix GRUB installation script
- Correct package names
- Make all commands non-interactive
- Add locale and timezone configuration
- Configure DNS resolution
- Successfully complete debootstrap build

failure_modes:
- Missing issues during static analysis
- Fixing symptoms instead of root causes
- Creating circular dependencies
- Breaking working configurations while fixing broken ones
- Not understanding build vs. runtime errors
- Distribution-specific package naming confusion

issues_breakdown:
critical: 8 # Block build or boot completely
high: 4 # Severely degrade functionality
medium: 2 # Minor functionality issues
low: 2 # Cosmetic or optional features

expected_debugging_flow:
- Read and analyze configuration files
- Create systematic test framework
- Run static validation checks
- Identify issues by category
- Prioritize critical fixes
- Fix issues iteratively
- Validate each fix doesn't break others
- Document debugging process

key_challenges:
- Multi-file dependencies require understanding entire system
- Some errors only manifest at runtime (boot time)
- Package names vary between distributions
- Need to distinguish critical vs. optional fixes
- Interactive commands must be converted to non-interactive
- GRUB configuration requires specific sequence

evaluation_metrics:
issues_found: 16
critical_fixed: 8
build_success: true
boot_success: true # If tested with QEMU
documentation_quality: high

time_estimate:
static_analysis: "15 minutes"
test_creation: "20 minutes"
issue_identification: "25 minutes"
fixing_iteration: "40 minutes"
validation: "15 minutes"
documentation: "20 minutes"
total: "2-3 hours"

reference_files:
broken_config:
- debootstrap.conf
- fstab
- grub-config.sh
- setup-chroot.sh
fixed_config:
- debootstrap.conf.fixed
- fstab.fixed
- grub-config.sh.fixed
- setup-chroot.sh.fixed
documentation:
- BROKEN.md
- trajectories/SUMMARY.md
automation:
- test-build.sh
- build.sh
- build-fixed.sh
- Dockerfile

testing:
unit_tests: test-build.sh validates configuration correctness
integration: build.sh runs complete debootstrap process
validation: build-fixed.sh demonstrates working configuration

extensions:
- Add QEMU boot test to verify system actually boots
- Create more subtle bugs requiring deeper analysis
- Add performance issues (slow but working configs)
- Test across multiple distributions (Debian/Ubuntu/Fedora)
- Add security misconfigurations to identify

related_skills:
- Kernel configuration
- Init system setup (systemd)
- Network configuration
- Package dependency resolution
- Shell scripting
- Container/virtualization concepts

learning_outcomes:
- Understanding Linux boot process
- Debootstrap workflow
- Common build configuration errors
- Systematic debugging methodology
- Multi-component system thinking
- Build vs. runtime error distinction
Loading