lubuntu-qa team mailing list archive
-
lubuntu-qa team
-
Mailing list archive
-
Message #02951
installing Lubuntu in less than 100 seconds
Hi everybody,
I think the end of life of Windows XP is a great opportunity for
Lubuntu, and I really hope the Lubuntu community will be happy receiving
[many] new people.
Will they be happy installing Lubuntu in less than 100 seconds?
- Installing in a simple and straight-forward way.
- Not yet polished, but simple from the ground.
I was kind of frustrated, that in order to succeed with low RAM, most if
not all degrees of freedom are lost, and yet the [graphical desktop]
installer feels quite unstable. Yes, I admit that is is much better than
before with zRAM, but anyway, if there are no degrees of freedom you
might as well run a simple deterministic shell-script.
So I made almost a one-button installer (there are a few yes-no
questions, and a simple cli selector to make it easier to find the
correct target drive). This installer is run from a 'grub-n-iso-swap'
system from
https://help.ubuntu.com/community/grub-n-iso
I installed a system from a USB 3 pendrive to a USB 3 HDD in less than 1
minute and 40 seconds (including answering those questions). Here are
the computer specs.
http://www.toshiba.se/laptops/satellite-pro/c850/satellite-pro-c850-19w/
I hope that it will work well also with old computers, where the
standard installers tend to be slow.
I created the system on the IDE hard drive of my old AMD Athon XP, and
made the tarball from it, so it was ported across time and
manufacturer's barriers without any problems.
I think this way might be easy enough for Windows XP users.
The script does the following main tasks.
1. Helps selecting the correct drive with some logic and simple command
line tools.
2. Unmounts and swaps off.
2. Wipes the first megabyte with dd.
3. Creates two partitions with fdisk (fully automatic).
4. Makes a file system and swap system.
5. Expands a tarball of a freshly installed Lubuntu Saucy alpha
including updates and third party multimedia (2.1 Gibibytes uncompressed).
6. Installs the grub bootloader.
I have attached a text file with some output from the text. I timed it
with the following command:
time sudo ./mktst
and it responded with
real 1m38.621s
user 0m22.692s
sys 0m8.576s
And finished with a fully working portable Lubuntu installed system.
Beat that record if you can :-)
Yes, you can, because I'm happy to share the script, and the computer is
fairly new, but not really fancy, so with a faster computer and an SSD
target (or SSD source and target) it will be easy to reduce the time.
The attached script has two lines commented away (just for the test),
but if you want to use it in serious situations, you should reactivate
them, because they help selecting the correct target drive.
#####lshw -class disk >> "$hlptxt"
##### xterm -geometry 120x40 -title "less $hlptxt" -e less "$hlptxt" &
Best regards
Nio
-------- Original Message --------
Subject: One button installer for Lubuntu
Date: Mon, 24 Jun 2013 01:42:59 +0200
From: Nio Wiklund <nio.wiklund@xxxxxxxxx>
To: Ali Linx (amjjawad) <amjjawad@xxxxxxxxx>
CC: Phill Whiteside <PhillW@xxxxxxxxxx>, Jonathan Marsden
<jmarsden@xxxxxxxxxxx>
Hi,
Is there a way to make a simple mode to install, provided the whole
drive is to be used, as it is intended in the case of replacing Windows
in fairly old computers with 256 (and 512) MB RAM?
First I was thinking of some kind of 'batch mode', without questions,
once you have connected to the computer. It should install to the first
drive.
But I have good experiences of the portability of installed systems on
USB drives. So I would rather do it like this:
0. Assume there is one internal drive (/dev/sda), and that it should be
converted to Lubuntu. (Otherwise other methods should be used.)
1. Fill the drive with
1.1 a root partition and
1.2 a swap partition, size = sizeofRAM + 1GB
2. Expand a compressed image of Lubuntu
See this example
https://help.ubuntu.com/community/InstalledSystemFakePAE
where there is actually only one crucial command line
zcat dd-sdb.img.gz | dd bs=4096 of=/dev/sda
I do not assume we should use that version off the shelf. It was made
for a special reason and limited size. Writing first the bootloader and
then the partition /dev/sda1 from a tarball should do it within a short
script. The host name and user name are easily fixed with a button on
the desktop after installation (let the original user be the admin and
make a new one). A button would be the solution for the proprietary
software too, for graphics as well as for multimedia.
I don't have it but I could write that script, there is no need for
advanced programming languages if text mode is accepted. But today it
would imply a 2GB USB drive.
I have not learned how to make the iso for a boot CD. I know of
Remastersys, maybe it still works, but I'm sure Canonical has better
tools. So returning to the first idea about a batch mode: Maybe it would
be fairly simple to add a one-button mode to the alternate installer or
the mini.iso wizard shell (to set all the other variables, if that mode
is selected).
-o-
One reason I started thinking about this is that most degrees of freedom
of the installer are cut off anyway, in order to succeed, when
installing into low RAM. And if you have to press certain buttons in a
certain order, it is better to have it fully automatic.
And the the plans of the city council in Munick inspire ideas to make it
even easier to install Lubuntu.
What about a
*One button installer for Lubuntu*
to make it easy enough to receive a mass migration from Windows XP
Best regards
Nio
lubuntu@lubuntu:/isodevice$ time sudo ./mktst
...
./sbin/setvtrgb
./sbin/nameif
./sbin/ip6tables-save
./sbin/ifup
./sbin/ureadahead
./sbin/partprobe
./sbin/iptables
./sbin/agetty
./sbin/ldconfig.real
./sbin/findfs
./sbin/fsck.minix
./sbin/umount.udisks2
Installation finished. No error reported.
-----------------------------------------------------------------------
The installation of Lubuntu 13.10 to /dev/sdb has finished
Now you can shut down the computer and remove the
installation media (typically a USB drive)
and boot the computer from the installed system
real 1m38.621s
user 0m22.692s
sys 0m8.576s
lubuntu@lubuntu:/isodevice$
-----
lubuntu@lubuntu:/isodevice$ ls -l
total 2824340
drwxr-xr-x 3 root root 4096 May 2 17:56 boot
drwx------ 2 root root 16384 May 2 17:46 lost+found
-rw------- 3 1000 1000 720371712 Jun 17 15:33 lubuntu.iso
-rwxr-xr-x 1 root root 7302 Jun 25 12:11 mktst
-rw-r--r-- 1 root root 728137222 Jun 25 12:24 saucyalfa.tar.gz
-rw------- 3 1000 1000 720371712 Jun 17 15:33 saucy-desktop-i386.iso
-rw------- 3 1000 1000 720371712 Jun 17 15:33 second.iso
lubuntu@lubuntu:/isodevice$
-----
lubuntu@lubuntu:/isodevice$ df -h
Filesystem Size Used Avail Use% Mounted on
/cow 2.0G 32M 1.9G 2% /
udev 2.0G 8.0K 2.0G 1% /dev
tmpfs 392M 1.2M 391M 1% /run
/dev/sdc1 1.5G 1.4G 20M 99% /isodevice
/dev/loop0 687M 687M 0 100% /cdrom
/dev/loop1 630M 630M 0 100% /rofs
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 2.0G 12K 2.0G 1% /tmp
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 4.0K 100M 1% /run/user
/dev/sdb1 289G 2.1G 272G 1% /mnt
lubuntu@lubuntu:/isodevice$ sudo fdisk -lu
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 976773167 488386583+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86499c9e
Device Boot Start End Blocks Id System
/dev/sdb1 2048 615026247 307512100 83 Linux
/dev/sdb2 615026248 625142447 5058100 83 Linux
Disk /dev/sdc: 15.8 GB, 15812526080 bytes
64 heads, 32 sectors/track, 15080 cylinders, total 30883840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bec46
Device Boot Start End Blocks Id System
/dev/sdc1 2048 3084287 1541120 83 Linux
/dev/sdc2 3084288 3903487 409600 82 Linux swap / Solaris
lubuntu@lubuntu:/isodevice$ sudo parted -l
Model: ATA Hitachi HTS54505 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 473MB 472MB ntfs Basic data partition hidden, diag
2 473MB 746MB 273MB fat32 Basic data partition boot
3 746MB 880MB 134MB ntfs Basic data partition msftres
4 880MB 216GB 215GB ntfs Basic data partition
5 216GB 248GB 32.2GB ext4 boot
6 248GB 269GB 21.5GB ext4
7 269GB 285GB 16.1GB ext4
8 285GB 290GB 4295MB linux-swap(v1)
9 290GB 483GB 193GB ntfs
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 315GB 315GB primary ext4
2 315GB 320GB 5179MB primary linux-swap(v1)
Model: JetFlash Transcend 16GB (scsi)
Disk /dev/sdc: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 1579MB 1578MB primary ext2
2 1579MB 1999MB 419MB primary linux-swap(v1)
Error: /dev/zram0: unrecognised disk label
Error: /dev/zram1: unrecognised disk label
Error: /dev/zram2: unrecognised disk label
Error: /dev/zram3: unrecognised disk label
lubuntu@lubuntu:/isodevice$
#! /bin/bash
#
# author sudodus alias nio-wiklund at launchpad
#
# date editor comment
# 2013-06-25 sudodus linux installer from tarball of installed system
#
#-----------------------------------------------------------------------------
function mklub {
# system and device
system="$1"
device="$2"
#echo $system
#echo $device
# variables
LC_ALL=C
LANG=C
diskmin=8 # GB
ram=$(free|grep "Mem:"|tr -s ' ' '\t'|cut -f 2)
sectors=$(fdisk -lu "$device"|grep "sectors$"|cut -d ' ' -f 8)
sectsize=$(fdisk -lu "$device"|grep "Sector size"|cut -d ' ' -f 4)
diskms=$(($diskmin*1000*1000*1000/$sectsize))
#diskms=$(($diskmin*1024*1024*1024/$sectsize))
if [ $sectors -lt $(($diskms/2)) ]
then
echo "Disk is smaller than $(($diskmin/2)) GB"
sleep 3
elif [ $sectors -lt $diskms ]
then
echo "Disk is smaller than $diskmin GB"
sleep 3
fi
swapsize=$(echo "($ram+1024*1024)*1024/$sectsize"|bc)
slim=$(($sectors/4))
if [ $swapsize -gt $slim ]
then
swapsize="$slim"
fi
swapstart=$(echo "$sectors-$swapsize"|bc)
#echo ram=$ram
#echo sectors=$sectors
#echo sectsize=$sectsize
#echo swapsize=$swapsize
#echo slim=$slim
#echo swapstart=$swapstart
#echo diskms=$diskms
#echo diskms/2=$(($diskms/2))
# swap off and unmount all partitions
swapoff "${device}*" 2>/dev/null
swapon -s
sleep 3
umount "${device}*"
# make partitions
echo fdisk -u "$device"
echo "o
n
p
2
$swapstart
n
p
1
$(echo "1024*1024/$sectsize"|bc) # typically 2048
p
wq
"|fdisk -u "$device"
sync
partprobe -s "$device"
sync
# make file system and swap
#exit
mkfs.ext4 -U 6233babf-a0e1-49c7-aee7-6c3ec021f862 "${device}1"
sync
mkswap -U 1c77de47-c91c-4c06-8bbc-2e1043647659 "${device}2"
sync
# mount what will be the root partition and activate swap
mount "${device}1" /mnt
swapon "${device}2" -p 3
swapon -s
# copy the files
cd /mnt
df .
echo tar -xvzf /isodevice/saucyalfa.tar.gz
tar -xvzf /isodevice/saucyalfa.tar.gz
cd /isodevice
# install the bootloader
grub-install --boot-directory=/mnt/boot "$device"
# finish
echo "-----------------------------------------------------------------------"
echo "The installation of $system to $device has finished"
echo ""
echo "Now you can shut down the computer and remove the"
echo "installation media (typically a USB drive)"
echo "and boot the computer from the installed system"
}
#-----------------------------------------------------------------------------
#
# author sudodus alias nio-wiklund at launchpad
#
# date editor comment
# 2013-06-25 sudodus linux installer from tarball of installed system
#
#-----------------------------------------------------------------------------
# main program
# variables
system="Lubuntu 13.10"
choice=1
bs=4096
count=256
cnt=
target=
source="$1"
LC_ALL=C
LANG=C
# usage
if [ "$(whoami)" != "root" ]
then
echo "Usage:"
echo "Install $system to a mass storage device, typically an"
echo "internal hard disk drive or external USB or eSATA drive"
echo "---- Install $system --------"
echo "sudo $0"
echo "---- Wipe the device (may take long time) --------"
echo "sudo $0 wipe-all"
echo "---- Wipe the first megabyte (MibiByte) --------------"
echo "sudo $0 wipe-1"
exit
fi
if [ "$2" != "" ]
then
echo ":-( Use no extra parameters :-("
exit
else
if [ "$1" == "wipe-all" ] || [ "$1" == "/dev/zero" ]
then
echo "Wipe the whole device ... :"
source="/dev/zero"
elif [ "$1" == "wipe-1" ] || [ "$1" == "wipe1" ]
then
echo "Wipe the first megabyte (MibiByte) ... :"
source="/dev/zero"
cnt=" count=$count"
elif [ "$1" != "" ]
then
echo "$1 is bad. Try again with another parameter"
exit
fi
fi
# greeting
if [ "$source" == "/dev/zero" ]
then
echo "Do you want to wipe a device? (y/n)"
else
echo "Do you want to install $system? (y/n)"
fi
read ans
if [ "$ans" == "y" ]
then
# make help text
hlptxt="/tmp/help-mkusb.txt"
echo "sudo lshw -class disk #####" > "$hlptxt"
#####lshw -class disk >> "$hlptxt"
echo "lsusb|sort -k 4,4 -k 1 #####" >> "$hlptxt"
lsusb|sort -k 4,4 -k 1 >> "$hlptxt"
echo "sudo fdisk -lu 2>/dev/null|grep "/dev/sd"|sort #####" >> "$hlptxt"
fdisk -lu 2>/dev/null|grep "/dev/sd"|sort >> "$hlptxt"
echo "parted -ls #####" >> "$hlptxt"
parted -ls >> "$hlptxt"
echo "blkid|sort #####" >> "$hlptxt"
blkid|sort >> "$hlptxt"
echo "df|grep "/dev/sd"|sort #####" >> "$hlptxt"
df|grep "/dev/sd"|sort >> "$hlptxt"
echo "*** WARNING: the device will be completely overwritten *******"
echo " Use the info in the xterm window (less $hlptxt)"
##### xterm -geometry 120x40 -title "less $hlptxt" -e less "$hlptxt" &
# write help text using parted, /etc/mtab, /sys/devices, fdisk
echo "*** Unmount the device if mounted ****************************"
echo " "
ltest0=$(grep " / " /etc/mtab|cut -d ' ' -f 1)
if [ "$ltest0" == "/cow" ]
then
ltest1=$(grep " /isodevice" /etc/mtab|cut -c 5-8)
livedrive=$ltest1
elif [ "${ltest0/\/dev\/sd}" != "$test0" ]
then
livedrive=$(grep " / " /etc/mtab|cut -c 5-8)
else
livedrive="not_found"
fi
#echo ltest0=$ltest0
#echo ltest1=$ltest1
#echo livedrive=$livedrive
for i in /dev/sd?; do sudo parted -ls|grep -B1 "$i"|tr '\n' '\t';echo "";done
echo Live drive: /dev$livedrive
for i in $(find /sys/devices -name "*sd?"|grep usb|sed s#.*/##)
do
fdisk -lu /dev/$i 2>/dev/null|grep "Disk /dev"
done|sed 's/Disk/USB drive: /'|sort
echo " "
# echo " Edit if necessary [one of] the following lines"
# echo " and paste it as a command!"
# echo " "
ans=
while [ "$ans" != "g" ]
do
item=0
cmdsav=
for j in $(for i in $(find /sys/devices -name "*sd?"|grep -v $livedrive |sed s#.*/##)
do
fdisk -lu /dev/$i 2>/dev/null|grep "Disk /dev"|sed -e s/:.*// -e s/.*\ //
done|sort)
do
busy=0
for k in $(grep $j /etc/mtab|sed s#\ /.*##) ; do umount $k 2>/dev/null; if [ "$?" == "1" ];then busy=1;fi ;done
if [ "$busy" == "1" ]
then
echo "# Could not unmount $j because file system on device is busy"
else
item=$(($item + 1))
# echo $item , $choice
if [ $item -eq $choice ]
then
/bin/echo -en "\0033[7m---> "
else
/bin/echo -en " "
fi
if [ "$1" == "" ]
then
targ0="$j"
cmd0="install $source to $j"
else
targ0=
cmd0="dd if="$source" bs=${bs}$cnt of=$j"
fi
echo $cmd0
if [ "$item" == "$choice" ]
then
/bin/echo -en "\0033[0m"
target=$targ0
cmdsav=$cmd0
fi
fi
done
# select device, go or quit
echo "Select another device with (+/-), go with g or quit with q"
read ans
if [ "$ans" == "+" ]
then
choice=$(($choice + 1))
if [ $choice -gt $item ]
then
choice=$item
fi
elif [ "$ans" == "-" ]
then
choice=$(($choice - 1))
if [ $choice -lt 1 ]
then
choice=1
fi
elif [ "$ans" == "q" ]
then
exit
fi
done
# here we go
echo "$cmdsav"
echo "Do you really want to wipe and/or install to this device? (y/n)"
read ans
if [ "$ans" == "y" ]
then
if [ "$target" == "" ]
then
echo "$cmdsav"
else
swapoff "$target"* 2>/dev/null
sync
cnt=" count=$count"
# wipe the first megabyte
dd if=/dev/zero bs=${bs}$cnt of=$target
echo " "
echo "Installing $system to $target ..."
echo " "
mklub "$system" "$target"
fi
fi
fi
Follow ups