Permission problems with preseeding 16.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Permission problems with preseeding 16.04



I'm trying to automate installing ubuntu server 16.04 using a preseed/kickstart config.



The installation succeeds, but the permissions in /usr/ are wrong, it is owned by username:username causing weird behaviour with sudo and a wide range of applications.



Sudo gives the following error:


$ sudo
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set



My kickstart config (ks.cfg) contains the following:


#Generated by Kickstart Configurator
#platform=x86

#System language
lang en_US
#Language modules to install
langsupport en_US.UTF-8
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone --utc Europe/Dublin
#Root password
rootpw --disabled
#Initial user
user username --fullname "Server User" --iscrypted --password <password hash>
#Reboot after installation
reboot
#Use text mode install
text
#Use interactive kickstart installation method
interactive
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#System authorization infomation
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
#Package install information
%packages
openssh-server
bridge-utils
snapd
nano
systemd
%pre
#!/bin/sh
. /usr/share/debconf/confmodule
RET="FKXSVXX"
cat > /tmp/hostname_query.template <<'!EOF!'
Template: hostname_query/title
Type: text
Description: Set the server hostname

Template: hostname_query/ask
Type: string
Description: Define the desired hostname (FKXSVXX):
!EOF!
debconf-loadtemplate hostname_query /tmp/hostname_query.template
db_settitle hostname_query/title
db_input critical hostname_query/ask
db_go
db_get hostname_query/ask
echo "network --hostname=$RET" > /tmp/network.txt
%end
%include /tmp/network.txt
%post --nochroot
mkdir -p /target/etc/network
mkdir -p /target/usr/local/bin
cp /cdrom/extra/interfaces /target/etc/network/interfaces
cp /cdrom/extra/mirror_br0.sh /target/usr/local/bin/mirror-br0.sh
mkdir -p /target/etc/systemd/system
cp /cdrom/extra/*service /target/etc/systemd/system
cp -r /cdrom/extra /target/usr/lib/tmp
%end
%post --interpreter /bin/bash
exec < /dev/tty3 > /dev/tty3 2>&1

echo "copying files"
mkdir -p /etc/systemd/user/
mkdir -p /etc/systemd/system/
cp -r /cdrom/extra /usr/lib/tmp/
echo "chmodding files"
chmod 744 /usr/local/bin/mirror-br0.sh
chmod +x /usr/local/bin/mirror-br0.sh
chmod 744 /usr/lib/tmp/*.sh
chmod +x /usr/lib/tmp/*.sh
chmod 664 /etc/systemd/system/*.service
echo "set up grub to boot with default interfaces"
sed -i 's/LINUX_DEFAULT="/LINUX_DEFAULT="net.ifnames=0 biosdevname=0 /g' /etc/default/grub
sed -i 's/splash/text/g' /etc/default/grub
sed -i 's/quiet//g' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
echo "setting up services"
systemctl enable install_lxd.service
systemctl enable firstboot.service
2>&1 | tee /root/postinstall.log > /dev/tty3
chvt 1
%end



I've used the following guide to add packages to the installation:



How to customize ubuntu 14.04 installation cd



Has anybody experienced the same problems?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS