четверг, 17 июля 2008 г.

Instruction for Enlightenment-LiveCD installation on harddisk and/or flash/USB_stick. How-to.

/*

This article was written when I failed to run OpenSUSE automated installers (both of them: "into the local directory" and "installer from LiveCD to the harddisk"). Now "SOAD Linux" could be easily installed to your drive using the standard YaST Installers (in GUI or in 'ncurses' mode). So, please consider this article as an example of steps we did in early 90-th installing Linux from the running PC of a friend (who had the INTERNET! connection on a 11200 modem).

Here is the instruction how to install the "Enlightenment LiveCD" to your hard drive or flash drive. This instruction is also valid for all LiveCD's which use root fs compressed as a single 'squashfs' file. If you wish to copy LiveCD to the flash drive then you may wish to keep 'squashfs' file with a root tree and just add a grub loader and proper 'initrd'. I didn't test the details of installation to the flash pen because I don't have 1Gb or more needed ones.

The idea of the "istallation" from LiveCD to any other media is quite simple. Prepare your destination drive, copy the content of 'squashfs' to the new root partition, generate proper 'initrd' and configure bootloader. The only thing here that is important is patience. Packages like 'grub' and 'mkinitrd' are added only to the last LiveCD versions, you can add them by hand (just compare 'list_of_iinstalled_packages' with your own) or grab the latest LiveCD iso image.

Here we go...

Almost all actions require root privileges, just open your terminal (Xterm, btw, do you like it's default settings? hope you do...) and become a 'root' (type 'su' and Passwd - 'soad').

1. Create a proper partitioning for the destination drive. Prepare at least separate partitions for swap and root. The rest you can manage later. Here's what I have right after system install from LiveCD to the 'Qemu' virtual drive:

256Mb for swap partition, 3.7Gb (the rest from 4Gb virtual disk) for root partition and root partition have 2.4Gb of space available (used only 1.2Gb). I like it and aware that some packages could be deleted from installed system to free even more space. Treat it as an answer to the rants of lusers that OpenSUSE is "too fat, too slow, to inflexible in configuration, etc".

Let's make an assumption that your destination drive is /dev/sda, where you have /dev/sda1 as swap and /dev/sda2 as root partition (at least). You can make it all via YaST Partitioner service.

2. Create three (3) temporary directories to be the 'mount points' for our exercise:

>mkdir /tmp/1
>mkdir /tmp/2
>mkdir /tmp/3

3. Mount our root partition, mount LiveCD which is still in your CD-ROM drive and run the box and mount compressed root fs of your LiveCD:

# root partition
>mount /dev/sda2 /tmp/1

# LiveCD itself
>mount /dev/sr0 /tmp/2 -o loop

# compressed 'squashfs' root fs of your LiveCD
>mount /tmp/2/suse-11.0-live-iso-read-only.i686-2.5.1 /tmp/3 -o loop -t squashfs

4. "Install" the whole system from LiveCD to the new root partition. As a source we're using the 'squashed' image mounted to the /tmp/3 . :

>cp -fra /tmp/3/* /tmp/1/

yep, that's how we all did it 10 years ago or so... good old "True Unix Way" :).

5. We need to copy /etc/fstab and adjust to our realm:

>cp /etc/fstab /tmp/1/etc/fstab

after adjustments I have something like this:

>cat /tmp/1/etc/fstab

devpts /dev/pts devpts mode=0620,gid=5 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
#/dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00001-part1 swap swap defaults 0 0
#/dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00001-part2 / ext3 acl,user_xattr 1 1
/dev/sda1 swap swap defaults 0 0
/dev/sda2 / ext3 acl,user_xattr 1 1

Replaced the mount operation of swap and root from 'disk_by_id' to the good old 'dev' style. It's not the point if you'd just copy 'disk_id' to the target system (/dev/disk/*).

6. Now we need to generate a proper 'initrd' for our target system

> chroot /tmp/1/
> mkinitrd
> exit

Hint: we could generate 'initrd' withou 'chroot' operation and then just copy it to the destination ( cp /boot/initrd-2.6.25.5-1.1-default /tmp/1/boot/ ), but it's more safe to make it in chroot. Original LiveCD has a 'monster' initrd image you can look at:

> l /tmp/2/boot/i386/loader/initrd

You may experiment with this 'fat cat' or even create yours:

> mkinitrd -A

It's funny, you gonna like it!

7. And it's time to make our system bootable and adjust bootloader configs. Some kind of 'typing exercise' is here because default (automated) presets are not helpful.

> cp -r /boot/groob /tmp/1/boot/
> cp -r /boot/boot /tmp/1/boot/

Check our 'map' file (or create if none exist yet):

> cat /tmp/1/boot/grub/device.map

(hd0) /dev/sda
(fd0) /dev/fd0

Manual installation of 'grub' to the MBR of our destination disk (/dev/sda):

> grub

# yep, we've entered to the grub's command line mode
# the next command will install loader code to the MBR assuming that all configuration files are located in (/dev/sda2)/boot/grub/ directory.

grub> setup --stage2=/boot/grub/stage2 (hd0) (hd0,1)

8. Let's create a simple bootloader menu:

> cat /tmp/1/boot/grub/menu.lst

timeout 3

title SOAD
root (hd0,1)
kernel /boot/linuz
initrd /boot/initrd

9. Reboot to the new system and fix any errors (if any). Before you press 'reboot button' the following MIGHT be useful (but It's just an example of 'insurance' if I may say so):

> cp /dev/sd* /tmp/1/dev/
> cp /dev/md* /tmp/1/dev/
> cp /dev/sr* /tmp/1/dev/
> cp /dev/cd* /tmp/1/dev/
> cp /dev/md* /tmp/1/dev/
> cp /dev/ram* /tmp/1/dev/

When you update your kernel to the newer one (you'd BETTER do it ASAP) all required 'devices' (and a lot of other components) will be properly recreated.

10. After reboot to your new system remove/stop all services you don't really need and enable those you can't live without. Examples:

> chkconfig create_xconf off
> chkconfig entrance_force off
> chkconfig entrance on
> chkconfig entrance 35

Or you may leave 'entrance_force" - doesn't matter, it's just a crutch for LiveCD, and if you have generated /etc/X11/xorg.conf - stop 'create_xconf' or you gonna lose all custom modification because file will be created 'from scratch' every time you turn your system on.

P.S. If you wish to install on flash pen and keep 'squashed' root fs, then you need to 'google' for UNIONFS and implementation of grub+UNIONFS. I'd provide detailed 'how-to from LiveCD to the flash' if I had one suitable here :). Can only recommend to begin with this page if you wish to master your Live USB system:

Live_USB_stick

(only keep im mind that default patterns in 'config.xml' files... sucks! I bet you wish to have some 'packman' goodies and some more from your own... )

If you find any 'bug' in this small how-to - please, post a comment here. Thanks!

*/

5 комментариев:

Анонимный комментирует...

а можетt сделаnm так, чтобы его можно было установить нажатием кнопки? я долго искала такую..

sda комментирует...

а можетt сделаnm так, чтобы его можно было установить нажатием кнопки? я долго искала такую..

в последних релизах работает автоинсталлер. в октябре сделаем "кнопку", повесив её как ярлык на десктопе. будет.

Анонимный комментирует...

все нормально до момента:
> mkinitrd
Scanning scripts ...
Resolve dependencies ...
Install symlinks in /lib/mkinitrd/setup ...
Install symlinks in /lib/mkinitrd/boot ...

Kernel image: /boot/vmlinuz-2.6.25.5-1.1-default
Initrd image: /boot/initrd-2.6.25.5-1.1-default
node name not found
/dev/sda2: error opening volume
Root device (/dev/sda2) not found
ReadPartitions(): Failed to open dir /sys/block at /usr/lib/per15/vendor_per1/5.10.0/Bootloader/Tools.pm line 280.

sda комментирует...

все нормально до момента:

это автоинсталлер споткнулся? то есть Вы открыли 'xterm', ввели команду su (пароль рута, по кмолчанию - soad) потом запустили

yast live-installer

появилось текстовое меню и оно споткнулось на установке? проверьте md5sum Вашего диска. должно быть:

> md5sum suse-11.0-live-iso.i686-2.5.1.iso
98c345fe57c1ed814e53af876d9b06e3 suse-11.0-live-iso.i686-2.5.1.iso

спасибо

Анонимный комментирует...
Этот комментарий был удален администратором блога.