Skip to content

Commit 2f5b8e8

Browse files
authored
fix(build): Ensure network access for ollama pull in chroot
1 parent 148d72d commit 2f5b8e8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

05-install-ai.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ==============================================================================
33
# LuminOS Build Script - Phase 5: Local AI Integration
44
# Author: Gabriel, Project Leader @ LuminOS
5-
# Version: 0.1.7
5+
# Version: 0.1.8
66
# ==============================================================================
77
set -e
88
LUMINOS_CHROOT_DIR="chroot"
@@ -24,14 +24,21 @@ echo "--> Installing Ollama binary into the system..."
2424
mv ollama "$LUMINOS_CHROOT_DIR/usr/local/bin/"
2525

2626
# --- Pull the model BEFORE configuring the service ---
27-
# We need mounts for network access during the pull
2827
echo "--> Mounting virtual filesystems for model download..."
2928
mount --bind /dev "$LUMINOS_CHROOT_DIR/dev"; mount --bind /dev/pts "$LUMINOS_CHROOT_DIR/dev/pts"; mount -t proc /proc "$LUMINOS_CHROOT_DIR/proc"; mount -t sysfs /sys "$LUMINOS_CHROOT_DIR/sys"
3029

30+
echo "--> Copying host DNS configuration into chroot for network access..."
31+
# Ensure the target directory exists
32+
mkdir -p "$LUMINOS_CHROOT_DIR/etc"
33+
cp /etc/resolv.conf "$LUMINOS_CHROOT_DIR/etc/resolv.conf"
34+
3135
echo "--> IMPORTANT: Pulling base model '${BASE_MODEL}'. This will take some time..."
3236
# Run pull directly using the binary, no service needed yet
3337
chroot "$LUMINOS_CHROOT_DIR" env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/local/bin/ollama pull ${BASE_MODEL}
3438

39+
echo "--> Removing temporary host DNS configuration from chroot..."
40+
rm "$LUMINOS_CHROOT_DIR/etc/resolv.conf"
41+
3542
echo "--> Unmounting virtual filesystems after model download..."
3643
umount "$LUMINOS_CHROOT_DIR/sys"; umount "$LUMINOS_CHROOT_DIR/proc"; umount "$LUMINOS_CHROOT_DIR/dev/pts"; umount "$LUMINOS_CHROOT_DIR/dev"
3744

@@ -58,9 +65,7 @@ RestartSec=3
5865
WantedBy=default.target
5966
SYSTEMD_SERVICE
6067
echo "--> Enabling Ollama service to start on boot..."
61-
# Enable only, don't try to start it here
6268
systemctl enable ollama.service
63-
6469
echo "--> Creating Lumin AI definition directory..."
6570
mkdir -p /usr/local/share/lumin/ai
6671
echo "--> Creating the read-only Modelfile for Lumin..."
@@ -71,11 +76,9 @@ MODELFILE
7176
echo "--> Setting protective ownership and permissions on Modelfile..."
7277
chown root:root /usr/local/share/lumin/ai/Modelfile
7378
chmod 444 /usr/local/share/lumin/ai/Modelfile
74-
7579
echo "--> Creating custom 'Lumin' model from Modelfile..."
7680
# Create the model using the binary, service doesn't need to be running
7781
/usr/local/bin/ollama create lumin -f /usr/local/share/lumin/ai/Modelfile
78-
7982
rm /tmp/configure_ai.sh
8083
EOF
8184

0 commit comments

Comments
 (0)