Thank you for your help.
Especially the crond advice.
I don't think vagrant packer uses systemd.
Vagrant packer starts a VM, loads an inserted ISO
and then uses scripts to install the box.
This is my list of scripts:
- liveVM.sh
- tables.sh
- partitions.sh
- base.sh
- mirrors.sh
- bootloader.sh
- pacman.sh
- setup.sh
I switched from using a Manjaro ISO to an Artix ISO and it's able to get past the liveVM script.
As you can see in the first script, it has no issue calling, because I get stuck on mirrors.sh (crontab)
and setup.sh where dinitctl is required for starting sshd.
Without it vagrant packer won't finish the installed box.
liveVM.sh
#!/usr/bin/bash
. /tmp/files/vars.sh
NAME_SH=liveVM.sh
GRUB=/etc/default/grub
# stop on errors
set -eu
echo ">>>> ${NAME_SH}: Lock root password.."
/usr/bin/passwd -l root >/dev/null
echo ">>>> ${NAME_SH}: Update the system clock.."
/usr/bin/dinitctl start ntpd >/dev/null
echo ">>>> ${NAME_SH}: Modifying local settings.."
/usr/bin/ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime
echo -s ${HOSTNAME_LIVEVM} | tee /etc/hostname >/dev/null
echo ">>>> ${NAME_SH}: Installing packages for commands used in provisioner scripts.."
/usr/bin/pacman --noconfirm -Sy gptfdisk pacman-contrib >/dev/null
echo ">>>> ${NAME_SH}: Reranking pacman mirrorslist.."
/usr/bin/cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-backup
/usr/bin/rankmirrors /etc/pacman.d/mirrorlist-backup | tee /etc/pacman.d/mirrorlist >/dev/null
/usr/bin/rm -rf /etc/pacman.d/mirrorlist-backup
I'm now stuck on the crontab issue and the dinitctl issue.
Here's what I have so far:
mirrors.sh
#!/usr/bin/env bash
. /tmp/files/vars.sh
NAME_SH=mirrors.sh
# stop on errors
set -eu
echo ">>>> ${NAME_SH}: Reranking pacman mirrorlist.."
/usr/bin/artix-chroot ${ROOT_DIR} pacman -S --noconfirm pacman-contrib >/dev/null
/usr/bin/artix-chroot ${ROOT_DIR} cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-backup
/usr/bin/artix-chroot ${ROOT_DIR} /usr/bin/rankmirrors /etc/pacman.d/mirrorlist-backup | tee /etc/pacman.d/mirrorlist >/dev/null
/usr/bin/artix-chroot ${ROOT_DIR} rm -rf /etc/pacman.d/mirrorlist-backup
echo ">>>> ${NAME_SH}: Crontab rankmirrors every week.."
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | /usr/bin/artix-chroot ${ROOT_DIR} sudo crontab -e
"Monthly update of Artix mirrorlist"
0 0 1 * * rankmirrors &>dev/null
EOF
echo ">>>> ${NAME_SH}: Debugging part.."
/usr/bin/ls -lha /run/dinitctl
/usr/bin/dinitctl list
/usr/bin/artix-chroot ${ROOT_DIR} /usr/bin/ls -lha /run/dinitctl
/usr/bin/artix-chroot ${ROOT_DIR} /usr/bin/dinitctl list
And this is the current result:
==> bastille-installer.qemu.artix: no crontab for root - using an empty one
bastille-installer.qemu.artix: [Using open mode]
==> bastille-installer.qemu.artix: crontab: no changes made to crontab
bastille-installer.qemu.artix:
bastille-installer.qemu.artix: Open and visual must be used interactively
bastille-installer.qemu.artix: At end-of-file
bastille-installer.qemu.artix: Nonzero address required on this command
...
==> bastille-installer.qemu.artix: /usr/bin/ls: cannot access '/run/dinitctl': No such file or directory
==> bastille-installer.qemu.artix: Provisioning step had errors: Running the cleanup provisioner, if present...
==> bastille-installer.qemu.artix: Deleting output directory...
Build 'bastille-installer.qemu.artix' errored after 6 minutes 12 seconds: Script exited with non-zero exit status: 2. Allowed exit codes are: [0]
[edit]
I think I've got the crontab figured out.
You know what, I'll mark this as solved and open a seperate post.
/usr/bin/artix-chroot ${ROOT_DIR} crontab -l &>/dev/null | { cat; echo "0 0 1 * * rankmirrors" >/dev/null; } | crontab -