VectorLinux

The nuts and bolts => Networking & Security => Topic started by: wolfvec on February 23, 2019, 02:41:03 pm

Title: Booting VL 7.2 via PXE from a Server on a Client
Post by: wolfvec on February 23, 2019, 02:41:03 pm
Hello everybody,

first of all, sorry for my bad English. Hope this is the right place for this post.

Since quite a long time I try to boot VL-7.2-STD-FINAL from my server via PXE on one of my clients. But ... it didn't work (see later below)

I read some posts in the forum but I could not find the one that fits or I missed it.

First I wanted to mention the points I did to get this thing go work.
The "XXX" in this post are for privacy.

01. SERVER: created a partition for vectorlinux.

02. SERVER: formatted the partition with ext4

03. SERVER: installed vectorLinux in this partition from VL-7.2-STD-FINAL.iso

04. SERVER: this partition was mounted after "/srv/vector" and entered in the "/etc/fstab" to load it at boot time as root.

05. SERVER: editing the file "/etc/exports" to retrieve the corresponding partition as root.
The line for vectorLinux:
/srv/vector      *(rw,no_root_squash,no_subtree_check,sync)

06. SERVER: read the new configuration with the command "exportfs -arv" as root.

07. SERVER: The command "showmount -e" produced the following output:
Export list for 192.XXX.XXX.XXX:
/srv/vector      *

08.SERVER: mount the partition "/srv/vector/" from the server too for review.
Output: 192.XXX.XXX.XXX:/srv/vector on /mnt/testmount type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.XXX.XXX.XXX,local_lock=none,addr=192.XXX.XXX.XXX) => WORKED

09. other CLIENT: mount the partition "/srv/vector/" from another computer for review.
Output: 192.XXX.XXX.XXX:/srv/vector on /mnt/smbnet type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.XXX.XXX.XXX,local_lock=none,addr=192.XXX.XXX.XXX) => WORKED

10. SERVER: Now I adapted the "initrd.gz" with the command "mkinitrd" accordingly.
mkinitrd     -c                          \ to clear the existing initrd tree
       -f nfs                       \ specify the filesystem to use for the root partition here: nfs (or is the spelling wrong? nfs3? nfs4? nfsv3? nfsv4?)
       -r 192.XXX.XXX.XXX:/srv/vector     \ specify the device to be used as the root partition (or is the spelling wrong? no other idea)
       -l de                       \ load an alternative keyboard mapping here: de
       -m ext3:ext4:nfsv3:nfsv4:nfs        \ loads the desired kernel modules (or is the spelling wrong? see above nfs3? nfs4?)
       -k 4.4.76              \ use kernel modules from the specified kernel
       -u                          \ include udev in the initrd
       -w 8                       \ how long to wait in seconds assuming that all the drives are spun up here: 8 seconds
       -L                          \ this option adds LVM support to the initrd (because on the client are hard drives with an LVM on them but I got an error. Something not avalible.)
       -o /boot/initrd-custom-nfs.gz        \ the file to write the initrd to. here: the given name because I wanted to keep the existing initrd.gz

11. SERVER: I created the "new" initrd.gz with
mkinitrd -c -f nfs -r 192.XXX.XXX.XXX:/srv/vector -l de -m ext3:ext4:nfsv3:nfsv4:nfs -k 4.4.76 -u -w 8 -L -o /boot/initrd-custom-nfs.gz.
I did this in chroot environment.

For the next steps I left the chroot environment.

12. SERVER: here I use "advanced TFTP" (atftp). In the directory "/srv/atftp" are the kernels und initrd.gz files.
I put a symbolic link from "..vector/boot/vmlinuz" to "/srv/atftp/vmlinuz",
a symbolic link from "..vector/boot/initrd-custom-nfs.gz" to "/srv/atftp/initrd_i686.gz",
a symbolic link from "../vector/boot/System.map" to "/srv/atftp/System.map",
a symbolic link from "../vector/boot/config" to "/srv/atftp/config".

In der directory "/srv/atftp" it should look like this:
lrwxrwxrwx 1 root root     21 28. Jan 01:20 config -> ../vector/boot/config
lrwxrwxrwx 1 root root     24 10. Feb 17:22 initrd_i686.gz -> ../vector/boot/initrd-custom-nfs.gz
-rw-r--r-- 1 root root 116524  2. Sep 2015  ldlinux.c32
-rw-r--r-- 1 root root  24072  8. Sep 2015  libmenu.c32
-rw-r--r-- 1 root root  23492  8. Sep 2015  libutil.c32
-rw-r--r-- 1 root root  25672  7. Sep 2015  menu.c32
-rw-r--r-- 1 root root  42975  2. Sep 2015  pxelinux.0
drwxr-xr-x 2 root root   4096 30. Okt 2015  pxelinux.cfg
lrwxrwxrwx 1 root root     25 28. Jan 01:19 System.map -> ../vector/boot/System.map
-rw-r--r-- 1 root root  26196  7. Sep 2015  vesamenu.c32
lrwxrwxrwx 1 root root     22 23. Jan 00:38 vmlinuz -> ../vector/boot/vmlinuz

13 SERVER: After this I edited the file "default" in "/srv/atftp/pxelinux.cfg/"

Here is the entry in question:
LABEL Vector Linux i686
   MENU LABEL Vector Linux V 7.2 i686
   KERNEL vmlinuz
   APPEND boot=nfs initrd=initrd_i686.gz quiet ip=:::::eth1:dhcp irqpoll nfsroot=192.XXX.XXX.XXX:/srv/vector rw

And "eth1" because the client has an additional network card.
After the changes to the file "default" the command "syslinux-install_update -u" was executed as root to update the bootloader.

14. SERVER: Then I edited the "/etc/fstab" file for the CLIENT:
# /etc/fstab: static file system information
#
# fstab generated by vinstall
#
# <file system>   <dir>   <type>   <options>         <dump>   <pass>
proc      /proc      proc   defaults         0      0
none      /dev/pts   devpts   gid=5,mode=666      0      0
sysfs      /sys      sysfs   defaults         0      0
/dev/nfs   /      nfs   defaults         1      1
cgroup      /cgroup/cpuset   cgroup   rw,relatime,cpuset      0      0
cgroup       /cgroup/cpu      cgroup   rw,relatime,cpu   0      0
cgroup      /cgroup/cpuacct   cgroup   rw,relatime,cpuacct   0      0
cgroup      /cgroup/memory   cgroup   rw,relatime,memory   0      0
cgroup      /cgroup/devices   cgroup   rw,relatime,devices   0      0
cgroup      /cgroup/freezer   cgroup   rw,relatime,freezer   0      0
cgroup      /cgroup/net_cls   cgroup   rw,relatime,net_cls   0      0
cgroup      /cgroup/blkio      cgroup   rw,relatime,blkio   0      0

15. SERVER: At last here I edited the file "/etc/rc.d/rc.inet1.conf" in chroot environment to turn OFF dhcp on the CLIENT because some were I wrote that it is not a good idea in the boot process when the CLIENT calls for an IP because the CLIENT got already one from the server. So I changed the lines
# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

to

# Config information for eth1:
IPADDR[1]="192.XXX.XXX.XXX"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

and

# Default gateway IP address:
GATEWAY=""

to

# Default gateway IP address:
GATEWAY="192.XXX.XXX.XXX"
So the client has later a static IP address.

After that I left the chroot environment.
Now I hope I have nothing forgotten and to mention.
The configuration of the server should now be completed.


The steps on the client are quickly told

01. CLIENT: Turn on the computer.

02. CLIENT: Change into the BIOS settings by striking the "Del"-key or "F2"-key or others. Look into the documentation of your computer or research in advance on the Internet on this topic. Mostly the desired setting is under the menu item "boot". Please change the boot order so that you can find an entry like "booting over nic" or similar in the first place. In some cases, the name of the chipset of the network device is called on the motherboard. When done, please exit the BIOS setting and select "Exit and Save". In many cases, the computer then restarts otherwise turn off and then on again.

03. CLIENT: The computer first looks for a DHCP server and later adopts that HIS network interface was configured by the server. Next you should see a boot menu in which you select the appropriate entry for your client. ... and that's it.

Only I would never have written this forum entry, since others have written similar, if everything went as smooth as described. Because unfortunately I get these error messages on my CLIENT:

/boot/initrd-custom-nfs.gz: Loading kernel modules form initrd image:
/boot/initrd-custom-nfs.gz: Loading 'de' keyboard mapping:
mount: RPC: Remote system error - Network is unreachable
mount: mounting 192.XXX.XXX.XXX:/srv/vector on /mnt failed: Bad file descriptor
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead.
      You can try to fix it. Type 'exit' when things are done.

/bin/sh: can't access tty: job control turned off

Unfortunately, the console does not work so I have no way to repair anything.
Although I press keys on the keyboard, no letters appear on the screen.

I hope someone can help me in this case.
If all the bugs have been eliminated, it could definitely be a HOWTO or maybe my project is not feasible?

Hope for the next time I can use (code - /code). When I used (code - /code) I got the message: "Sorry, you are not allowed to post external links." I know I had to use this brackets [] but then -> not allowed!

Best regards,
wolfvec