Installing Slackware Linux from another GNU/Linux

quand y'en a marre y'a carambar

Jan 2019: tested from the bionic/amd64 rescue system on a Dedibox Start-1-M-SATA (XC 2015) – Nov 2019: works also on Pro-5-S

Ready?

Start your machine in rescue mode

Either connect to the rescue mode DIRECTLY AS ROOT

ssh -l root YOUR-DEDIBOX

or as sd- user, then switch to root

sudo su -
#screen -S slackinst

English please, and no colors,

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

Requirements,

apt update
apt install -y 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 10G /data
sda3 all remaining space Linux LVM

ls -lF /dev/sda*
partprobe

Prepare the file-systems,

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

Choose a mirror,

# FRANCE
mirror=http://nephtys.lip6.fr/pub/linux/distributions/slackware/slackware64-14.2/

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

Prepare your rescue system (those are not available as patches/),

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/ tar-1.29-x86_64-1.txz pkgtools-14.2-noarch-10.txz

#/sbin/installpkg: 365: /sbin/installpkg: /bin/du: not found
ls -lF /bin/du #noexist yet
ln -s /usr/bin/du /bin/du

Donno how to solve this error (see doinst.sh as appendix), but we are going to fix the timezone manually anyway - so it does not matter at all

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

Also if you proceed with the full install, you might get

sendmail-8.15.2-x86_64-2: mail transfer agent .......................... [3.9M]
chown: invalid group: 'root:smmsp'
chown: invalid user: 'smmsp:smmsp'

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 -alF lala/
mkdir lala/proc/ lala/dev lala/sys
mount -o bind /proc lala/proc
mount -o bind /dev lala/dev
mount -o bind /sys lala/sys

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

wget http://pub.nethence.com/bin/slack/slackinst.bash.txt
cp slackinst.bash.txt slackinst.bash
chmod +x slackinst.bash
vi slackinst.bash  

mirror=...
installtype=full

./slackinst.bash lala/

Finish-up

cat lala/etc/fstab #noexist yet
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
mkdir lala/data/

Fix the timezone,

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

Setup the boot loader,

cat lala/etc/lilo.conf #noexist yet
sed '/^#/d; /^$/d' lala/etc/lilo.conf_example > lala/etc/lilo.conf
vi lala/etc/lilo.conf

timeout = 30
vga = 791

image = /boot/vmlinuz
        label = "Linux"
        append = "vt.default_utf8=0 ipv6.disable=1 mitigations=off"
        read-only

chroot lala/ ldconfig
chroot lala/ lilo
chroot lala/ update-ca-certificates
#depmod ...

Eventually proceed with a brutal network setup

Finally,

sync
umount -R lala/

You are ready to exit the rescue system, boot in normal mode, connect remotely and proceed with post-installation tuning

Start from Scratch

umount lala/proc/ lala/dev/ lala/sys/
rm -rf lala/*
umount lala/
fsck -f /dev/sda1 #create lost+found

Troubleshooting

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 )

BASH fails to chroot

# 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 +++

==> run chroot lala ldconfig first

KSH fails too now

export LANG=C
export LC_MESSAGES=C
chroot lala /bin/ksh

# strace chroot lala /bin/ksh
execve("/usr/sbin/chroot", ["chroot", "lala", "/bin/ksh"], 0x7ffd76322c60 /* 15 vars */) = 0
brk(NULL)                               = 0x55dcd3032000
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) = 0x7f18fc090000
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) = 0x7f18fc08e000
mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f18fba7f000
mprotect(0x7f18fbc66000, 2097152, PROT_NONE) = 0
mmap(0x7f18fbe66000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f18fbe66000
mmap(0x7f18fbe6c000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f18fbe6c000
close(3)                                = 0
arch_prctl(ARCH_SET_FS, 0x7f18fc08f540) = 0
mprotect(0x7f18fbe66000, 16384, PROT_READ) = 0
mprotect(0x55dcd2460000, 4096, PROT_READ) = 0
mprotect(0x7f18fc097000, 4096, PROT_READ) = 0
munmap(0x7f18fc090000, 27009)           = 0
brk(NULL)                               = 0x55dcd3032000
brk(0x55dcd3053000)                     = 0x55dcd3053000
getcwd("/root", 4096)                   = 6
lstat("/root/lala", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chroot("lala")                          = 0
chdir("/")                              = 0
execve("/bin/ksh", ["/bin/ksh"], 0x7ffeaa49cce8 /* 15 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/ksh'", 32failed to run command '/bin/ksh') = 32
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 +++

==> run chroot lala ldconfig first

Additional Notes

untested

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

Ext4 https://wiki.archlinux.org/index.php/ext4

largefile feature at creating file-system https://unix.stackexchange.com/questions/43102/largefile-feature-at-creating-file-system

Best options to create and mount an ext4 volume containing > 10M files in one directory https://serverfault.com/questions/404571/best-options-to-create-and-mount-an-ext4-volume-containing-10m-files-in-one-di


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