Installing Slackware Linux from another GNU/Linux

quand y'en a marre y'a carambar

Introduction

Jan 2019: tested from the bionic/amd64 rescue system on a Dedibox Start-1-M-SATA (XC 2015)

Ready?

Start in rescue mode and switch to root,

sudo su -
#screen -S slackinst

English please, and no colors,

export LANG=C
export LC_MESSAGES=C
alias ll='ls -alkF'
echo 'syn off' >> ~/.vimrc

Requirements,

apt update
apt install ksh lftp man-db manpages mlocate
#dpkg -l | grep xz-utils

#which wget
#which ksh
#which lftp
#which xz

Freaking Ubuntu — it mounts the swap space if it finds one,

swapon -s
swapoff -a

Prepare a partition e.g. for SATA 1TB,

free -m
fdisk -l
fdisk /dev/sda
o
w
cfdisk /dev/sda
sda1 15G BOOTABLE FOR EXTLINUX
sda2 8G TYPE SWAP
sda3 all remaining space

ls -lhF /dev/sda*
#partprobe

Prepare the file-systems,

mkfs.ext4 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 -T largefile4 /dev/sda3

Choose a mirror,

# FRANCE
mirror=http://mirrors.phx.ms/slackware/slackware64-14.2/

# RUSSIA
#mirror=https://mirror.yandex.ru/slackware/slackware64-14.2/

Prepare your rescue system,

cd ~/
wget $mirror/slackware64/a/pkgtools-14.2-noarch-10.txz
wget $mirror/slackware64/a/tar-1.29-x86_64-1.txz
tar xJf pkgtools-14.2-noarch-10.txz -C /
tar xJf tar-1.29-x86_64-1.txz -C /
rm -rf /install/
rm -f tar-1.29-x86_64-1.txz pkgtools-14.2-noarch-10.txz

#/sbin/installpkg: 365: /sbin/installpkg: /bin/du: not found
ls -lkF /bin/du
ln -s /usr/bin/du /bin/du

donno how to solve this

a/glibc-zoneinfo-2016e-noarch-1.txz...
chroot: failed to run command '/bin/cp': No such file or directory

Now proceed with a Slackware Installation from the command-line.

Go!

Mount the file-systems, incl. proc for LILO to run happily,

mkdir lala/
mount /dev/sda1 lala/
ls -alhF lala/
mkdir lala/proc/
mount -o bind /proc lala/proc

Targetting sets A AP N w/o D L Y so far,

wget http://pub.nethence.com/bin/slackinst.ksh
chmod +x slackinst.ksh
mount | grep sda1
ls -alhF lala/
./slackinst.ksh lala

Since this is installed only ADD tagged packages from the aforementioned sets, you also might want this to get slackpkg to work (note this is gnupg and not gnupg2),

"which \
dialog \
slackpkg \
ncurses \
gnupg \
wget \
libunistring \

And those to be able to talk SSL,

curl \
ca-certificates \
perl \
openssl \

Additionally, those are also required for a decent and minimal system (note the SSH daemon gets installed),

man-pages \
openssh \
diffutils \
file"

Do not give a shit about this error (see doinst.sh as appendix), as we are going to fix the timezone anyway.

glibc-zoneinfo-2016e-noarch-1: timezone database ....................... [2.4M]
chroot: failed to run command '/bin/cp': No such file or directory

Check that chroot works right away,

chroot lala /bin/ksh
^D

Then finish-up,

cat > lala/etc/fstab <<-EOF
/dev/sda1        /                ext4        defaults         1   1
/dev/sda2        swap             swap        defaults         0   0
/dev/sda3        /data            ext4        defaults         1   2
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
EOF
cat lala/etc/fstab
mkdir lala/data

Brutal network setup,

mv -i lala/etc/rc.d/rc.inet1 lala/etc/rc.d/rc.inet1.dist
chmod -x lala/etc/rc.d/rc.inet1.dist
cat > lala/etc/rc.d/rc.inet1 <<-EOF
#!/bin/bash

echo rc.inet1 PATH is \$PATH

echo -n lo...
ifconfig lo up && echo done

echo -n eth0...
ifconfig eth0 x.x.x.x/xx up && echo done

echo -n default route...
route add default gw x.x.x.x && echo done
EOF
vi lala/etc/rc.d/rc.inet1
chmod +x lala/etc/rc.d/rc.inet1

echo slack > lala/etc/HOSTNAME
vi lala/etc/HOSTNAME

mv lala/etc/hosts lala/etc/hosts.dist
cat > lala/etc/hosts <<-EOF
127.0.0.1   localhost
x.x.x.x     slack
x.x.x.x     gw
EOF
vi lala/etc/hosts

cat > lala/etc/resolv.conf <<-EOF
search example.net
nameserver 208.67.222.222
nameserver 208.67.220.220
EOF

mkdir lala/root/.ssh/
chmod 700 lala/root/.ssh/
vi lala/root/.ssh/authorized_keys
chmod 600 lala/root/.ssh/authorized_keys

ls -lhF lala/etc/rc.d/rc.sshd

Fix the timezone,

ls -lF lala/etc/localtime-copied-from
ls -lF lala/etc/localtime
rm -f lala/etc/localtime-copied-from
rm -f lala/etc/localtime
#ln -s ../usr/share/zoneinfo/Europe/Paris lala/etc/localtime
ln -s ../usr/share/zoneinfo/Europe/Moscow lala/etc/localtime

Setup the boot loader,

chroot lala /bin/ksh
set -o emacs

cd /etc/
sed -r '/^#/d; /^$/d' lilo.conf_example > lilo.conf
vi lilo.conf

timeout = 30

image = /boot/vmlinuz
        label = "Linux"
        read-only

lilo

update-ca-certificates
#depmod ...
#ldconfig
^D

Finally,

sync
umount lala/proc/
umount lala/
rmdir lala/

You are ready to exit the rescue system, boot in normal mode and connect remotely.

Start from Scratch

umount lala/proc/
umount lala/
mkfs.ext4 /dev/sda1
mount /dev/sda1 lala/
mkdir lala/proc/
mount -o bind /proc lala/proc
ls -alhF lala/

Troubleshooting

Easy copy/pasting allowed as Bash freaks out with tabulations, sometimes,

ksh
set -o emacs

Nevermind this, fixing localtime manually.

glibc-zoneinfo-2016e-noarch-1: timezone database ....................... [2.4M]
chroot: failed to run command '/bin/cp': No such file or directory

==>

# Fix existing old style /etc/localtime symlink:
if [ -L etc/localtime -a ! -r etc/localtime-copied-from ]; then
  mv etc/localtime etc/localtime-copied-from
fi
# Add the default timezone in /etc, if none exists:
if [ ! -r etc/localtime ]; then
  ( cd etc ; rm -rf localtime localtime-copied-from )
  ( cd etc ; ln -sf /usr/share/zoneinfo/Factory localtime-copied-from )
fi
# Make sure /etc/localtime is updated:
chroot . /bin/cp etc/localtime-copied-from etc/localtime
# Add the default link in /usr/share/zoneinfo:
( cd usr/share/zoneinfo ; rm -rf timeconfig )
( cd usr/share/zoneinfo ; ln -sf /usr/sbin/timeconfig timeconfig )
### Make the rest of the symbolic links in the zoneinfo database:
( cd usr/share/zoneinfo ; rm -rf localtime )
( cd usr/share/zoneinfo ; ln -sf /etc/localtime localtime )

It makes no sense, use ksh instead.

# chroot lala /bin/bash
chroot: failed to run command ‘/bin/bash’: No such file or directory

==>

# strace chroot lala
execve("/usr/sbin/chroot", ["chroot", "lala"], 0x7ffcdb473a28 /* 16 vars */) = 0
brk(NULL)                               = 0x55f705f6a000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=27009, ...}) = 0
mmap(NULL, 27009, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4366846000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4366844000
mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4366235000
mprotect(0x7f436641c000, 2097152, PROT_NONE) = 0
mmap(0x7f436661c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f436661c000
mmap(0x7f4366622000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4366622000
close(3)                                = 0
arch_prctl(ARCH_SET_FS, 0x7f4366845540) = 0
mprotect(0x7f436661c000, 16384, PROT_READ) = 0
mprotect(0x55f704c20000, 4096, PROT_READ) = 0
mprotect(0x7f436684d000, 4096, PROT_READ) = 0
munmap(0x7f4366846000, 27009)           = 0
brk(NULL)                               = 0x55f705f6a000
brk(0x55f705f8b000)                     = 0x55f705f8b000
getcwd("/root", 4096)                   = 6
lstat("/root/lala", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chroot("lala")                          = 0
chdir("/")                              = 0
execve("/bin/bash", ["/bin/bash", "-i"], 0x7fffb7041ae0 /* 16 vars */) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "chroot: ", 8chroot: )                 = 8
write(2, "failed to run command '/bin/bash"..., 33failed to run command '/bin/bash') = 33
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(127)                         = ?
+++ exited with 127 +++

Additional Notes

Un-validated: alternative way to get the boot loader ready (from the rescue system directly),

apt install lilo
vi /etc/lilo.conf

lba32
boot = /dev/sda
root = /dev/sda1
prompt
timeout = 30
vga = normal

image = /boot/vmlinuz
        label = "Linux"
        read-only

Resources

Information about the Dedibox network https://documentation.online.net/en/dedicated-server/network/dedibox-network

Management of the DNS servers https://documentation.online.net/en/web/domain-name/tutorial/dns-server-management


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml