🤖 Claude Code na Linux — post-install

Pełen restore state z Windows session: memory + past conversation history + project conventions.

⚡ Just installed Pop!_OS? Run this:
curl -fsSL https://raw.githubusercontent.com/f1th4p/pc-services/main/scripts/setup-linux.sh | bash

Skrypt robi 11 kroków idempotent: apt deps + fsearch + Chrome + Tailscale + NVIDIA verify + env restore + rclone + git clone repos + venvs + Claude Code + state restore + systemd units. ETA ~15-20 min. Log: ~/setup-linux.log.

Co Claude wie po starcie

3 warstwy state:

WarstwaCo zawieraMigracja
CLAUDE.md (w repo) Project conventions: PowerShell pwsh syntax (post-Linux: bash), Tailscale IPs, FastAPI defaults, "DO NOT public exposure", komunikacja PL ✅ Auto: git clone pc-services przywróci
Memory files
~/.claude/projects/<cwd>/memory/*.md
~30 persistent memory entries: user profile, feedback rules, project state (Linux migration, Drive backup, Gemini PRIMARY v22, watchdog tuning, Supabase claude_handoff scripts, drukarka USB, _Projekty na D:...) Manual copy z D:/backups/pre-linux-migration/claude-state/
Past sessions
*.jsonl
32+ MB conversation history z 2026-05-19+ — pełen kontekst architectural decisions, sweep audyt iteracji v15→v22, decisions log Manual copy (optional, przydatne dla claude --resume)

Setup steps (jeśli setup-linux.sh nie wystarczył)

1. Install Claude Code

# Method A: curl one-liner (recommended)
curl -fsSL https://claude.ai/install.sh | sh

# Method B: npm (wymaga Node.js >= 20)
sudo apt install -y nodejs npm
npm install -g @anthropic-ai/claude-code

# Verify
claude --version

2. Login + auth

claude
# Prompt asks for API key OR browser OAuth flow
# Bartek's account: f1th4p@gmail.com (Anthropic Console)

3. Restore Claude state

Linux Claude Code folder encoding różni się od Windows:
Windows: C:\Users\bartekp\Developer\pc-servicesC--Users-bartekp-Developer-pc-services
Linux: /home/bartekp/Developer/pc-services-home-bartekp-Developer-pc-services

mkdir -p ~/.claude/projects
SRC=/mnt/d/backups/pre-linux-migration/claude-state/C--Users-bartekp-Developer-pc-services
DST=~/.claude/projects/-home-bartekp-Developer-pc-services

cp -r "$SRC" "$DST"

# Verify
ls -la ~/.claude/projects/-home-bartekp-Developer-pc-services/memory/
# Powinno pokazać ~30 .md files: feedback_*.md, project_*.md, etc.

4. Clone repos + setup env + secrets

mkdir -p ~/Developer
cd ~/Developer
git clone https://github.com/f1th4p/pc-services.git
git clone https://github.com/f1th4p/health.git

# Env vars z backup → ~/.bashrc
cat /mnt/d/backups/pre-linux-migration/env-vars.txt | grep '^[A-Z]' | sed 's/^/export /' >> ~/.bashrc

# Supabase PAT
mkdir -p ~/.config
cp /mnt/d/backups/pre-linux-migration/supabase-cli-pat ~/.config/
chmod 600 ~/.config/supabase-cli-pat

# rclone gdrive (Drive backup target)
mkdir -p ~/.config/rclone
cp /mnt/d/backups/pre-linux-migration/rclone.conf ~/.config/rclone/
chmod 600 ~/.config/rclone/rclone.conf
rclone lsd gdrive:   # verify Drive access

5. Start Claude z full context

cd ~/Developer/pc-services
claude --resume   # continue last Windows session

# OR fresh start (Claude czyta CLAUDE.md + memory automatically):
claude

Claude od razu wie:

Cross-instance coordination (Supabase claude_handoff)

iOS-Claude na Macu + Bartek manual używają Supabase table claude_handoff. Linux Claude na hub ma te same scripts.

# Sprawdź pending handoffs (od iOS lub Bartek)
.\scripts\handoff.ps1 list

# Reply lub action
.\scripts\handoff.ps1 send ios "subject" "body" urgent

# Mark read / close
.\scripts\handoff.ps1 ack <UUID>
.\scripts\handoff.ps1 resolve <UUID>

Scripts są PowerShell (.ps1) — na Linux użyj sudo snap install powershell --classic żeby odpalić, lub port do Bash (.sh) jeśli wolisz.

Troubleshooting (5 known issues)

1. NVIDIA CUDA toolkit dla PyTorch

Pop!_OS NVIDIA ISO ships driver, ALE PyTorch CUDA wymaga manual match version:

pip install torch>=2.2 --index-url https://download.pytorch.org/whl/cu121
2. Tailscale Funnel re-enable

Po sudo tailscale up (browser OAuth), re-enable Funnel z path-mount config:

tailscale serve reset
tailscale funnel reset
tailscale funnel --bg 8001
tailscale serve --bg --set-path=/webhook/github http://localhost:8080/webhook/github
3. Hostname matching dla iOS HealthIOS

Tailscale node ID jest nowy on Linux. Żeby iPhone HealthIOS używał same Funnel URL:

# Expire Windows node w Tailscale admin (https://login.tailscale.com/admin/machines)
sudo tailscale up --hostname=desktop-e7102ja   # re-claim same hostname

Cert desktop-e7102ja.tailc2b192.ts.net regenuje automatic.

4. Docker daemon nie startuje (group)

Po apt install docker.io, użytkownik musi być w grupie docker (setup-linux.sh to robi, ale wymaga logout/login):

sudo usermod -aG docker $USER
# logout + login (lub: newgrp docker w bieżącym shell)
docker ps   # verify
5. Time zone Linux UTC vs Windows local

Dual-boot powoduje clock drift 2h. Fix Linux side:

sudo timedatectl set-local-rtc 1   # match Windows RTC convention

Pose_server pre-flight test

cd ~/Developer/pc-services/services/pose_server
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.py   # → http://localhost:8001/health should return 200

# Then convert do systemd timers (per migration plan step #7)
sudo cp ~/Developer/pc-services/services/systemd/*.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now pc-services-pose pc-services-dashboard
sudo systemctl enable --now pc-services-sweep-nightly.timer