yellowhat
(yellowhat)
June 15, 2023, 5:45am
1
Hi,
I have recently discovered the project nixos-anywhere .
Basically allows to install nixos to a remote machine via ssh only:
it loads itself in RAM
use kexec
to change to it is own kernel
wipe the disk
install itself on the disk.
I was wondering if fedora has a similar capability maybe using kickstart.
Thanks
vgaetera
(Vladislav Grigoryev)
June 15, 2023, 9:35am
2
yellowhat
(yellowhat)
June 15, 2023, 11:05am
3
Thanks for your answer.
Correct me if I am wrong:
pykickstart: is for creating the kickstart file
anaconda via VNC implies that the system is already booted using the installed, I just press next via the VNC?
My question is more about I have a running system with only ssh access, just run a script from my laptop, reboot and a new installation is there.
vgaetera
(Vladislav Grigoryev)
June 15, 2023, 12:59pm
4
Create a boot entry using a Fedora installation media and a kickstart file, or specify the VNC parameters, then make this boot entry to load by default and reboot the system.
yellowhat
(yellowhat)
June 15, 2023, 1:09pm
5
yellowhat
(yellowhat)
June 15, 2023, 2:41pm
6
I have tried the following:
ISO_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/38/Server/x86_64/iso/Fedora-Server-netinst-x86_64-38-1.6.iso
curl --location --remote-name "$ISO_URL"
sudo mv "${ISO_URL##*/}" /boot/
sudo tee -a /etc/grub.d/40_custom <<EOF
insmod loopback
insmod iso9660
insmod udf
menuentry "Fedora ISO 1" --class fedora --class gnu-linux --class gnu --class os {
set iso_path="${ISO_URL##*/}"
export iso_path
search --set=root --file \$iso_path
loopback loop (hd0,1)/\$iso_path
probe --set isolabel --label (loop)
linux (loop)/isolinux/vmlinuz root=live:CDLABEL=\${isolabel} rd.live.image verbose iso-scan/filename=\${iso_path}
initrd (loop)/isolinux/initrd.img
}
menuentry "Fedora ISO 2" --class fedora --class gnu-linux --class gnu --class os {
set iso_path="${ISO_URL##*/}"
export iso_path
search --set=root --file \$iso_path
loopback loop (hd0,2)/\$iso_path
probe --set isolabel --label (loop)
linux (loop)/isolinux/vmlinuz root=live:CDLABEL=\${isolabel} rd.live.image verbose iso-scan/filename=\${iso_path}
initrd (loop)/isolinux/initrd.img
}
menuentry "Fedora ISO 3" --class fedora --class gnu-linux --class gnu --class os {
set iso_path="${ISO_URL##*/}"
export iso_path
search --set=root --file \$iso_path
loopback loop (hd0,3)/\$iso_path
probe --set isolabel --label (loop)
linux (loop)/isolinux/vmlinuz root=live:CDLABEL=\${isolabel} rd.live.image verbose iso-scan/filename=\${iso_path}
initrd (loop)/isolinux/initrd.img
}
EOF
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo sed "s|GRUB_TIMEOUT=.*|GRUB_TIMEOUT=10|g" -i /etc/default/grub
But I get no such device: root
and unknown filesystem
.
Any ideas?
Thanks
yellowhat
(yellowhat)
June 15, 2023, 3:16pm
7
A small update:
#!/usr/bin/env bash
# https://github.com/Mexit/MultiOS-USB/blob/master/config/fedora/Fedora-live.cfg
set -euo pipefail
ISO_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/38/Server/x86_64/iso/Fedora-Server-netinst-x86_64-38-1.6.iso
curl --location --remote-name "$ISO_URL"
sudo mv "${ISO_URL##*/}" /boot/
sudo tee -a /etc/grub.d/40_custom <<EOF
insmod loopback
insmod iso9660
insmod udf
menuentry "Fedora ISO" --class fedora --class gnu-linux --class gnu --class os {
set iso_path="${ISO_URL##*/}"
export iso_path
echo "[INFO] iso path: \$iso_path"
search --set=root --file \$iso_path
loopback loop (hd0,2)/\$iso_path
probe --set isolabel --label (loop)
# `images/pxeboot/..` by `sudo mount *.iso /mnt`
linux (loop)/images/pxeboot/vmlinuz root=live:CDLABEL=\${isolabel} rd.live.image verbose iso-scan/filename=\${iso_path}
initrd (loop)/images/pxeboot/initrd.img
}
menuentry "Fedora ISO " --class fedora --class gnu-linux --class gnu --class os {
iso_path="${ISO_URL##*/}"
echo "[INFO] iso path: \$iso_path"
loopback loop (hd0,2)\$iso_path
probe --label --set=cd_label (loop)
isocfg="iso-scan/filename=\$iso_path"
bootoptions="root=live:CDLABEL=\$cd_label rd.live.image verbose"
linux_path="(loop)/images/pxeboot/vmlinuz"
initrd_path="(loop)/images/pxeboot/initrd.img"
echo Loading kernel...
linux \$linux_path \$bootoptions \$isocfg
echo Loading initrd...
initrd \$initrd_path
}
EOF
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo sed "s|GRUB_TIMEOUT=.*|GRUB_TIMEOUT=10|g" -i /etc/default/grub
Now the iso boots but it hangs on Job dev-mapper-live\x2drw.device/start ...
yellowhat
(yellowhat)
June 16, 2023, 1:18pm
8
I found this magic blog post: Install Fedora on headless remote servers - Blog 0leil
I managed to boot the install headless using:
FEDORA_VER=38
BASE_URL="https://ftp.fau.de/fedora/linux/releases/$FEDORA_VER/Server/x86_64/os/images/pxeboot"
curl --location --remote-name "${BASE_URL}/initrd.img"
curl --location --remote-name "${BASE_URL}/vmlinuz"
sudo mv initrd.img vmlinuz /boot
sudo tee -a /etc/grub.d/40_custom <<EOF
menuentry 'FedoraNetInstall' {
load_video
set gfxpayload=keep
insmod gzi
insmod part_msdos
insmod ext2
set root='hd0,2'
linux /vmlinuz ip=dhcp inst.repo=https://download.fedoraproject.org/pub/fedora/linux/releases/$FEDORA_VER/Server/x86_64/os inst.vnc inst.vncconnect=0.0.0.0:5901
initrd /initrd.img
}
EOF
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo sed "s|GRUB_TIMEOUT=.*|GRUB_TIMEOUT=5|g" -i /etc/default/grub
sudo grub2-reboot FedoraNetInstall
sudo reboot
1 Like