Skip to content

Latest commit

 

History

History
342 lines (311 loc) · 20 KB

remote-dev.org

File metadata and controls

342 lines (311 loc) · 20 KB

Arch Remote Development Laptop

Target and availability

This guide prepares a Lenovo Legion R9000 with an RTX 4090 Laptop GPU and 64 GB RAM for Windows/Arch dual boot, remote development, and desktop streaming. The exact model suffix/year, CPU, SSD layout, and firmware options still need verification on the target. Commands here run in Bash; installation and sudo steps belong on the new laptop unless labelled as client/source steps.

Use Arch for development, ordinary OpenSSH over Tailscale for access, tmux for interactive work, and Sunshine/Moonlight for the graphical desktop. Windows remains available for games. Only the booted OS runs: Linux jobs and services stop when switching to Windows. Set Arch as the default boot after testing both.

The RTX 4090 Laptop GPU has 16 GB VRAM; the 64 GB system RAM does not increase that capacity. Size ML workloads for the mobile GPU rather than a desktop 4090.

Prepare Windows and inspect hardware

  1. Back up Windows files and recovery media to another device. Save the BitLocker/device-encryption recovery key somewhere accessible without this laptop. Know the Windows account password, not just its Hello PIN.
  2. Record the full Lenovo model/MTM and SSD count in firmware or Windows System Information. Check firmware updates and model-specific Linux reports before changing storage or GPU modes. Do not change RAID/AHCI mode casually.
  3. In an Administrator Windows terminal, powercfg /H off disables hibernation and Fast Startup. Fully shut down Windows before installing Linux.
  4. If using one SSD, shrink Windows using Windows Disk Management, leaving unallocated space for Arch. A second SSD can keep Linux partitions separate; confirm its contents before using it. Budget space for repositories, containers, datasets, and model caches, not just the OS.
  5. Check Secure Boot requirements for the Windows games you keep. The standard Arch install image needs Secure Boot disabled; firmware/boot changes may trigger BitLocker recovery, so suspend protection before those changes. Re-enable protection after validating the final boot arrangement. If games require Secure Boot, plan a signed Arch boot chain with Microsoft’s keys preserved using the Secure Boot guide. Do not clear firmware keys blindly.

See Arch’s Windows dual-boot guidance. Keep Windows EFI, recovery, and reserved partitions. Do not format an existing Windows EFI system partition (ESP).

Install Arch

Download and verify a current image from Arch Linux, write it to a USB drive, then boot the USB in UEFI mode. Use Ethernet if available. First inspect:

lsblk -o NAME,SIZE,MODEL,FSTYPE,PARTTYPENAME,MOUNTPOINTS
lspci -nnk
test -d /sys/firmware/efi/efivars

Identify the Windows disk, ESP, and intended free space by size and model. Device names from another machine are not a partitioning plan.

Follow the installation guide or use archinstall with its manual dual-boot partitioning instructions. Review every create/format action before installation; do not use an entire-disk layout on the Windows disk.

  • Use GPT/UEFI to match Windows. A simple ext4 Linux root is sufficient. Decide on LUKS encryption before partitioning: it protects data at rest, but an ordinary passphrase-encrypted root needs local unlock after a cold boot. This guide does not configure unattended disk unlock.
  • Check ESP capacity before choosing a boot loader. A small Windows ESP may not fit kernels/initramfs for both linux and linux-lts. GRUB can keep these under Linux /boot with the ESP mounted at /efi; systemd-boot needs a suitable ESP/XBOOTLDR layout. Follow the chosen loader’s instructions; do not enlarge or format the Windows ESP by guesswork.
  • Install a normal user with sudo, networking, firmware, timezone/locale, and the microcode package matching the actual CPU (amd-ucode for AMD, intel-ucode for Intel). Do not copy the MateBook’s Intel setting blindly.
  • Start with a minimal system. Use hostname dorm-dev and username wste if retaining the existing paths; adapt examples if choosing different names. Add Hyprland after SSH and networking work. No desktop login is needed for the SSH server or GPU compute.
  • If adding linux-lts as a recovery kernel, ensure the boot loader actually offers it. Test it locally before depending on remote recovery.

Reboot into both Windows and Arch before moving on. Keep the USB for recovery. Confirm networking returns after an Arch reboot without logging into a desktop. For NetworkManager installations, enable NetworkManager.service and ensure the connection credentials are available at boot, outside a locked user keyring.

NVIDIA and development tools

For the RTX 4090’s Ada generation, Arch supports the open NVIDIA kernel module. With the standard linux kernel:

sudo pacman -Syu --needed base-devel git openssh tailscale tmux rsync \
    fish starship zoxide direnv ripgrep fd fzf vim \
    linux-headers nvidia-open-dkms nvidia-utils

If also installing linux-lts, install linux-lts-headers for its DKMS build. Use the package-managed driver; follow Arch’s NVIDIA guidance if hardware or package names differ. Do not layer NVIDIA’s standalone driver installer over it. Reboot after installation and inspect:

uname -r
dkms status
lspci -k -d ::03xx
nvidia-smi

Confirm the NVIDIA driver is loaded and both installed kernels have modules. Hybrid graphics may render the desktop on the AMD iGPU while NVIDIA handles compute/encoding. Confirm actual devices before forcing GPU IDs or MUX modes.

Install project runtimes separately. Recreate Python environments from lockfiles on Linux rather than copying virtual environments from Windows or this machine. Install CUDA tooling only when a project needs it; driver installation alone does not validate an ML framework. Run that project’s GPU smoke test before leaving the laptop unattended.

Private access from the dorm and outside

Network check

The dorm’s supplied tailscale netcheck reported UDP available, IPv4 available, no IPv6, MappingVariesByDestIP: false, and no detected captive portal. These are favorable signs for NAT traversal, not proof of a direct peer link. No automatic port mapping was reported; none is required just to try Tailscale. The Singapore DERP probe was about 42 ms: this is not peer latency or a desktop-stream bandwidth measurement. Do not use the observed public address as a stable host address.

Install Tailscale on both devices, sign into the same tailnet, and permit only the intended client/user in tailnet access controls. See connection types. On the host:

sudo systemctl enable --now tailscaled
sudo tailscale up
tailscale status
tailscale ip -4

This guide uses ordinary sshd over the private network; do not enable tailscale up --ssh as an additional authentication mechanism.

On the client, test from another network, such as a phone hotspot:

tailscale ping dorm-dev
tailscale status

Enable MagicDNS for dorm-dev, or use the host’s tailscale ip -4 address. Look for a direct connection after discovery. A relayed connection can support terminal work, but measure desktop performance before relying on it. Try wired Ethernet and inspect both peers if it remains relayed; no VPS is needed before this test. The initial “No DERP map” message in netcheck alone does not establish login or peer connectivity; check tailscale status too.

SSH keys, firewall, and authentication

Generate a passphrase-protected client key with ssh-keygen -t ed25519 if one is not already available. Copy only its public .pub line to the host user’s ~/.ssh/authorized_keys, using the host’s local console for initial setup. Use mode 700 for ~/.ssh and 600 for authorized_keys. Verify the host key fingerprint at the console before accepting it on the client.

Use a host firewall with default-deny incoming on the dorm-facing interfaces. Do not reuse the MateBook guide’s whole-LAN allow rule or expose SSH publicly. For a fresh UFW setup at the local console, replace CLIENT_TAILSCALE_IP below with the client’s actual Tailscale IPv4 address:

sudo pacman -S --needed ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow in on tailscale0 from CLIENT_TAILSCALE_IP
sudo ufw enable
sudo systemctl enable ufw
sudo systemctl enable --now sshd

That rule permits this client’s desktop streaming too. Review existing firewall rules instead of resetting them. Tailscale manages its own netfilter rules, so enforce access between tailnet peers in the tailnet policy as well; UFW rules alone are not a tailnet authorization boundary. Check Tailscale firewall guidance.

On the client, connect explicitly with public-key authentication:

ssh -o PasswordAuthentication=no -o KbdInteractiveAuthentication=no wste@dorm-dev

After this succeeds, keep it open and deploy the SSH authentication drop-in on the host. Inspect existing files first:

ls -ld /etc/ssh/sshd_config /etc/ssh/sshd_config.d
sudo sshd -T

Ensure /etc/ssh/sshd_config includes /etc/ssh/sshd_config.d/*.conf before conflicting settings; OpenSSH generally uses the first value. Compare an existing destination before installing from the new laptop’s checkout:

sudo install -m 644 ~/dotfile/ssh/sshd-remote-dev.conf /etc/ssh/sshd_config.d/00-remote-dev.conf
sudo sshd -t
sudo sshd -T | rg -i '^(permitrootlogin|pubkeyauthentication|passwordauthentication|kbdinteractiveauthentication) '

Expect root login no, public keys yes, and both password mechanisms no. If validation fails, correct the configuration before reload. Otherwise run sudo systemctl reload sshd and verify a second client login before closing the first. Keep SSH TCP forwarding available for editors and local web tools.

Optionally add a client-only host entry to ~/.ssh/config after comparing it:

Host dorm-dev
    HostName dorm-dev
    User wste
    ServerAliveInterval 30
    ServerAliveCountMax 3

Use the chosen key’s IdentityFile if the client has several identities. Use tmux new-session -A -s dev for persistent interactive work. Bind dev servers/Jupyter to loopback and forward ports, for example ssh -N -L 8888:127.0.0.1:8888 dorm-dev. For jobs that must survive reboots, use a project-specific systemd service; tmux only survives disconnection.

Full desktop: Sunshine and Moonlight

Install Hyprland and its dependencies using the system guide, after adapting the machine-specific items below. For desktop streaming, install the native Arch package using Sunshine’s current installation instructions and Moonlight on the client using its setup guide. Sunshine’s package may require its upstream repository; it is not part of the base package command above.

  1. Start Sunshine inside the host’s logged-in graphical session. Follow the installed package’s capture and virtual-input setup, including any required permissions; test as the normal user rather than running it as root.
  2. Set credentials at https://localhost:47990 on the host. For remote administration, forward it with ssh -N -L 47990:127.0.0.1:47990 dorm-dev, then use that local URL. Keep UPnP disabled; do not publish the web UI or streaming ports on the internet.
  3. Add the host’s Tailscale IP manually in Moonlight, pair the displayed PIN through Sunshine, and launch Desktop. Permit the required streaming traffic in tailnet policy for this client; SSH permission alone is insufficient.
  4. Begin with 1080p/60 and a modest bitrate, then measure at the actual remote location. Verify hardware encoding, audio, keyboard/mouse, and acceptable text clarity. Use SSH/rsync for file transfer.
  5. Enable the package’s Sunshine user service only after manual streaming works. Verify its installed unit name using systemctl --user list-unit-files '*sunshine*' '*Sunshine*'. Log out/in and reboot locally to test its actual startup behavior.

This streams a graphical session; installing a service does not create a usable Hyprland session at the login screen. A cold boot may still need local disk unlock, desktop login, or capture approval. Test reconnecting after screen lock and display power-off before relying on it. Keep the lid open initially; lid closure can remove the captured display even if suspend is disabled. Unattended graphical startup or a virtual display needs a separate, hardware-tested setup. Do not enable automatic desktop login by assumption.

Migrate configuration selectively

Clone the repository on the new host with HTTPS initially (no private key needed): git clone https://github.com/wusitee/dotfile.git ~/dotfile. Inspect each destination with ls -ld and readlink -f, and compare existing files. Back up independent files before replacement. Do not copy all of ~/ or ~/.config/ into Git or onto the new host.

Repository configuration

  • Fish: install fish starship zoxide direnv before using fish/config.fish. The live config differs: it also sets an SSH-agent socket and a Kimi path. Review those separately; a path to a socket does not create an SSH agent. Link/copy individual functions under fish/functions/, preserving live universal variables. The Claude/T3 wrappers depend on the local proxy check and paths; inspect them before deployment.
  • Starship: the current copy is under ~/.config/starship/starship.toml, but the usual default is ~/.config/starship.toml. On a fresh target, after resolving any existing file, use ln -s ../dotfile/starship/starship.toml ~/.config/starship.toml.
  • Vim: link only vim/vimrc to ~/.vimrc. Install desired plugins separately; the old ~/.vim/plugin/ is outside Git. Doom: follow doom/AGENTS.md and the system guide to install/tangle/sync; do not copy generated config.el.
  • Git: git/config and git/ignore capture the source machine’s identity, signed-commit preference, and global ignore rule without credentials. On a fresh target with no conflicting files, mkdir -p ~/.config/git, then use ln -s ../../dotfile/git/config ~/.config/git/config and ln -s ../../dotfile/git/ignore ~/.config/git/ignore. An existing ~/.gitconfig has higher precedence, so compare it too. Provision a signing key and verify a signed commit before depending on Git; no signing private key is included.
  • Hyprland: adapt a separate target copy first. hyprland_common.lua starts matebook-applet, Dayline, OneDrive, and other local tools; it assumes scale 2. hypridle.conf requests suspend after 30 minutes. Remove that automatic suspend action from the target copy for remote use while retaining locking. Check hyprctl configerrors and the NVIDIA/portal setup after deployment.
  • Waybar: verify battery, backlight, network, and Dayline paths on the R9000. Pending uncommitted source-machine edits are not included by cloning Git.
  • Rime: deploy only rime/default.custom.yaml; preserve dictionaries/user data separately. The fcitx5/ and Neovim snapshots differ from the live setup. Compare them rather than treating the snapshots as current backups.

Files outside the repository

The source-machine audit also found these categories; migrate them separately:

ItemTreatment
~/.config/fish/config.fish, conf.d/, functionsReview differences and required executables; preserve shell state separately
~/.config/nvim/Compare live init.lua and plugins with the older tracked snapshot
~/.ssh/config and SSH identitiesReview host rules; generate a separate host keypair for Git access; transfer public keys only by default
~/.gnupg/, .authinfo, .authinfo.gpg, password databasesEncrypted backup or explicit key export/import; keep out of Git; retain Emacs auth-source
CLI/provider authentication, .npmrc, app profilesReinstall and authenticate on the target; do not copy tokens into dotfiles
~/.local/bin/Reinstall owning tools: current entries mostly link into package/tool environments
~/code/Dayline/ and other projectsClone repositories; transfer uncommitted/untracked work privately; recreate dependencies
Org notes, datasets, databases, Rime user dataSeparate private backup/sync; database-consistent export where applicable
/etc/ and user servicesInventory and recreate only understood settings; do not copy hardware config wholesale

For a private transfer, start with a targeted dry run such as rsync -an --itemize-changes ~/code/PROJECT/ wste@dorm-dev:code/PROJECT/ after creating the target directory. Review the file list, then remove -n to copy. This includes untracked files/secrets in that project, so choose the scope deliberately. Do not add --delete. Rebuild virtualenvs, node_modules, and other machine-dependent outputs instead of transferring them.

For package inventory, save pacman -Qqen and pacman -Qqem privately on the source. Treat them as reference lists, not bulk install scripts: MateBook drivers and unrelated desktop applications are not host requirements.

Power, recovery, and acceptance checks

Keep the laptop on AC with clear airflow. Use Lenovo-supported battery conservation controls if available for this exact model; do not deploy dotfiles-huawei-wmi/, huawei-wmi, or matebook-applet. Avoid installing multiple competing power-management daemons.

For AC lid behavior, a target-local /etc/systemd/logind.conf.d/60-remote-dev.conf can contain the following after comparing existing settings:

[Login]
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
IdleAction=ignore

Apply with a planned local reboot. This leaves ordinary battery lid suspend but changes AC behavior. Desktop power managers and low-level inhibitors can override logind; inspect systemd-inhibit --list and test actual behavior. See logind.conf. Do not enable this repository’s on-demand lid/idle hold services at login as a substitute for a host power policy. Avoid remote firmware changes or first-time kernel/driver reboots without local recovery.

Before leaving the dorm:

  • [ ] Windows and Arch both boot; Arch is the default; recovery media/keys work.
  • [ ] Networking, Tailscale, and SSH recover after a local reboot, accounting for any encrypted-root unlock. Review Tailscale node-key expiry for an unattended host using the server guidance.
  • [ ] A second key-only SSH login succeeds; effective sshd settings match the drop-in. A non-tailnet connection cannot reach host services.
  • [ ] tailscale ping from outside the dorm confirms the actual path and latency. Moonlight works from that location at the selected bitrate.
  • [ ] NVIDIA compute and desktop encoding work; a disconnected SSH client can reattach to the tmux session.
  • [ ] Desktop reconnect after locking/display-off works; local login and cold-boot limitations are understood. Lid behavior and temperatures are tested locally before attempting closed-lid operation.
  • [ ] Private files are backed up off the laptop. Disk space, updates, and recovery access have an owner; snapshots alone are not an off-device backup.

No target partitioning, installation, configuration deployment, or power-policy changes are performed merely by adding this guide to the repository.