我正在尝试使用预设/ kickstart配置自动安装ubuntu服务器16.04。
安装成功,但是/ usr /中的权限是错误的,它是由username:username拥有的,这导致sudo和各种应用程序出现奇怪的行为。
Sudo出现以下错误:
$ sudo
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
我的kickstart配置(ks.cfg)包含以下内容:
#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
我已使用以下指南将软件包添加到安装中:
How to customize ubuntu 14.04 installation cd
有人遇到过同样的问题吗?