https://www.lfscript.org/w/api.php?action=feedcontributions&user=Enesutku&feedformat=atomLFScript - User contributions [en]2024-03-28T10:45:16ZUser contributionsMediaWiki 1.33.0https://www.lfscript.org/w/index.php?title=Installing_your_system&diff=1291Installing your system2019-03-31T17:21:15Z<p>Enesutku: /* Installing a boot loader */</p>
<hr />
<div>[[Category:Documentation]]<br />
This page will explain how to install a system using either LFScript, or your own Live CD.<br />
<br />
== Some notes before you begin ==<br />
If you are using LFScript to install your system, it is assumed you already have compiled your system; LFScript is set up on a writeable partition and the <code>packages</code> directory is populated. It is possible you have transferred your packages directory from another machine.<br />
<br />
If the hard disk is not yet partitioned, see the [[Quick Start]] page for information on how to do that.<br />
<br />
All commands presented here should be executed by the root user.<br />
<br />
If you intend to overwrite an existing boot loader, it is recommended you add the <code>os-prober</code> script to your extra packages. If you want <code>os-prober</code> to detect your existing Windows installations, your host system's kernel must have FAT and/or NTFS support.<br />
<br />
== Format your partitions ==<br />
If you have partitioned your system as explained on the [[Quick Start]] page, you should have two partitions reserved for your new system: '''sda1''' and '''sda2'''. You might also have set up a third ('''sda3''') for SWAP space. And LFScript may be installed on '''sda4'''.<br />
<br />
The '''sda2''' partition is optional, but in this example we shall use it to mount the <code>/usr</code> hierarchy of your new system.<br />
<br />
<pre>mkfs.ext4 /dev/sda1<br />
mkfs.ext4 /dev/sda2 # Optional</pre><br />
<br />
These commands will install an <code>ext4</code> file system on your partitions. You can use any Linux file system you want, but make sure you have [[Kernel configuration|configured your kernel]] to support it.<br />
<br />
If you have not yet configured your swap space, do it now:<br />
<br />
<pre>mkswap /dev/sda3</pre><br />
<br />
== Mount your partitions ==<br />
Mount the partition where your are going to install the system:<br />
<br />
<pre>mkdir /mnt/install_root<br />
mount /dev/sda1 /mnt/install_root</pre><br />
<br />
If you have set up '''sda2''', then mount it as well:<br />
<br />
<pre>mkdir /mnt/install_root/usr<br />
mount /dev/sda2 /mnt/install_root/usr</pre><br />
<br />
You can also change <code>usr</code> to <code>home</code> in the previous commands if you want to have your home directory on the second partition in stead.<br />
<br />
== Install with LFScript ==<br />
<br />
=== Edit 'install.conf' (optional) ===<br />
LFScript is going to configure your system based on the contents of a file called <code>install.conf</code>. Edit that file if you like.<br />
<br />
By default, the file is empty, in which case LFScript will use either default values or ask you for input to configure certain aspects of your system.<br />
<br />
<pre>nano scripts/install.conf # or use any other text editor</pre><br />
<br />
=== Install your system ===<br />
To actually install the system, run LFScript like you would normally do to build a system and add <code>-i /mnt/install_root</code>. If you want to automatically add an existing OS to the boot menu, be sure to also install <code>os-prober</code>.<br />
<br />
<pre>./lfscript <options> -i /mnt/install_root</pre><br />
<br />
For. example:<br />
<br />
<pre>./lfscript -Bux "&#119;get nano os-prober" -i /mnt/install_root</pre><br />
<br />
If the target partition only has just enough space to hold the OS that you have built, you might want to add the [[LFScript Switches|-I switch]] to lfscript and specify a directory which has enough space to temporarily store the source code and tool chain.<br />
<br />
For example:<br />
<br />
<pre>mkdir install_overhead<br />
./lfscript -Bux "&#119;get nano os-prober" -i /mnt/install_root -I install_overhead<br />
rm&nbsp;-rf install_overhead</pre><br />
<br />
== Install from your own Live CD ==<br />
''Note: The Live CD structure is currently under review, and may vary between releases of LFScript. Therefore, this section is subject to change.''<br />
<br />
<pre>cd /mnt/.boot/medium/boot/$(uname -m)</pre><br />
<br />
<pre>unsquashfs -da 64 -fr 64 -f -d /mnt/install_root root.sfs</pre><br />
(Note: File 'root.sfs', is named 'root.sqfs' prior to rev. 21)<br />
<br />
<pre>chroot /mnt/install_root passwd root</pre><br />
<br />
== Modify /etc/fstab ==<br />
If you installed your system on a single partition (it does not matter which one), and you don't care about swap partitions or running <code>fsck</code> on boot, you can skip this step ('''but only if you are using LFScript 4 revision 21 or newer''').<br />
<br />
Modify the '/etc/fstab' file, so that it lists all partitions which make up your file system. Be sure to adjust the following command, so that the first three entries correspond with your set up:<br />
<br />
<pre>cat > /mnt/install_root/etc/fstab << "EOF"<br />
# Begin /etc/fstab<br />
<br />
# file system mount-point type options dump fsck<br />
# order<br />
/dev/sda1 / ext4 defaults 1 1<br />
/dev/sda2 /usr ext4 defaults 1 1<br />
/dev/sda3 swap swap pri=1 0 0<br />
<br />
proc /proc proc nosuid,noexec,nodev 0 0<br />
sysfs /sys sysfs nosuid,noexec,nodev 0 0<br />
devpts /dev/pts devpts gid=4,mode=620 0 0<br />
tmpfs /run tmpfs defaults 0 0<br />
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0<br />
<br />
# End /etc/fstab<br />
EOF</pre><br />
<br />
'''Notes:'''<br />
* Leave out the last line (defining a <code>devtmpfs</code>) if you are using LFScript 4 revision 12.<br />
* If you are not using the command above, but are editing <code>fstab</code> by hand, be sure to remove (or comment out) the existing first line, which defines the <code>rootfs</code>.<br />
<br />
== Installing a boot loader ==<br />
To make your system bootable, you must configure a boot loader. This is a potentially dangerous thing to do to a system which already has an OS installed, as it could render your existing OS unbootable. You should search the web for instructions on how to recover the bootloader of your existing OS, prior to executing the following commands.<br />
<br />
If you already have a Linux OS installed on the system, it may even be better to let it set up the bootloader for you. However, you will need to find out how to do this on your own.<br />
<br />
To let your own system configure the boot loader, execute the following commands:<br />
<br />
<pre>mount --bind /sys /mnt/install_root/sys<br />
mount --bind /proc /mnt/install_root/proc<br />
mount --bind /dev /mnt/install_root/dev<br />
<br />
chroot /mnt/install_root grub-install /dev/sda --target i386-pc #or --target x86_64-efi<br />
chroot /mnt/install_root grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
umount /mnt/install_root/{sys,proc,dev}</pre><br />
<br />
== Cleaning up ==<br />
You can now unmount your system:<br />
<br />
<pre>umount /mnt/install_root<br />
rm&nbsp;-rf /mnt/install_root</pre><br />
<br />
Reboot your system, and enjoy your new OS:<br />
<br />
<pre>shutdown -r now</pre><br />
<br />
== If your system will not boot... ==<br />
<br />
<pre>Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block</pre><br />
<br />
This message is caused by the kernel not having been [[Kernel configuration|configured]] properly. You forgot to include support for your hard drive or file system. Remember that in order to boot, these drivers should '''not''' be compiled as a module.</div>Enesutkuhttps://www.lfscript.org/w/index.php?title=Installing_your_system&diff=1290Installing your system2019-03-31T17:18:50Z<p>Enesutku: /* Installing a boot loader */</p>
<hr />
<div>[[Category:Documentation]]<br />
This page will explain how to install a system using either LFScript, or your own Live CD.<br />
<br />
== Some notes before you begin ==<br />
If you are using LFScript to install your system, it is assumed you already have compiled your system; LFScript is set up on a writeable partition and the <code>packages</code> directory is populated. It is possible you have transferred your packages directory from another machine.<br />
<br />
If the hard disk is not yet partitioned, see the [[Quick Start]] page for information on how to do that.<br />
<br />
All commands presented here should be executed by the root user.<br />
<br />
If you intend to overwrite an existing boot loader, it is recommended you add the <code>os-prober</code> script to your extra packages. If you want <code>os-prober</code> to detect your existing Windows installations, your host system's kernel must have FAT and/or NTFS support.<br />
<br />
== Format your partitions ==<br />
If you have partitioned your system as explained on the [[Quick Start]] page, you should have two partitions reserved for your new system: '''sda1''' and '''sda2'''. You might also have set up a third ('''sda3''') for SWAP space. And LFScript may be installed on '''sda4'''.<br />
<br />
The '''sda2''' partition is optional, but in this example we shall use it to mount the <code>/usr</code> hierarchy of your new system.<br />
<br />
<pre>mkfs.ext4 /dev/sda1<br />
mkfs.ext4 /dev/sda2 # Optional</pre><br />
<br />
These commands will install an <code>ext4</code> file system on your partitions. You can use any Linux file system you want, but make sure you have [[Kernel configuration|configured your kernel]] to support it.<br />
<br />
If you have not yet configured your swap space, do it now:<br />
<br />
<pre>mkswap /dev/sda3</pre><br />
<br />
== Mount your partitions ==<br />
Mount the partition where your are going to install the system:<br />
<br />
<pre>mkdir /mnt/install_root<br />
mount /dev/sda1 /mnt/install_root</pre><br />
<br />
If you have set up '''sda2''', then mount it as well:<br />
<br />
<pre>mkdir /mnt/install_root/usr<br />
mount /dev/sda2 /mnt/install_root/usr</pre><br />
<br />
You can also change <code>usr</code> to <code>home</code> in the previous commands if you want to have your home directory on the second partition in stead.<br />
<br />
== Install with LFScript ==<br />
<br />
=== Edit 'install.conf' (optional) ===<br />
LFScript is going to configure your system based on the contents of a file called <code>install.conf</code>. Edit that file if you like.<br />
<br />
By default, the file is empty, in which case LFScript will use either default values or ask you for input to configure certain aspects of your system.<br />
<br />
<pre>nano scripts/install.conf # or use any other text editor</pre><br />
<br />
=== Install your system ===<br />
To actually install the system, run LFScript like you would normally do to build a system and add <code>-i /mnt/install_root</code>. If you want to automatically add an existing OS to the boot menu, be sure to also install <code>os-prober</code>.<br />
<br />
<pre>./lfscript <options> -i /mnt/install_root</pre><br />
<br />
For. example:<br />
<br />
<pre>./lfscript -Bux "&#119;get nano os-prober" -i /mnt/install_root</pre><br />
<br />
If the target partition only has just enough space to hold the OS that you have built, you might want to add the [[LFScript Switches|-I switch]] to lfscript and specify a directory which has enough space to temporarily store the source code and tool chain.<br />
<br />
For example:<br />
<br />
<pre>mkdir install_overhead<br />
./lfscript -Bux "&#119;get nano os-prober" -i /mnt/install_root -I install_overhead<br />
rm&nbsp;-rf install_overhead</pre><br />
<br />
== Install from your own Live CD ==<br />
''Note: The Live CD structure is currently under review, and may vary between releases of LFScript. Therefore, this section is subject to change.''<br />
<br />
<pre>cd /mnt/.boot/medium/boot/$(uname -m)</pre><br />
<br />
<pre>unsquashfs -da 64 -fr 64 -f -d /mnt/install_root root.sfs</pre><br />
(Note: File 'root.sfs', is named 'root.sqfs' prior to rev. 21)<br />
<br />
<pre>chroot /mnt/install_root passwd root</pre><br />
<br />
== Modify /etc/fstab ==<br />
If you installed your system on a single partition (it does not matter which one), and you don't care about swap partitions or running <code>fsck</code> on boot, you can skip this step ('''but only if you are using LFScript 4 revision 21 or newer''').<br />
<br />
Modify the '/etc/fstab' file, so that it lists all partitions which make up your file system. Be sure to adjust the following command, so that the first three entries correspond with your set up:<br />
<br />
<pre>cat > /mnt/install_root/etc/fstab << "EOF"<br />
# Begin /etc/fstab<br />
<br />
# file system mount-point type options dump fsck<br />
# order<br />
/dev/sda1 / ext4 defaults 1 1<br />
/dev/sda2 /usr ext4 defaults 1 1<br />
/dev/sda3 swap swap pri=1 0 0<br />
<br />
proc /proc proc nosuid,noexec,nodev 0 0<br />
sysfs /sys sysfs nosuid,noexec,nodev 0 0<br />
devpts /dev/pts devpts gid=4,mode=620 0 0<br />
tmpfs /run tmpfs defaults 0 0<br />
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0<br />
<br />
# End /etc/fstab<br />
EOF</pre><br />
<br />
'''Notes:'''<br />
* Leave out the last line (defining a <code>devtmpfs</code>) if you are using LFScript 4 revision 12.<br />
* If you are not using the command above, but are editing <code>fstab</code> by hand, be sure to remove (or comment out) the existing first line, which defines the <code>rootfs</code>.<br />
<br />
== Installing a boot loader ==<br />
To make your system bootable, you must configure a boot loader. This is a potentially dangerous thing to do to a system which already has an OS installed, as it could render your existing OS unbootable. You should search the web for instructions on how to recover the bootloader of your existing OS, prior to executing the following commands.<br />
<br />
If you already have a Linux OS installed on the system, it may even be better to let it set up the bootloader for you. However, you will need to find out how to do this on your own.<br />
<br />
To let your own system configure the boot loader, execute the following commands:<br />
<br />
<pre>mount --bind /sys /mnt/install_root/sys<br />
mount --bind /proc /mnt/install_root/proc<br />
mount --bind /dev /mnt/install_root/dev<br />
<br />
chroot /mnt/install_root grub-install /dev/sda --target i386-pc<br />
chroot /mnt/install_root grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
umount /mnt/install_root/{sys,proc,dev}</pre><br />
<br />
== Cleaning up ==<br />
You can now unmount your system:<br />
<br />
<pre>umount /mnt/install_root<br />
rm&nbsp;-rf /mnt/install_root</pre><br />
<br />
Reboot your system, and enjoy your new OS:<br />
<br />
<pre>shutdown -r now</pre><br />
<br />
== If your system will not boot... ==<br />
<br />
<pre>Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block</pre><br />
<br />
This message is caused by the kernel not having been [[Kernel configuration|configured]] properly. You forgot to include support for your hard drive or file system. Remember that in order to boot, these drivers should '''not''' be compiled as a module.</div>Enesutku