Monday, May 20, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1234  / 1 Year ago, mon, february 20, 2023, 4:30:13

I'm trying to install openssh-server on Xubuntu 20.04 with Automatic Ubiquity Installator. According to https://help.ubuntu.com/lts/installation-guide/amd64/apbs04.html point "B.4.11. Package selection", I can use


ubiquity pkgsel/include string openssh-server

which does not work (openssh server is not installed).


According to https://wiki.ubuntu.com/UbiquityAutomation I can use ubiquity/success_command (or preseed/late_command) to run own commands... So I tried something like this:


ubiquity ubiquity/success_command string 
echo 'engineer ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/99_engineer;
chmod 440 /target/etc/sudoers.d/99_engineer;
chroot /target apt-get update;
chroot /target apt-get install -y openssh-server

Also not working. Which is funny, because sudoers lines seems to work - only openssh-server is not installed...


What I'm doing wrong? What Ubuntu 20.04 changed and not documented anywhere? Because all examples on entire Internet about Ubuntu 18.04 says that above should work.


More From » system-installation

 Answers
1

In the end, I dived into the Ubiquity source code used in Ubuntu 20.04 and it seems that developers have removed such features like pkgsel/include. Ubuntu documentation is silent about that. Also, I confirmed that preseed/late_command is not fired. The only thing working is ubiquity/success_command. I don't know if it was like that from the very beginning, but success_command is run with sh -c "commands here", which from my testing means that you are not able to run scripts inside ubiquity/success_command. After really long tinkering around, my final (working) solution is using cron to create a command after reboot, which will wait for Internet access (by checking 8.8.8.8):


ubiquity ubiquity/success_command string 
mkdir -p /mnt/floppy;
mount -t vfat /dev/fd0 /mnt/floppy;
cp /mnt/floppy/sudoers /target/etc/sudoers.d/99_engineer;
chmod 440 /target/etc/sudoers.d/99_engineer;
mkdir -p /target/root;
cp /mnt/floppy/firstboot.sh /target/root/firstboot.sh;
chmod 750 /target/root/firstboot.sh;
echo '@reboot root bash /root/firstboot.sh >> /var/log/firstboot.log 2>&1' >> /target/etc/crontab;

Note that I have also used here floppy_files from Packer - this is why I can use /dev/fd0.


sudoers file:


engineer ALL=(ALL) NOPASSWD:ALL

firstboot.sh file:


#!/bin/bash

echo "Waiting for Internet ..."
while ! timeout 0.2 ping -c 1 -n 8.8.8.8 &> /dev/null
do
printf "%c" "."
done
echo "OK"

# Instal SSH Server
apt-get -y update
apt-get -y install openssh-server

# Remove from crontab
sed -i '/firstboot/d' /etc/crontab

Btw, huge minus for all people responsible for removing pkgsel/include and other changes, which are documented everywhere and currently does not work in automatic-ubiquity, and which allowed in an easy manner to install extra stuff needed.


[#2706] Monday, February 20, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tocklftime

Total Points: 110
Total Questions: 109
Total Answers: 100

Location: Mayotte
Member since Mon, Sep 12, 2022
2 Years ago
tocklftime questions
Wed, Feb 1, 23, 21:50, 1 Year ago
Tue, Oct 4, 22, 21:42, 2 Years ago
Sun, Jul 25, 21, 10:43, 3 Years ago
;