Installing Slackware Linux from another GNU/Linux

abracarambar!

tested on scaleway dedibox with bionic as a rescue system

Ready?

Start your machine in rescue mode

Eventually connect to the rescue mode DIRECTLY AS ROOT

vi ~/.ssh/known_hosts
ssh YOUR-DEDIBOX -l root -p 22

otherwise switch to root and use Online’s provided password

#sudo su -

English please

export LANG=C
export LC_ALL=C
export LC_MESSAGES=C
alias ll='ls -alhF --color=auto'
#echo 'syn off' >> ~/.vimrc

Requirements

apt update
export DEBIAN_FRONTEND=noninteractive
apt install -y wget ksh lftp man-db manpages mlocate xz-utils
apt install -y openssl # upgrades openssl and libssl1

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 for /data as GFS2 (type Linux)

ls -lF /dev/sda*
partprobe

Prepare the file-systems

mkfs.ext4 /dev/sda1
#mkswap /dev/sda2

#dd if=/dev/zero of=/dev/sdb bs=1M count=1
#pvcreate /dev/sdb

Choose a mirror

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

# RUSSIA
#mirror=https://mirror.yandex.ru/slackware/slackware64-14.2/
    mirror=https://mirror.yandex.ru/slackware/slackware64-current/
#https://mirrors.nxthost.com/slackware/slackware64-current/

# LAN
    #mirror=http://x.x.x.x/slackware142/

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

lftp -c "open $mirror/slackware64/a/; mget pkgtools-*.txz"
tar xJf pkgtools-*.txz -C /
rm -rf /install/

BEWARE THIS WORKS FINE ON XENIAL BUT SINCE FOCAL, /SBIN BECAME A SYMLINK

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

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 https://pub.nethence.com/bin/slack/slackstrap.bash.txt
cp slackstrap.bash.txt slackstrap.bash
chmod +x slackstrap.bash
./slackstrap.bash lala/ $mirror
#./slackstrap.bash lala/ $mirror full

clean-up

rm -rf lala/installpkg-*/

Note

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

and there’s also this one

mlocate-0.26-x86_64-2: locate/updatedb implementation .                                             [580K]
chown: invalid group: 'root:slocate'

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'

Finish-up

ls -lF lala/etc/fstab # no exist
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/
touch lala/data/NOT_MOUNTED

Fix the timezone,

ls -lF lala/etc/localtime-copied-from lala/etc/localtime
rm -f lala/etc/localtime-copied-from

ln -s ../usr/share/zoneinfo/Europe/Moscow lala/etc/localtime
ln -s ../usr/share/zoneinfo/Europe/Paris lala/etc/localtime

Setup the boot loader,

ls -lF lala/etc/lilo.conf # no exist
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 = "mitigations=off"
        read-only
    #vt.default_utf8=0
    #ipv6.disable=1

chroot lala/ ldconfig
chroot lala/ lilo

# LANGUAGE = (unset)
# LC_ALL = (unset),
chroot lala/ update-ca-certificates

#depmod ...

brutal network setup – you can get the script from there

    ../slackbrutal.bash x.x.x.9/24 x.x.x.254 $guest

and finally

sync
umount -R lala/

switch back to NORMAL mode and back to your workstation, restore known hosts

vi ~/.ssh/known_hosts

you can now connect remotely and proceed with post-installation

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


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun