Overview

Today I transformed a broken Lenovo K20 laptop (dead screen) into a headless Debian 12 server using OpenClaw to manage the entire installation process remotely.

This post documents the challenges, solutions, and step-by-step process of installing Debian on a laptop with no display, using another computer (Raspberry Pi 5) as the installation platform.

The Problem

Hardware Situation

DeviceStatusIssue
Lenovo K20⚠️ Broken screenCannot see BIOS/installation
Raspberry Pi 5βœ… WorkingUsed as installation platform
USB Boot Driveβœ… Debian 13 installerBootable installation media

Challenges

  1. No display output - K20 screen is dead, external monitor not working
  2. Cannot navigate BIOS - Can't see boot menu or installation screens
  3. Need remote management - Must configure WiFi and SSH before first boot
  4. UEFI boot issues - Required proper EFI bootloader configuration

Solution: OpenClaw-Assisted Installation

Instead of traditional installation methods, I used OpenClaw (my AI assistant) to:

  1. Mount the K20 hard drive on Pi5 via USB adapter
  2. Create partitions and install Debian base system
  3. Configure WiFi credentials in advance
  4. Set up SSH for remote access
  5. Fix EFI bootloader for automatic startup

Step-by-Step Process

Phase 1: Hardware Preparation

# 1. Remove K20 hard drive (2.5" SATA)
# 2. Connect to Pi5 via SATA-to-USB adapter
# 3. Verify detection
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Phase 2: Partition and Install

# Create GPT partition table
sudo parted /dev/sdc mklabel gpt
sudo parted /dev/sdc mkpart primary fat32 1MiB 513MiB
sudo parted /dev/sdc mkpart primary ext4 513MiB 100%
sudo parted /dev/sdc set 1 esp on

# Format partitions
sudo mkfs.vfat -F 32 /dev/sdc1
sudo mkfs.ext4 -F /dev/sdc2

Phase 3: Debootstrap Installation

# Install base Debian 12 (bookworm) system
sudo debootstrap --arch amd64 bookworm /mnt/k20 http://mirrors.ustc.edu.cn/debian

# Fix passwd package (common issue in chroot)
sudo chroot /mnt/k20 bash -c "touch /etc/shadow /etc/gshadow && chmod 640 /etc/shadow /etc/gshadow"
sudo chroot /mnt/k20 bash -c "dpkg --configure passwd"
sudo chroot /mnt/k20 bash -c "dpkg --configure -a"

Phase 4: Install Kernel and SSH

# Mount necessary filesystems for chroot
sudo mount --bind /dev /mnt/k20/dev
sudo mount --bind /proc /mnt/k20/proc
sudo mount --bind /sys /mnt/k20/sys

# Install kernel, GRUB, and SSH
sudo chroot /mnt/k20 bash -c "apt update && apt install -y linux-image-amd64 grub-efi-amd64 ssh network-manager vim"

Phase 5: Configure WiFi (Critical!)

Since the K20 has no display, it must connect to WiFi automatically on first boot:

# Create NetworkManager configuration
sudo tee /mnt/k20/etc/NetworkManager/system-connections/5G.nmconnection << 'EOF'
[connection]
id=5G
uuid=12345678-1234-1234-1234-123456789012
type=wifi
interface-name=wlan0

[wifi]
mode=infrastructure
ssid=私用δ»₯ε€ͺδΉ‹ε…‰_5G

[wifi-security]
key-mgmt=wpa-psk
psk=65482908

[ipv4]
method=auto

[ipv6]
method=auto
EOF

sudo chmod 600 /mnt/k20/etc/NetworkManager/system-connections/5G.nmconnection

Phase 6: Create Users and SSH Keys

# Set root password
ROOT_HASH=$(openssl passwd -6 'k20root')
sudo tee /mnt/k20/etc/shadow > /dev/null << EOF
root:${ROOT_HASH}:19800:0:99999:7:::
EOF

# Create henry user
HENRY_HASH=$(openssl passwd -6 'k20henry')
sudo tee -a /mnt/k20/etc/shadow > /dev/null << EOF
henry:${HENRY_HASH}:19800:0:99999:7:::
EOF

Phase 7: Fix EFI Bootloader

This was the trickiest part - without proper EFI bootloader, the K20 won't start:

# Download GRUB EFI bootloader
curl -sL -o /tmp/grubx64.efi \
  https://mirrors.ustc.edu.cn/debian/dists/bookworm/main/installer-amd64/current/images/netboot/debian-installer/amd64/grubx64.efi

# Copy to EFI partition
sudo cp /tmp/grubx64.efi /mnt/k20/boot/efi/EFI/BOOT/BOOTX64.EFI
sudo cp /tmp/grubx64.efi /mnt/k20/boot/efi/EFI/debian/grubx64.efi

# Create GRUB configuration
sudo tee /mnt/k20/boot/efi/EFI/BOOT/grub.cfg > /dev/null << 'EOF'
set timeout=5
search.fs_uuid f874e2b1-ea2f-4e0a-8cb2-8a1e8878a972 root
set prefix=($root)/boot/grub
configfile ($root)/boot/grub/grub.cfg
EOF

Results

MetricValue
Installation Time~2 hours
SystemDebian 12 (bookworm)
Kernel6.1.0-42-amd64
Disk Usage55.4G available
Boot Time~90 seconds
WiFiβœ… Auto-connect working
SSHβœ… Remote access working

Lessons Learned

What Worked Well

  1. OpenClaw automation - AI assistant handled complex chroot operations
  2. Pre-configured WiFi - Critical for headless setup
  3. Debian debootstrap - Reliable base installation
  4. Manual EFI bootloader - Solved boot issues

Challenges

  1. qemu-user emulation - Some packages failed to configure in chroot
  2. EFI bootloader missing - Had to download and copy manually
  3. USB 2.0 speed - Slow data transfer (~3 MB/s)
  4. No display debugging - Couldn't see boot messages

Conclusion

Installing Debian on a laptop with a broken screen is challenging but entirely possible with the right approach. Using OpenClaw to automate the installation process and pre-configuring network settings made this a successful headless server setup.

Total cost: $0 (repurposing old hardware)
Time invested: ~2 hours
Result: Fully functional headless Debian server! πŸŽ‰