Hi,
Since I happend to buy
Dedibox XC SATA 2016 I decided to detail my method of Slackware installation.
This mini HOWTO repeats some information from the previous posts and introduces some new information. It wouldn't be possible to write it without first following Alien Bob's instructions to have the first grasp. Thanks!
The highlights (or not ;-)) of my method are:
* full utilization of Slackware's installer provided tools (e.g. cfdisk),
* tagfile based installation using HTTP mirror,
* syslinux for booting,
* generic kernel + initrd,
* partition management with LVM2.
Here it comes:
1. Login into online.net's
console and choose your server from the server list.
2. Since Slackware installation is not supported by online.net, we will use [RESCUE] mode. [RESCUE] mode might not be available until there is some OS already installed, so use [INSTALL] action to install whichever distribution they support. After the installation has completed, [RESCUE] mode becomes available.
But do not start it yet!
3. Basically, [RESCUE] mode starts selected (from predefined list) operating system, allowing you to interact with the hardware in, you guessed it, rescue mode ;-) But since [RESCUE] operating system takes some time to load, it is helpful to be able to watch the loading progress. Use [SERIAL CONSOLE] to get access to the serial console. It is important that you start [SERIAL CONSOLE] now, since the option disappears once [RESCUE] mode is started.
4. Now start [RESCUE] mode, choosing [Ubuntu 14.04 (amd64)] as the rescue operating system. Let the rescue OS load and then connect over
ssh, using the details provided on the website. BTW, [SERIAL CONSOLE] seems to not always work in [RESCUE] mode (you cannot observe the booting progress), so you might just want to try to
ssh into the rescue OS periodically, until the login succeeds.
5. Give yourself a bit more power:
Code:
$ sudo su -
(use the same password as for ssh login)
6. Download and unpack Slackware's installer initrd:
Code:
$ mkdir /setup
$ cd /setup
$ wget http://mirrors.kernel.org/slackware/slackware64-14.2/isolinux/initrd.img
$ gunzip -cd initrd.img | cpio -dvim
7.
chroot into the Slackware's installer:
Code:
$ mount -t proc /proc proc
$ mount --rbind /sys sys
$ mount --rbind /dev dev
$ mount --rbind /run run
$ chroot /setup /bin/bash --login
NOTE:
I used
--rbind instead of
--bind. Using
--bind seems to be a problem for correct operation of
lvcreate.
8. Set terminal type, so that fonts are displayed correctly:
a) if you login from X terminal:
Code:
$ export TERM=xterm
b) if you login from VT:
Code:
$ export TERM=linux
9. Partition and format the hard drive:
See
Appendix A for the exact commands I used to partition and format the hard drive.
I prefer to use
cfdisk for the task of partitioning. Since I am going to use LVM2 and it seems that
syslinux does not support booting from LVM partitions, I created two partitions. The first one is going to be used for booting, that is, it is going to contain the kernel image, initrd and syslinux config file. The other partition is going to be managed by LVM.
When creating partition table, I choose to use
dos type as opposed to
gpt type. For that reason, I cannot tell if
gpt would work as well.
The boot partition has to have the
bootable flag set. As for the file system, I have chosen
ext2. The size is set to 128MiB and should be more than sufficient.
NOTE:
I have seen the problem with the kernel not being notified about partition table change, but only once, and I do not recall under what conditions. If you are not able to correctly partition the drive from within the Slackware's setup
chroot, then you might have more luck using the method explained before by Alien Bob.
In addition, executing:
after you are done with the partitioning might be also a good idea.
Format the partitions. Although it can be done from within the setup program itself, I prefer to do it on the command line. This way you can watch the progress. (If you were installing locally, you would just switch to the VT, where the progress is being reported, but well, you are not installing locally and you do not have another VT ;-)).
After partitioning, LVM-ing and formatting, I come up with the following partitions:
Code:
/dev/sda1 (ext2, 128MiB, mbr, bootable)
/dev/sda2 (lvm)
/dev/mapper/vg0-rootfs (ext4, rootfs)
10. Add nameserver address to make DNS work:
Code:
$ echo nameserver 62.210.16.6 >> /etc/resolv.conf
$ echo nameserver 62.210.16.7 >> /etc/resolv.conf
$ ping google.com
This is necceassary for the HTTP based installation to work correctly.
11. Run the
setup program:
When prompted, add the /dev/sda1 to fstab. It has to be mounted under /boot directory.
12. Once you get to [SOURCE MEDIA SELECTION], choose [Install from FTP/HTTP server] and provide the required details. I prefer to use the following:
Code:
* URL OF FTP/HTTP SERVER: http://mirrors.kernel.org/
* SOURCE DIRECTORY: /slackware/slackware64-14.2/slackware64/
I used
tagpath /
tagfile based installation, with fairly basic packages selection. My selection does not include
lilo, so the setup program will not ask me to perform LILO configuration step. If, on the other hand, you decide to perform full installation or you happen to install LILO, then, when prompted, skip the LILO configuration step. We will not use LILO, but syslinux instead.
And if you wonder how I got my custom tagfiles available for the setup program, then the answer is: I scp'ed them from my local machine and then I upacked them under /setup/tagfile. This is possible, since you can have many
ssh connections to the [RESCUE] operating system. See
Appendix B for some more info on tagfiles.
13. Once the setup program has finished, there are a few tasks to be performed and they require that you
chroot into your freshly installed Slackware, so
do not reboot the machine when prompted now. What is more, you are going to chroot from already chroot'ed /setup directory. This is kinda important, because when the setup program fishes, it leaves your root partition mounted on /mnt and your boot partition mounted on /mnt/boot. Proceed as follows:
Code:
$ chroot /mnt /bin/bash --login
14. Bootloader:
Execute the following commands to install syslinux/extlinux bootloader:
Code:
$ extlinux --install /boot
$ dd count=1 bs=440 conv=notrunc if=/usr/share/syslinux/mbr.bin of=/dev/sda
Create /boot/syslinux.cfg:
Code:
PROMPT 0
TIMEOUT 0
DEFAULT vmlinuz-generic
SERIAL 1 9600
LABEL vmlinuz-generic
KERNEL vmlinuz-generic
APPEND console=ttyS1,9600 printk.time=0 quiet ipv6.disable=1 ro
INITRD initrd.gz
This configuration will enable the messages to appear on the [SERIAL CONSOLE]. I also specify some kernel parameters (printk.time=0 quiet) to considerably silence its output (error messages would still appear). As I don't want to bother with IPv6, I disable it at kernel level (ipv6.disable=1). As you can see, we will use the generic kernel with initrd. This is the only way (that is, by means of initrd) the LVM2 can be made operational.
Please note that, the kernel and initrd paths specified in syslinux.cfg have to be relative. This is because syslinux is unable to read from LVM based root partition, so something like /boot/vmlinuz-generic wouldn't work.
If you want to be able to login on the [SERIAL CONSOLE], you will have to uncomment the following:
Code:
$ grep s2 /etc/inittab
s2:12345:respawn:/sbin/agetty -L ttyS1 9600 vt100
and
Code:
$ grep ttyS1 /etc/securetty
ttyS1
Additionally, since the server has no keyboard and display, it is worth disabling tty1 .. tty6:
Code:
$ grep c[1-6] /etc/inittab
#c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
#c2:12345:respawn:/sbin/agetty 38400 tty2 linux
#c3:12345:respawn:/sbin/agetty 38400 tty3 linux
#c4:12345:respawn:/sbin/agetty 38400 tty4 linux
#c5:12345:respawn:/sbin/agetty 38400 tty5 linux
#c6:12345:respawn:/sbin/agetty 38400 tty6 linux
BTW, my favorite console editor is
mcedit and it is possible to use it to edit the files from within the
chroot. It is also possible to prepare all the config files on the local machine and then
scp them to the server in question.
15. initrd:
Create /etc/mkinitrd.conf:
Code:
# mkinitrd.conf
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
CLEAR_TREE="1"
#OUTPUT_IMAGE="/boot/initrd.gz"
KERNEL_VERSION="$( readlink /boot/vmlinuz-generic | rev | cut -f1 -d- | rev )"
#KEYMAP="us"
MODULE_LIST="ext4"
#LUKSDEV="/dev/sda2"
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
ROOTDEV="/dev/mapper/vg0-rootfs"
ROOTFS="ext4"
#RESUMEDEV="/dev/sda2"
#RAID="0"
LVM="1"
#UDEV="1"
#MODCONF="0"
WAIT="0"
As the comment says, see "man mkinitrd.conf" for details on the syntax of this file ;-) This file is sourced by the /sbin/mkinitrd script, so it is possible to use shell commands in it: for example, KERNEL_VERSION is determined based on the installed kernel version by extracting the version portion from the kernel image file name. This becomes useful when you are recreating the initrd after the kernel has been updated.
Since my setup makes use of LVM, the LVM variable is set to 1. If you are not using LVM, then leave the value at 0. And remember to set ROOTDEV variable to point to the device on which your root filesystem is actually located.
Once the /etc/mkinitrd.conf has been tuned, to create the initrd, run:
16. Before you reboot:
While still in the Slackware installation chroot, you might consider performing some administrative tasks, like adding another user and setting up its key based ssh login. Remember that you can use scp to send all the files you need.
For example, I edited /etc/fstab, so that /boot partition is mounted read-only and fsck is disabled. This could also be done once the system is booted.
17. Reboot:
I am not sure, how much of these is necessary, but I did the following as a safety measure before rebooting the system:
I exited the Slackware's installation chroot, back to the /setup chroot:
Then I umounted all the file systems mounted on /mnt:
Code:
$ cat /proc/mounts | grep mnt
/dev/mapper/vg0-rootfs /mnt ext4 rw,relatime,data=ordered 0 0
/dev/sda1 /mnt/boot ext2 rw,relatime,stripe=4 0 0
/proc /mnt/proc proc rw,relatime 0 0
sysfs /mnt/sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
udev /mnt/dev devtmpfs rw,relatime,size=8185100k,nr_inodes=2046275,mode=755 0 0
$ umount /mnt/dev
$ umount /mnt/sys
$ umount /mnt/proc/
$ umount /mnt/boot
$ umount /mnt
While still in /setup chroot, I stopped LVM:
Code:
$ /sbin/vgchange -an
0 logical volume(s) in volume group "vg0" now active
$ /bin/sync
Then I went to the online.net's
console and executed the [BOOT IN NORMAL MODE] action, immediately switching to the [SERIAL CONSOLE] to watch the boot process :-)
My system has booted without any problems whatsoever.
18. Don't panic if you misconfigured something and the system does not boot.
Use [SERIAL CONSOLE] to debug the problem and then [RESCUE] mode to fix it ;-)
Appendix A: partitions and LVM2:
Code:
# Clear the master boot record and partition table, just in case:
$ dd count=1 bs=512 if=/dev/zero of=/dev/sda
# Partition the disk:
$ cfdisk /dev/sda
-> Select label type: dos
-> [New] -> 128M -> [primary] -> [Bootable]
-> [New] -> ALL -> [primary] -> [Type] -> 8e Linux LVM
-> [Write] -> yes -> [Quit]
# Just in case:
$ partprobe
# Format /boot partition:
$ mke2fs -t ext2 /dev/sda1
# Create LVM, see [https://wiki.archlinux.org/index.php/LVM] for more details:
$ pvcreate /dev/sda2
$ pvdisplay
$ vgcreate vg0 /dev/sda2
$ vgdisplay
$ lvcreate -L 4G vg0 -n rootfs
$ lvdisplay
$ vgscan
$ vgchange -ay
# Format root file system partition:
$ mke2fs -t ext4 /dev/mapper/vg0-rootfs
Appendix B: tagfiles, virtual machine:
For tagfile generation I used Alien's
tagfile_generator.sh. First, I installed and tested my selection of packages under QEMU. Then I used tagfile_generator.sh to generate tagfiles, that I later scp'ed to the server and used them to perform the installation.
QEMU is worth mentioning here for another reason. It allowed me to easily test the installation and configuration before doing anything on the remote server. Things like LVM2, syslinux or serial console were first made to work and tested within QEMU and later on transplanted onto the remote server.
Please let me know if you find errors or inconsistency.
I will edit the post to correct for possible mistakes.
--
Best regards,
Andrzej Telszewski