lost and found ( for me ? )

Ubuntu 14.04: automatic installation with kickstart file

Here is how to make an unattended installation ISO of Ubuntu 14.04 Server.

Reference
http://pricklytech.wordpress.com/2013/04/21/ubuntu-server-unattended-installation-custom-cd/

make automatic installation ISO

mount the ISO
# mount -o loop /home/hattori/ISO_files/ubuntu-14.04-server-amd64.iso /home/hattori/iso

copy files to /home/hattori/serveriso directory
# cp -rT /home/hattori/iso /home/hattori/serveriso

# chmod -R 777 /home/hattori/serveriso/

configure language ( in my case, use japanese )
first search supported language from langlist file and configure language you want to use
# cd /home/hattori/serveriso/isolinux/

# grep ^ja langlist
ja

# echo ja > langlist

# cat langlist
ja

install system-config-kickstart to make a kickstart file.
# apt-get install system-config-kickstart

start.
error.
# system-config-kickstart
Traceback (most recent call last):
 File "/usr/share/system-config-kickstart/system-config-kickstart.py", line 92, in <module>
   kickstartGui.kickstartGui(file)
 File "/usr/share/system-config-kickstart/kickstartGui.py", line 131, in __init__
   self.X_class = xconfig.xconfig(xml, self.kickstartData)
 File "/usr/share/system-config-kickstart/xconfig.py", line 80, in __init__
   self.fill_driver_list()
 File "/usr/share/system-config-kickstart/xconfig.py", line 115, in fill_driver_list
   raise RuntimeError, (_("Could not read video driver database"))
RuntimeError: ビデオドライバーのデータベースを読み込むことができませんでした

Googling this, this seems to be a bug.

follow the instructions.
# apt-get remove hwdata -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
 localechooser-data
Use 'apt-get autoremove' to remove it.
The following packages will be REMOVED:
 hwdata system-config-kickstart


# wget ftp://mirror.ovh.net/mirrors/ftp.debian.org/debian/pool/main/h/hwdata/hwdata_0.234-1_all.deb
# dpkg -i hwdata_0.234-1_all.deb
# apt-get install system-config-kickstart -y

start. Okay.

# system-config-kickstart


make a kickstart file with GUI

Here is the ks.cfg I made.
# grep -v ^# /home/hattori/ks.cfg

lang en_US
langsupport en_US
keyboard us
mouse
timezone America/New_York
rootpw --iscrypted $1$XQbTzRQH$bL76vvwsL6USTxmS7C4tz1
user hattori --fullname "hattori" --iscrypted --password $1$E/m3UF5k$iqR.lTy44xcWqHJI23M9s.
reboot
text
install
cdrom
bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
part / --fstype ext4 --size 1 --grow
part swap --recommended
auth  --useshadow  --enablemd5
network --bootproto=dhcp --device=eth0
firewall --disabled --ssh
skipx

add following lines at the end of ks.cfg
%packages
nano
openssh-server

# grep -v ^# /home/hattori/ks.cfg

lang ja_JP
langsupport ja_JP
keyboard jp
mouse
timezone Asia/Tokyo
rootpw --iscrypted $1$WQ7m.az5$EAgrglOCZsH2vtRRO.I8e0
user hattori --fullname "hattori" --iscrypted --password $1$cWaRngQ0$VXnCiRAKUe4SvoihCVTtB.
reboot
text
install
cdrom
bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
part / --fstype ext4 --size 1 --grow
part swap --recommended
auth  --useshadow  --enablemd5
network --bootproto=dhcp --device=eth0
firewall --disabled --ssh
skipx

%packages
nano
openssh-server

copy the ks file to the /home/hattori/serveriso
# cp /home/hattori/ks.cfg /home/hattori/serveriso/

# ls /home/hattori/serveriso/
EFI                 boot   doc      isolinux  md5sum.txt  pool     ubuntu
README.diskdefines  dists  install  ks.cfg    pics        preseed

edit txt.cfg
add “ks=cdrom:ks.cfg”
remove vga=788 and quiet --

before
# less /home/hattori/txt.cfg.org
default install
label install
 menu label ^Install Ubuntu Server
 kernel /install/vmlinuz
 append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --

after editing
# pwd
/home/hattori/serveriso/isolinux

# cat txt.cfg
default install
label install
 menu label ^Install Ubuntu Server
 kernel /install/vmlinuz
 append  file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg

make an ISO
# cd /home/hattori/serveriso/


# mkisofs -D -r -V "auto install" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /home/hattori/ubuntu1404_auto.iso /home/hattori/serveriso

# file /home/hattori/ubuntu1404_auto.iso
/home/hattori/ubuntu1404_auto.iso: # ISO 9660 CD-ROM filesystem data 'auto install' (bootable)

install ubuntu by using this ISO.
I confirmed that the the installation succeeds within KVM.

Ubuntu 14:04 : install open vswitch with single interface

Here is how to install/configure openvswitch on Ubuntu 14.04 with single interface

reference
http://blog.allanglesit.com/2012/10/linux-kvm-ubuntu-12-10-with-openvswitch/

# tail -1 /etc/lsb-release

DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

# uname -ri
3.13.0-32-generic x86_64

# kvm -version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.1), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 1.2.2

- before installing openvswitch.

server eth0 --- the internet

- after installing open vswitch

   VM1 vnet0 - ovsbr0p1 - ovsbr0 - eth0 --------- the internet
   VM2 vnet1
   VM3 vnetX
  ←---------------- server ----------------->

ovsbr0p1 : internal port
ovsbr0 : bridge
eth0 : uplink
vnetX : port for VMs

assign an IP to ovsbr0p1 for the KVM host to use the internet

The KVM host has only one NIC.

install openvswitch. assume that you have already installed KVM.
# apt-get install openvswitch-switch

[ configure network ]

add ovsbr0 bridge and destroy default network.

After issuing “ovs-vsctl add-br ovsbr0”, the network ovsbr0 has been automatically created in KVM. ( virsh net-list --all )
# ovs-vsctl add-br ovsbr0

# virsh net-destroy default
Network default destroyed

# ovs-vsctl show
3e182188-430d-443c-abd3-e5d2e93ac90a
   Bridge "ovsbr0"
       Port "ovsbr0"
           Interface "ovsbr0"
               type: internal
   ovs_version: "2.0.1"

virsh # net-list --all
Name                 State      Autostart     Persistent
----------------------------------------------------------
default              inactive   yes           yes
isolate1             active     yes           yes
isolate2             active     yes           yes
isolate3             active     yes           yes
network1             active     yes           yes
network2             active     yes           yes
network3             active     yes           yes
ovsbr0               inactive   no            yes

# net-dumpxml ovsbr0
<network>
 <name>ovsbr0</name>
 <uuid>f2587c6e-b393-4a20-8580-6e5b3c815410</uuid>
 <forward mode='bridge'/>
 <bridge name='ovsbr0'/>
 <virtualport type='openvswitch'/>
</network>

undefine default network ( nat network ) and enable ovsbr0 network. ( open vswitch )
virsh # net-undefine default
Network default has been undefined

virsh # net-autostart ovsbr0
Network ovsbr0 marked as autostarted

virsh # net-list --all
Name                 State      Autostart     Persistent
----------------------------------------------------------
isolate1             active     yes           yes
isolate2             active     yes           yes
isolate3             active     yes           yes
network1             active     yes           yes
network2             active     yes           yes
network3             active     yes           yes
ovsbr0               inactive   yes           yes

connect bridge ovsbr0 to its uplink eth0
# ovs-vsctl add-port ovsbr0 eth0

add an internal port ovsbr0p1 connected to bridge ovsbr0
# ovs-vsctl add-port ovsbr0 ovsbr0p1 -- set interface ovsbr0p1 type=internal


edit /etc/network/interfaces.
assign an IP to ovsbr0.

before editing
# cat /etc/network/interfaces.org
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
   address 192.168.11.100
   netmask 255.255.255.0
   gateway 192.168.11.1
   dns-nameservers 8.8.4.4 8.8.8.8
#    dns-nameservers 127.0.0.1

after editing
assign an IP to ovsbr0p1 for the KVM host to use the internet
# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down

auto ovsbr0p1
iface ovsbr0p1 inet static
   address 192.168.11.100
   netmask 255.255.255.0
   gateway 192.168.11.1
   dns-nameservers 8.8.8.8
   dns-search mydomain.local

reboot the OS.

after rebooting the OS.

root@ubuntu:~# virsh net-list
Name                 State      Autostart     Persistent
----------------------------------------------------------
isolate1             active     yes           yes
isolate2             active     yes           yes
isolate3             active     yes           yes
network1             active     yes           yes
network2             active     yes           yes
network3             active     yes           yes
ovsbr0               active     yes           yes

# ip addr show | grep -v 'link/ether'
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
   inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UP group default qlen 1000
3: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
4: ovsbr0p1: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
   inet 192.168.11.100/24 brd 192.168.11.255 scope global ovsbr0p1
      valid_lft forever preferred_lft forever
5: ovsbr0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
6: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
   inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
      valid_lft forever preferred_lft forever
7: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
   inet 172.17.42.1/16 scope global docker0
      valid_lft forever preferred_lft forever
8: virbr3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.102.1/24 brd 192.168.102.255 scope global virbr3
      valid_lft forever preferred_lft forever
9: virbr3-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr3 state DOWN group default qlen 500
10: virbr2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.101.1/24 brd 192.168.101.255 scope global virbr2
      valid_lft forever preferred_lft forever
11: virbr2-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr2 state DOWN group default qlen 500
12: virbr4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.200.1/24 brd 192.168.200.255 scope global virbr4
      valid_lft forever preferred_lft forever
13: virbr4-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr4 state DOWN group default qlen 500
14: virbr6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.202.1/24 brd 192.168.202.255 scope global virbr6
      valid_lft forever preferred_lft forever
15: virbr6-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr6 state DOWN group default qlen 500
16: virbr1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.100.1/24 brd 192.168.100.255 scope global virbr1
      valid_lft forever preferred_lft forever
17: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr1 state DOWN group default qlen 500
18: virbr5: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
   inet 192.168.201.1/24 brd 192.168.201.255 scope global virbr5
      valid_lft forever preferred_lft forever
19: virbr5-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr5 state DOWN group default qlen 500
20: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 500



# ovs-vsctl show
3e182188-430d-443c-abd3-e5d2e93ac90a
   Bridge "ovsbr0"
       Port "ovsbr0p1"
           Interface "ovsbr0p1"
               type: internal
       Port "ovsbr0"
           Interface "ovsbr0"
               type: internal
       Port "eth0"
           Interface "eth0"
   ovs_version: "2.0.1"

edit an XML file of a VM to use openvswitch and start the VM
# virsh dumpxml vm1
   <interface type='bridge'>
     <mac address='52:54:00:33:63:cf'/>
     <source bridge='ovsbr0'/>
     <virtualport type='openvswitch'>
       <parameters interfaceid='a08c8dcf-7417-413a-92ee-d2999a1eadca'/>
     </virtualport>
     <model type='virtio'/>

# virsh start vm1

dump the VM xml
port vnet1 has been created by libvirtd.
   <interface type='bridge'>
     <mac address='52:54:00:33:63:cf'/>
     <source bridge='ovsbr0'/>
     <virtualport type='openvswitch'>
       <parameters interfaceid='a08c8dcf-7417-413a-92ee-d2999a1eadca'/>
     </virtualport>
     <target dev='vnet1'/>
     <model type='virtio'/>


# ovs-vsctl show
3e182188-430d-443c-abd3-e5d2e93ac90a
   Bridge "ovsbr0"
       Port "ovsbr0p1"
           Interface "ovsbr0p1"
               type: internal
       Port "ovsbr0"
           Interface "ovsbr0"
               type: internal
       Port "vnet1"
           Interface "vnet1"
       Port "eth0"
           Interface "eth0"
   ovs_version: "2.0.1"

# ip addr show vnet1
22: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 500
   link/ether fe:54:00:33:63:cf brd ff:ff:ff:ff:ff:ff

If you run multiple VMs which are connected to the openvswitch, target device (vnetX) for each VM has been added by libvirtd.
Three VMs are running which are connected to the openvswitch.
root@ubuntu:~# virsh list --all
Id    Name                           State
----------------------------------------------------
2     ubuntu1404-vm1                 running
4     ubuntu1404-vm2                 running
5     ubuntu1404-vm3                 running
-     centos7-vm1                    shut off
-     ubuntu1404-vm4                 shut off
-     ubuntu1404-vm5                 shut off
-     ubuntu1404-vm6                 shut off
-     ubuntu1404-vm7                 shut off

root@ubuntu:~# ovs-vsctl show
3e182188-430d-443c-abd3-e5d2e93ac90a
   Bridge "ovsbr0"
       Port "vnet0"
           Interface "vnet0"
       Port "ovsbr0p1"
           Interface "ovsbr0p1"
               type: internal
       Port "ovsbr0"
           Interface "ovsbr0"
               type: internal
       Port "vnet1"
           Interface "vnet1"
       Port "eth0"
           Interface "eth0"
       Port "vnet3"
           Interface "vnet3"
   ovs_version: "2.0.1"

# ip addr show | grep vnet
20: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 500
22: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 500
23: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master virbr4 state UNKNOWN group default qlen 500
24: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 500
25: vnet4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master virbr4 state UNKNOWN group default qlen 500