Benutzer:Peter Littmann/Installation Debian Stretch von Kimsufi Rescue (Oktober 2019)

Vorbereitung der InstallationspartitionenBearbeiten

Bei dem am 31.10.2019 verwendeten Rescue-System handelt es sich um Debian 8 "Jessie".

# Set the language environment
export LANGUAGE=C;export LC_ALL=C;export LANG=C

# Booting the rescue systems gives you a complete linux system that is running on your server without using your harddisk.

# First get the network data of your server: ifconfig and save network data like IP, gateway, mac, etc.
root@rescue:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:22:4d:84:8e:35  
          inet addr:5.39.80.228  Bcast:5.39.80.255  Mask:255.255.255.0
          inet6 addr: fe80::222:4dff:fe84:8e35/64 Scope:Link
          inet6 addr: 2001:41d0:8:92e4::1/128 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:59053 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29268 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:55407592 (52.8 MiB)  TX bytes:4654492 (4.4 MiB)
          Interrupt:16 Memory:d0400000-d0420000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@rescue:~# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         5.39.80.254     0.0.0.0         UG        0 0          0 eth0
5.39.80.0       0.0.0.0         255.255.255.0   U         0 0          0 eth0



[    5.551988] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    5.552065] 8021q: adding VLAN 0 to HW filter on device eth0
[    7.489334] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None
[    7.489541] e1000e 0000:01:00.0 eth0: 10/100 speed: disabling TSO
[    7.489865] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

# Second step is to get rid of the network drives, because they are read-only
root@rescue:~# top
KiB Mem:   4005448 total,   277324 used,  3728124 free,    68528 buffers
KiB Swap:        0 total,        0 used,        0 free.    64952 cached Mem

swapon /dev/sdb4    # use your own swap on the intact disk

KiB Mem:   4005448 total,   283656 used,  3721792 free,    68532 buffers
KiB Swap:  8387580 total,        0 used,  8387580 free.    65144 cached Mem

root@rescue:~# mdadm /dev/md2 --fail /dev/sda3 --remove /dev/sda3
mdadm: set /dev/sda3 faulty in /dev/md3
mdadm: hot removed /dev/sda3 from /dev/md3
root@rescue:~# mdadm /dev/md2 --fail /dev/sda2 --remove /dev/sda2
mdadm: set /dev/sda2 faulty in /dev/md2
mdadm: hot removed /dev/sda2 from /dev/md2
root@rescue:/mnt# mdadm /dev/md1 --fail /dev/sda1 --remove /dev/sda1
mdadm: set /dev/sda1 faulty in /dev/md1
mdadm: hot removed /dev/sda1 from /dev/md1

root@rescue:~# cd /mnt
root@rescue:/mnt# mkdir md2
root@rescue:/mnt# ls -al
total 0
drwxr-xr-x  4 root root  80 Oct 31 02:54 .
drwxr-xr-x 35 root root 360 Oct 31 02:54 ..
drwxr-xr-x  2 root root  40 Oct 31 02:54 md2

mount /dev/md2 /mnt/md2
mount /dev/md3 /mnt/md2/var/
mount /dev/md1 /mnt/md2/boot/

root@rescue:/mnt# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************

Disk /dev/sda: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 147A7BF1-16D4-4C97-92D9-A779F56C5533
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 14445 sectors (7.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            4096         1050623   511.0 MiB   FD00  Linux RAID
   2         1050624       410648575   195.3 GiB   FD00  Linux RAID
   3       410648576      3890243583   1.6 TiB     FD00  Linux RAID
   4      3890243584      3907018751   8.0 GiB     8200  Linux swap

root@rescue:/mnt# sgdisk -Z /dev/sda
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

root@rescue:/mnt# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Nachdem die verschiedenen Partitionen angelegt wurden ist die Platte so partitioniert:

root@rescue:/mnt# sgdisk -p /dev/sda
Disk /dev/sda: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 932BDC61-6EA9-474E-9579-1A3834803FA1
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
        
Number  Start (sector)    End (sector)  Size       Code  Name                    | Vorgesehener Mountpoint | md
   1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
   2            4096          516095   250.0 MiB   FD00  Linux RAID                /boot                     md12
   3          516096       419946495   200.0 GiB   FD00  Linux RAID                /home                     md13
   4       419946496       430432255   5.0 GiB     FD00  Linux RAID                /var                      md14 
   5       430432256       438820863   4.0 GiB     FD00  Linux RAID                /tmp                      md15
   6       438820864       447209471   4.0 GiB     FD00  Linux RAID                                          md16
   7       447209472      3907029134   1.6 TiB     FD00  Linux RAID                /                         md17

root@rescue:/mnt# mdadm --zero-superblock /dev/sda2
mdadm: Unrecognised md component device - /dev/sda2
root@rescue:/mnt# mdadm --zero-superblock /dev/sda3
mdadm: Unrecognised md component device - /dev/sda3
root@rescue:/mnt# mdadm --zero-superblock /dev/sda4
mdadm: Unrecognised md component device - /dev/sda4
root@rescue:/mnt# mdadm --zero-superblock /dev/sda5
mdadm: Unrecognised md component device - /dev/sda5
root@rescue:/mnt# mdadm --zero-superblock /dev/sda7
mdadm: Unrecognised md component device - /dev/sda7

Die Fehlermeldung ist an dieser Stelle völlig normal.

mdadm --create /dev/md12 --bitmap=internal --level=1 --metadata=0.90 --raid-disks=2 /dev/sda2 missing

root@rescue:~# mdadm --create /dev/md13 --bitmap=internal --level=1 --raid-disks=2 /dev/sda3 missing
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md13 started.

So weiter mit den Partitionen bis 7.

Das Ergebnis lässt man sich zur Kontrolle anzeigen:

root@rescue:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] 
md17 : active raid1 sda7[0]
      1729778752 blocks super 1.2 [2/1] [U_]
      bitmap: 0/13 pages [0KB], 65536KB chunk

md16 : active raid1 sda6[0]
      4190208 blocks super 1.2 [2/1] [U_]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md15 : active raid1 sda5[0]
      4190208 blocks super 1.2 [2/1] [U_]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md14 : active raid1 sda4[0]
      5238784 blocks super 1.2 [2/1] [U_]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md13 : active raid1 sda3[0]
      209584128 blocks super 1.2 [2/1] [U_]
      bitmap: 0/2 pages [0KB], 65536KB chunk

md12 : active raid1 sda2[0]
      255936 blocks [2/1] [U_]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md1 : active raid1 sdb1[1]
      523200 blocks [2/1] [_U]
      
md2 : active raid1 sdb2[1]
      204798912 blocks [2/1] [_U]
      bitmap: 2/2 pages [8KB], 65536KB chunk

md3 : active raid1 sdb3[1]
      1739797440 blocks [2/1] [_U]
      bitmap: 7/13 pages [28KB], 65536KB chunk

unused devices: <none>

Anlegen des DateisystemsBearbeiten

mkfs.ext4 /dev/md12
...
mkswap /dev/md16

Filesystemcheck abschaltenBearbeiten

nano /etc/init.d/checkfs.sh
von:         fscheck="yes"
auf: fscheck="no"

Einbinden der RAID-FestplatteBearbeiten

cd /mnt
mkdir ziel
root@rescue:/mnt# mount -t ext4 /dev/md17 /mnt/ziel
root@rescue:/mnt# mkdir -p ziel/boot
root@rescue:/mnt# mount -t ext4 /dev/md12 /mnt/ziel/boot
root@rescue:/mnt# mkdir -p ziel/home
root@rescue:/mnt# mount -t ext4 /dev/md13 /mnt/ziel/home
root@rescue:/mnt# mkdir -p ziel/var
root@rescue:/mnt# mount -t ext4 /dev/md14 /mnt/ziel/var
root@rescue:/mnt# mkdir -p ziel/tmp
root@rescue:/mnt# mount -t ext4 /dev/md15 /mnt/ziel/tmp
<pre>

== Installation von Debian ==
mkdir debinst
apt-get install debootstrap
/usr/sbin/debootstrap --arch amd64 stretch /mnt/debinst http://ftp.be.debian.org/debian




mount ergibt dann nach dem mounten folgendes:
/dev/md1 on /mnt/md2/boot type ext4 (rw,relatime)
/dev/md123 on /mnt/target type ext4 (rw,relatime)
/dev/md124 on /mnt/target/tmp type ext4 (rw,relatime)
/dev/md125 on /mnt/target/var type ext4 (rw,relatime)
/dev/md126 on /mnt/target/home type ext4 (rw,relatime)
/dev/md127 on /mnt/target/boot type ext4 (rw,relatime)

Der debootstrap-VorgangBearbeiten

root@rescue:/mnt# apt-get install debootstrap
debootstrap --arch=amd64 stretch /target http://ftp.fr.debian.org/debian/

Am Ende muss die Meldung erscheinen:

I: Base system installed successfully.

Das neue System einrichtenBearbeiten

mount -o bind /proc /target/proc
mount -o bind /dev /target/dev
mount -o bind /dev/pts /target/dev/pts
mount -o bind /sys /target/sys
chroot /target bash
ls -al /etc/apt

zeigt die Struktur wie bei Debian an

cat /etc/apt/sources.list

zeigt deb http://ftp.fr.debian.org/debian stretch main

da fehlen also contrib und non-free, ich ergänze diese um später keine Einschränkungen zu haben, mit nano

apt-get update
apt-get install console-data console-common tzdata locales keyboard-configuration

nun kommt das Menü Configuring console-data

dpkg-reconfigure locales
apt-get install linux-image-amd64 intel-microcode

Hierbei kamen Meldungen: Possible missing Firmware

apt-get install firmware-misc-nonfree firmware-netxen firmware-realtek

hat mich dann von diesen befreit

dpkg-reconfigure tzdata console-data console-common keyboard-configuration
apt-get install man lm-sensors inxi mdadm ssh
passwd

man war nicht installiert