Ubuntu 12.04 LTS, “Unknown keyword in configuration file: ui” with 8G USB drive

http://wp.me/ph3BR-19l

參考這篇, Ubuntu 8.10, 分享一下, 快速安裝法 USB外接硬碟. 原來以為很快會搞定, 結果啟動就出了錯誤 “Unknown keyword in configuration file: ui"
syslinux-3.72 error

原因,
1) 用了 syslinux 3.72
2) 但是下載 ubuntu 12.04 LTS, 並不是 8.10

解決方法

步驟 1)
使用 syslinux 4.05 (https://www.kernel.org/pub/linux/utils/boot/syslinux/4.xx/syslinux-4.05.zip)

解開後, 選 win32 裡面的 syslinux.exe 就可以. 需要以DOS BOX執行, 把 LINUX 的啟動區寫入 FAT32 格式化的磁碟, USB Hard disk / USB thumb drive.

USB Hard disk 插入後, 俺的 XP 找到的 80G 硬碟機編號是 E:, 要使用 -f 選項, 輸入命令,
syslinux -ma -f E:

如果插入的是 8G USB 手指, 取消 -f 選項, 輸入命令,
syslinux -ma E:

目的是按照提示, 堅持把 LINUX 的啟動區寫入 USB Hard disk. 沒看到錯誤, 表示成功. 再來回頭看看, 檔案總管裡面看到的 E:, 原來空白的, 現在多了 ldlinux.sys, 表示這個硬碟已經安裝好了 LINUX 的啟動區.

步驟 2)
a) 下載 Live CD 檔案 ubuntu-12.04.3-desktop-i386.iso
b) 下載並安裝 WinRAR (免費, 功能等於 WinZIP)
c) 滑鼠右鍵點選 ubuntu-12.04.3-desktop-i386.iso
d) 選擇 Extract to ubuntu-12.04.3-desktop-i386
e) ISO 檔案自動解開, 出現一個新的 Folder – [ubuntu-12.04.3-desktop-i386]
f) 把 [ubuntu-12.04.3-desktop-i386] 裡面的全部內容抄到 E:\
g) 抄完後, 在 E:\ 裡面找一個 Folder, 名稱為 isolinux, 進入, 把裡面所有檔案抄到 E:\
h) 回到 E:\ 的最上層
i) 把 isolinux.cfg 改名成 syslinux.cfg
j) 把 isolinux.bin 改名成 syslinux.bin

或者用 BAT, 錄入如下 copy_isolinux.BAT, 存到 E: 然後執行

copy \isolinux\*.* .
ren isolinux.cfg syslinux.cfg
ren isolinux.bin syslinux.bin

現在, Ubuntu USB 硬碟已經準備好了……………………..

(如 果不要麻煩, 可以改 patch ldlinux.sys, 修改 ASCII syslinux 為 isolinux, 或改原碼 ldlinux.asm, 增加 syslinux CFG………………對普通使用者可能更難, 或許可以考慮請 syslinux development team 修訂)

REF:

http://askubuntu.com/questions/141311/unknown-keyword-in-configuration-file-boot-error-when-booting-off-a-live-usb

UBUNTU 12.04, STLinux 2.3, modified install.txt

http://paste.ubuntu.com/1291762/

#!/bin/sh
#set -x

#
# Check the distribution is actually there
#
cmd=$0
d=`dirname $cmd`
case "$d" in
    /*)
	;;
    .)	d=`pwd`
	;;
    *)	d=`pwd`/$d
	;;
esac

#
#  Parse arguments
#

# By default we assume a network install
net_install=true

# Assume redhat style system by default
debian_install=false

repo_root=""

TEMP=`getopt -o "hndup:" -l "help,nonet,debian,ubuntu,path:" -n install -- "$@"`

if [ $? != 0 ] ; then
  echo "Terminating." >&2
  exit 1
fi


eval set -- "$TEMP"
while true ; do
  case "$1" in
    -h|--help)
      echo "Install the STLinux Distribution"
      echo "Usage: install [OPTIONS] {Installation packages}"
      echo
      echo "Options:"
      echo "  -n,--nonet         Disable network install"
      echo "  -p,--path          Install from the specified path"
      echo "  -h,--help          Print this message"
      echo
      echo " Running with no arguments will provide a list of installation"
      echo " packages that are available to install with an explanation of"
      echo " what they do"
      echo 
      echo " Example:"
      echo " ./install all-arm  will install the entire STLinux distribution for ARM"
      exit 0
      ;;
    -n|--nonet)
      shift
      net_install=false
      ;;

    -d|--debian|-u|--ubuntu)
      shift
      debian_install=true
      ;;

	-p|--path)
	  repo_root=$2
	  shift 2
	  ;;

    --)
      shift
      break
      ;;
    *)
      echo "Internal command line parsing error" >&2
      exit 1
      ;;
  esac
done

if [ -n "$repo_root" ]; then
	d=$repo_root
fi

cd $d

#
# Do the install
#
p="stlinux23-"
s="-[^-]*-[^-]*$"


rpm_extra_opts=""

run_rpm() {
	rpm $rpm_extra_opts $*
}

query_rpm() {
 	 run_rpm -q --quiet $1
}



rpm_install() { 
    local name=${p}host-$1
    local url_name="${install_url}/host/${name}.rpm"
    
    # Get the RPM from the compat directory instead of host. 
    if [ "$1" = "compat" ] ; then
    	name=${p}host-$2 
    	url_name="${install_url}/compat/${name}.rpm"
    fi
    
    # Get the RPM from the update directory instead of host. 
    if [ "$1" = "updates_host" ] ; then
    	name=${p}host-$2 
    	url_name="${install_updates_url}/host/${name}.rpm"
    fi

    # RPM doesn't handle proxies sensibly. So we have to use wget and then
    # use a file instead
    if $net_install ; then 
	    if ! wget -q -P /tmp $url_name ; then 
		    echo "Unable to download $url_name"
		    exit 1
	    fi
	    url_name=/tmp/${name}.rpm
    fi

    if  ! query_rpm $name ; then
	if ! run_rpm --quiet --checksig $url_name ; then
		echo "Package $name fails GPG signature check, bailing out"
		exit 1
	fi
	if ! run_rpm --quiet  -U $url_name ; then
		echo "Package $name failed to install, bailing out"
		exit 1
	fi
    fi
}


# Explicit check for Red hat enterprise 3, it is just too old to support anymore
# It goes out of support soon anyway
#
if [ -r /etc/redhat-release ] ; then
	if egrep -q "Red Hat Enterprise Linux" /etc/redhat-release ; then
		if egrep -q "release 3" /etc/redhat-release ; then
			echo "*********************************************************"
			echo "*                                                       *"
			echo "* THIS RELEASE WILL NOT INSTALL ON RED HAT ENTERPRISE 3 *"
			echo "*                                                       *"
			echo "* Please upgrade to Enterprise 4 or later               *"
			echo "*                                                       *"
			echo "*********************************************************"

			exit 1
		fi
	fi
fi

if [ -r /etc/debian_version ] ; then
	if ! $debian_install ; then
		echo
		echo "************************************************************************"
		echo "* Looks like you are trying to install on a Ubuntu system              *"
		echo "*                                                                      *"
		echo "* This is not officially supported, but can be made to work            *"
        	echo "*                                                                      *"
		echo "* Look at the following links and carry out the steps listed there     *"
		echo "* and then rerun this script with the --debian flag                    *"
        	echo "*                                                                      *"
		echo "              http://stlinux.com/install/ubuntu                        *"
		echo "*                                                                      *"
		echo "************************************************************************"
		
		exit 1
	fi
fi

if $debian_install ; then
 	if rpm --force-debian > /dev/null 2>&1 ; then
		rpm_extra_opts="--force-debian"
	fi
fi

# Test we can actually execute rpm 
if ! run_rpm --version > /dev/null 2>&1 ; then
	echo
	echo "Cannot execute rpm, you must install it !!"
	echo  
	exit 1
fi	

if [ $(id -ru) -ne 0 ]; then
	echo "You have to be root to install the distribution"
	exit 1
fi


releasename="2.3"

st_hostname=linux.bri.st.com
inside_st=false

host_filesystem_version=1.0-6

echo "*************************************************"
echo "*  Installing STLINUX $releasename "
echo "*************************************************"
echo

if $net_install ; then
	echo "Trying to find out if you are inside STMicroelectronics"
	echo "Please wait for up to 10 seconds....."
	if ping -w 10 -c 3 -q $st_hostname > /dev/null ; then
		echo "You appear to be inside ST, using linux.bri.st.com"
		echo
		net_hostname="${st_hostname}"
		net_url="http://${net_hostname}/pub/stlinux/${releasename}/STLinux"
		net_updates_url="http://${net_hostname}/pub/stlinux/${releasename}/updates/RPMS"
		inside_st=true
	else
		echo "You are not inside ST, using www.stlinux.com"
		echo
		net_hostname="www.stlinux.com"
		net_url="http://${net_hostname}/pub/stlinux/${releasename}/STLinux"
		net_updates_url="http://${net_hostname}/pub/stlinux/${releasename}/updates/RPMS"
	fi
fi	

if [ -d $d/STLinux/repodata -a -d ${d}/updates/RPMS/repodata ] ; then
	echo "***************************************************************"
	echo "* There is a distribution available in the local directory    *"
	echo "* This will be used for install. You can issue an             *"
	echo "* stmyum update command to update your system later on        *"
	echo "***************************************************************"
	echo
	file_url="file://${d}/STLinux"
	file_updates_url="file://${d}/updates/RPMS"
	install_url="$file_url"
	install_updates_url="$file_updates_url"
	file_install=true
	# Never look at the network from this point on 
	net_install=false
else
	file_url=""
	file_updates_url=""
	install_url="$net_url"
	install_updates_url="$net_updates_url"
	file_install=false
fi



if $net_install ; then
	echo "Checking for network connection"
	if ! wget -q  "${net_updates_url}/host/${p}host-filesystem-${host_filesystem_version}.noarch.rpm" -T 30 -O /dev/null
	then
		echo "Cannot contact network - disabling network install" 
		echo "If you have an proxy internet connection you may need to"
		echo "set the http_proxy environment variable and rerun the script" 
		net_install=false
	else
		echo "Can contact network OK"
	fi
fi

if ! $net_install ; then
	# Need to zap the net names here
	net_hostname=""
	net_url=""
	net_updates_url=""
	if ! $file_install ; then
	       	echo "No network available and no local files"
       	 	echo "Giving up"
 		exit 1
	fi
fi	

# Now look for the GPG key and install it.
gpg_file=""

echo "Looking for a GPG key file"

# Can we get a GPG key from the local file system?
if $file_install ; then
	gpg_file=${d}/STLinux/gpg_key
	if [ ! -f $gpg_file ] ; then 
		gpg_file=""
	else 	
		echo "Found a GPG key file in local directory"
	fi
fi

# Have to get it from the network then.
if $net_install && [ -z $gpg_file ] ; then
	gpg_file=/tmp/${p}gpg_key
	if  ! wget -q "${net_url}/gpg_key" -T 30 -O $gpg_file ; then
		echo "Unable to get GPG key file from network"
	fi
fi
	
if [ -z "$gpg_file" ] ; then
	echo "Unable to find a GPG key file, aborting installation"
       	exit 1
fi


#
# Make sure we have the signing keys installed
#
if ! run_rpm -qi gpg-pubkey |  egrep -q "stlinux-support@stlinux.com" ; then
    if ! run_rpm --import $gpg_file ;  then
	echo "Failed to import GPG key into RPM , giving up"
	exit 1
    fi	
fi


# Install the host file system
rpm_install updates_host filesystem-${host_filesystem_version}.noarch

check_python_module() {
	python -c "$1" 2>/dev/null
}	

echo "Installing stmyum"



python_major=`python -V 2>&1 | sed 's/.* \([0-9]*\).*/\1/'`
python_minor=`python -V 2>&1 | sed 's/.* [0-9]*\.\([0-9]*\).*/\1/'`

echo "Checking python version"

# Do you have a decent version of python installed?
if [ $python_major -eq 2 -a $python_minor -le 2 ] ; then
	echo "*****************************************************************"
	echo "*                                                               *"
	echo "* Your Python version is too old, this release will not install *"
	echo "*                                                               *"
	echo "*        Upgrade your operating system version                  *"
	echo "*****************************************************************"

	exit 1	
else
	# Depending of host Python version you will have installed the right
	# yum package.
        if [ \( $python_major -eq 2 -a $python_minor -gt 5 \) -o  \( $python_major -gt 2 \) ] ; then
#                yum_rpm="yum-wavefront-3.2.24-1.i386"
                yum_rpm="yum-wavefront-3.2.24-3.i386"
        else
#                yum_rpm=yum-2.6.1-17.i386
                yum_rpm="yum-2.6.1-17.i386"
        fi

	echo "Checking for necessary python packages"
	python_modules_ok=true

	if ! check_python_module "import cElementTree" ; then
		if ! check_python_module "from xml.etree import cElementTree" ; then
			echo "You are missing the python cElementTree package"
			python_modules_ok=false
		fi
	fi
	if ! check_python_module "import urlgrabber" ; then
		echo "You are missing the python urlgrabber package"
		python_modules_ok=false
	fi
	if ! $python_modules_ok ; then
		echo "You must install the missing python packages."
		echo "For example, \"yum install python-urlgrabber\" on a redhat system."
		exit 1
	fi
fi

# Install the selected yum version
echo "Installing package $yum_rpm"
rpm_install updates_host $yum_rpm

# Now all should be well, we now need to execute stmyum to install the 
# meta package to install all the rest of the packages


yumconf="/tmp/${p}stmyum.conf"


STMYUM=/opt/STM/STLinux-${releasename}/host/bin/stmyum

if [ ! -x ${STMYUM} ] ; then
	echo "FAILURE - unable to run stmyum "
	exit 1
fi

# Now create yum.conf file


cat <<EOF > $yumconf
[main]
pkgpolicy=newest
tolerant=1
exactarch=0
obsoletes=1
gpgcheck=1

[STLinux_Distribution]
name=STLinux Distribution $releasename
baseurl=$install_url

[STLinux_Distribution_Updates]
name=STLinux Distribution $releasename updates
baseurl=$install_updates_url

EOF


$STMYUM -d0 -c $yumconf  clean all

# We used to update yum itself here. However, this is 
# pointless as you usually have to install the latest 
# version of yum by wget anyway

set -e 

echo "Generating list of installation packages, please wait...."

# Get a list of the installation packages
yum_info_list=`$STMYUM -d0 -c $yumconf list "${p}install-*" | \
	grep "^stlinux" | \
	sed 's/\.noarch */-/' | sed 's/[[:space:]]*STLinux.*//'`
if $file_install ; then
	new_list=""
	for i in x $yum_info_list ; do
		if [ -f ${d}/STLinux/installer/${i}.noarch.rpm -o -f ${d}/updates/RPMS/installer/${i}.noarch.rpm ] ; then
			new_list="$new_list $i"
		fi
	done
	yum_info_list="$new_list"
fi

if [ -z "$yum_info_list" ] ; then
	echo "No installation packages found"
	exit 1
fi

if [ $# -eq 0 ] ; then
	echo
	echo "******************************************************"
	echo "* No installation packages given.                    *"
	echo "* Generating list of available installation packages *"
	echo "*                                                    *"
	echo "* Multiple install packages can be specified         *"
	echo "* Eg: ./install <package1> <package2> ...            *"
	echo "******************************************************"
	echo
	echo "Available installation packages:"
	$STMYUM -d0 -c $yumconf info $yum_info_list | \
	awk -v prefix=${p} 'BEGIN {FS=":"} \
	                    /^Name *:/  { sub("[ ]*"prefix"install-","",$2); printf("%-20s - ",$2) ;next;} \
			    /^Summary *:/  { print $2 ;next;}'
	exit 1
fi

# Convert rpm names into install targets
new_list=""
for i in $yum_info_list ; do
    new_list="$new_list $(expr $i : ${p}'install-\(.*\)-[^-]*-[^-]*$')"
done
yum_info_list="$new_list"

# Build list of packages to install
l=""
for r in $* ; do
    found=false
    for i in $yum_info_list ; do
	if [ $i = $r ] ; then
	    found=true
        fi
    done
    if ! $found ; then
        echo "Installation package for $r not found on this media"
	echo "Available packages: $yum_info_list"
        exit 1
    fi

    l="$l ${p}install-${r}"
done

echo "********************************************************"
echo "* Installing $l"
echo "********************************************************"

$STMYUM -d2 -y -c $yumconf install $l

# Delete the cache 
$STMYUM -d0 -y -c $yumconf clean all

# Delete the meta package, as the presence of this will prevent any package
# from being removed.

run_rpm -e --quiet  $l

if $inside_st ; then

if [[ "${yum_rpm}" =~ "wavefront" ]]; then
  yumconf_path=/opt/STM/STLinux-${releasename}/host/etc/yum/yum.conf
else
  yumconf_path=/opt/STM/STLinux-${releasename}/host/etc/yum.conf
fi

echo 
echo Changing yum.conf file to point at linux.bri.st.com
sed -i -e "s/linux\.bri\.st\.com/${st_hostname}/"  \
       -e '/^\[ST/,/^# ST/s/^[^#]/#&/'  \
       -e '/^# ST/,$s/^#\([^ ]\)/\1/'  $yumconf_path
fi


echo
echo "*************************************************"
echo "*          INSTALLATION COMPLETED               *"
echo "*                                               *"
echo "* Website: http://www.stlinux.com               *"
echo "* Support: https://bugzilla.stlinux.com         *"
echo "*                                               *"
echo "*************************************************"