Showing posts with label Boot. Show all posts
Showing posts with label Boot. Show all posts

Friday, March 20, 2026

Setting up tftp-hpa on FreeBSD, 5 URLs to read

 Setting up tftp-hpa on FreeBSD,  5 urls to read


https://wiki.freebsd.org/PXE%3ATFTPd%20Setup 

https://eradman.com/posts/automated-freebsd-install.html 

 https://www.siberoloji.com/how-to-set-up-a-tftp-server-on-freebsd-operating-system/

https://www.siberoloji.com/how-to-implement-diskless-booting-on-freebsd-operating-system/ 

https://blog.prag.dev/using-freebsds-sysrc-and-serving-tftp-resources 

https://man.freebsd.org/cgi/man.cgi?query=tftpd&sektion=8&format=html   tftpd manual page

https://github.com/WillChamness/Dnsmasq-PXE   Setup DNSmasq for Ubuntu ; reference

iPXE boot for FreeBSD with an UEFI BIOS

https://www.tunbury.org/2025/05/06/freebsd-uefi/  tftp with freebsd uefi  /boot/loader.efi  file

 root@flf_FBSD_15_STABLE:~ # whereis tftpd
tftpd: /usr/libexec/tftpd /usr/share/man/man8/tftpd.8.gz /usr/src/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # ls -l /usr/libexec/tf*
-r-xr-xr-x  1 root wheel 101552 Mar 17 18:41 /usr/libexec/tftp-proxy
-r-xr-xr-x  1 root wheel  39168 Mar 14 23:58 /usr/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # ls -ld /usr/libexec/tf*
-r-xr-xr-x  1 root wheel 101552 Mar 17 18:41 /usr/libexec/tftp-proxy
-r-xr-xr-x  1 root wheel  39168 Mar 14 23:58 /usr/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # tftpd
sh: tftpd: not found
root@flf_FBSD_15_STABLE:~ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
root@flf_FBSD_15_STABLE:~ # PATH=$PATH:/usr/libexec
root@flf_FBSD_15_STABLE:~ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:/usr/libexec

sudo service inetd start
sudo service inetd status
root@flf_FBSD_15_STABLE:~ # sudo service inetd start
Starting inetd.
root@flf_FBSD_15_STABLE:~ # sudo service inetd status
inetd is running as pid 74882.
root@flf_FBSD_15_STABLE:~ # 
 
#search for inetd pid 74882 using grep
root@flf_FBSD_15_STABLE:~ # ps aux | grep 74882
root 74882 0.0 0.0 14360 2836 - Is 00:58 0:00.00 /usr/sbin/inetd -wW -C 60
root 75590 0.0 0.0 14176 2676 2 S+ 01:03 0:00.00 grep 74882


root@flf_FBSD_15_STABLE:~ # ls -la /tftpboot
total 9
drwxrwxrwx 2 root wheel 2 Mar 20 00:16 .
drwxr-xr-x 21 root wheel 24 Mar 20 00:16 ..
root@flf_FBSD_15_STABLE:~ # echo "This is a test file." > /tftpboot/testfile.txt
root@flf_FBSD_15_STABLE:~ #
root@flf_FBSD_15_STABLE:~ # ls -la /tftpboot
total 10
drwxrwxrwx 2 root wheel 3 Mar 20 01:07 .
drwxr-xr-x 21 root wheel 24 Mar 20 00:16 ..
-rw-r--r-- 1 root wheel 21 Mar 20 01:07 testfile.txt
root@flf_FBSD_15_STABLE:~ #  
sudo ipfw add allow udp from any to any 69
root@flf_FBSD_15_STABLE:~ # sudo ipfw add allow udp from any to any 69
ipfw: getsockopt(IP_FW_XADD): Protocol not available
root@flf_FBSD_15_STABLE:~ # 

 

Friday, March 14, 2025

Ntpd Network Time Protocol Dameon setup in GhostBSD 25 install

Ntpd  Network Time Protocol Dameon setup in GhostBSD 25 install

 Kuntal S Kundu 🐧, [3/14/25 10:34 PM]

ntpd service was not enabled on start up, and the timezone (idk) was set to utc! (I selected India during installation!. and after log in into system it was showing correct time too!) so I first enabled ntpd, then run sudo tzsetup and set India from UTC. rebooted and boom
Solution?   ntpd was "yes" in rc.conf but not enabled

 FreeBSD Handbook

32.12.1.2. NTP entries in /etc/rc.conf

 

32.12.1.2. NTP entries in /etc/rc.conf

Set ntpd_enable=YES to start ntpd at boot time. Once ntpd_enable=YES has been added to /etc/rc.conf, ntpd can be started immediately without rebooting the system by typing:

# service ntpd start

Only ntpd_enable must be set to use ntpd. The rc.conf variables listed below may also be set as needed.

Set ntpd_sync_on_start=YES to allow ntpd to step the clock any amount, one time at startup. Normally ntpd will log an error message and exit if the clock is off by more than 1000 seconds. This option is especially useful on systems without a battery-backed realtime clock.

 

Reasons to try and test drive GhostBSD from a USB flash drive stick

Kuntal S Kundu 🐧, [3/14/25 10:34 PM]
ntpd service was not enabled on start up, and the timezone (idk) was set to utc! (I selected India during installation!. and after log in into system it was showing correct time too!) so I first enabled ntpd, then run sudo tzsetup and set India from UTC. rebooted and boom

Kuntal S Kundu 🐧, [3/14/25 10:34 PM]
ntpd was "yes" in rc.conf but not enabled

Kuntal S Kundu 🐧, [3/14/25 10:43 PM]
yesterday I had installed the ghostbsd, but lots of issues like tzsetup, screen tearing, appimage incompatibility made me to take decision of wiping out it and reinstall debian. But later I think again about ghostbsd, and I decided to take the challenge, so I installed it again today
 
Challenge Test Drive GhostBSD  25p2   ghostbsd.org/download 
 

manually  run update clock on system without a realtime clock like the raspberry Pi

NTPD,  NTPDATE   ntpd -q -g       or How to update, when clock is years off kilter, time? 

service ntpd start   #  another method from command line to start ntpd daemon 




 
 Setup NTPD  daemon for GhostBSD in  /etc/rc.conf file
 

Thursday, January 5, 2023

Trouble shooting FreeBSD Installation problems

wb7odyfred@yahoo.com
Write a blog post about troubleshooting FreeBSD installation

Introduction:

FreeBSD is a powerful and reliable operating system that is widely used in servers and other critical systems. However, like any other software, it can sometimes be prone to issues during installation. In this blog post, we will discuss some common problems that you might encounter while installing FreeBSD and how to troubleshoot them.

Problem 1: Boot error

One of the most common problems that users face while installing FreeBSD is a boot error. This can be caused by a number of reasons, including a faulty installation media, a hardware issue, or a misconfigured BIOS.

To troubleshoot this problem, the first thing you should do is to check the integrity of the installation media. You can do this by running the "md5" command on the installation ISO file and comparing the output with the official checksum. If the checksum does not match, it means that the installation media is corrupt and you need to download a new ISO file.

If the checksum matches and you are still facing a boot error, it could be due to a hardware issue or a misconfigured BIOS. In this case, you should try booting from the installation media using a different computer or on a different hardware platform. If the problem persists, it could be due to a misconfigured BIOS, in which case you should try resetting the BIOS to its default settings.

Problem 2: Kernel panic

Another common problem that you might encounter during the installation of FreeBSD is a kernel panic. This can be caused by a number of reasons, including a faulty hardware component or a problem with the installation media.

To troubleshoot this problem, you should first try booting the installation media on a different computer or on a different hardware platform. If the problem persists, it could be due to a faulty hardware component, in which case you should try replacing the suspect component.

If the problem is not caused by hardware, it could be due to a problem with the installation media. In this case, you should try downloading a new ISO file and creating a new installation media.

Problem 3: "No bootable device" error

If you see the "No bootable device" error while trying to install FreeBSD, it could be due to a misconfigured BIOS or a problem with the installation media.

 


Introduction:

FreeBSD is a powerful and reliable operating system that is widely used in servers and other critical systems. However, like any other software, it can sometimes be prone to issues during installation. In this blog post, we will discuss some common problems that you might encounter while installing FreeBSD and how to troubleshoot them.

Problem 1: Boot error

One of the most common problems that users face while installing FreeBSD is a boot error. This can be caused by a number of reasons, including a faulty installation media, a hardware issue, or a misconfigured BIOS.

To troubleshoot this problem, the first thing you should do is to check the integrity of the installation media. You can do this by running the "md5" command on the installation ISO file and comparing the output with the official checksum. If the checksum does not match, it means that the installation media is corrupt and you need to download a new ISO file.

If the checksum matches and you are still facing a boot error, it could be due to a hardware issue or a misconfigured BIOS. In this case, you should try booting from the installation media using a different computer or on a different hardware platform. If the problem persists, it could be due to a misconfigured BIOS, in which case you should try resetting the BIOS to its default settings.

Problem 2: Kernel panic

Another common problem that you might encounter during the installation of FreeBSD is a kernel panic. This can be caused by a number of reasons, including a faulty hardware component or a problem with the installation media.

To troubleshoot this problem, you should first try booting the installation media on a different computer or on a different hardware platform. If the problem persists, it could be due to a faulty hardware component, in which case you should try replacing the suspect component.

If the problem is not caused by hardware, it could be due to a problem with the installation media. In this case, you should try downloading a new ISO file and creating a new installation media.

Problem 3: "No bootable device" error

If you see the "No bootable device" error while trying to install FreeBSD, it could be due to a misconfigured BIOS or a problem with the installation media.

To troubleshoot this problem, you should first check the BIOS settings and make sure that the boot order is correctly configured. The installation media should be set as the first boot device.

If the boot order is correctly configured and you are still facing the "No bootable device" error, it could be due to a problem with the installation media. In this case, you should try creating a new installation media using a different USB drive or DVD.

Conclusion:

Installing FreeBSD can sometimes be challenging, especially if you encounter problems during the process. However, by following the troubleshooting steps discussed in this blog post, you should be able to resolve most issues and successfully install the operating system.




Tuesday, December 29, 2020

Building "Linux From Scratch" and "JHALFS" Written by Thomas Seeling, February 2018

 Original from German blog:

Linux From Scratch blogspot German Lanuage post

 

 

I build a Linux as I like it - 1

For many years I have been an enthusiastic user of a very special Linux variant called " Linux from scratch ".

As the name suggests, a Linux system is built from scratch from scratch. The source texts are used to translate all the packages yourself and to equip a PC (or another computer system) with a Linux that can be started from the hard drive.

Of course, you have a chicken and egg problem: you need a Linux to build the new Linux. There are several possible solutions to this problem: On the one hand, the LFS can be assembled in a virtual machine. Alternatively, you can first set up a small partition with a different Linux on the target computer, start from there and then throw the LFS onto the free space on the hard drive. The Linux for building can then be kept as an emergency system afterwards, or the partition can be made into a swap partition or used for other purposes. For the very first ("bootstrap") Linux, a mini-partition of 8-16 GB is sufficient, and you can then install a Linux Mint or Fedora there, for example.

"Linux from Scratch" is not only a tutorial for a Linux to build yourself, but is mainly intended to gain experience in building Linux programs from the source code.

You learn a lot, namely the relationships between the various programs, configuration files, but also a lot about networks, and above all, of course, about the technical requirements, including the use of makefiles, and you learn to read log files to resolve problems to eliminate.

At "LFS" there are various ways to improve how you can make life difficult and exciting for yourself. You can build the basic system , then you "only" have a Linux command line.

Beyond Linux from scratch "(BLFS) it is possible to build a server with which you can, for example, build a firewall, a NAS, a web server, or much more. Or you build a desktop system with a graphical user interface, and at the end Then the self-compiled Firefox is displayed. Doesn't that sound cool?

One level of difficulty above is the automation of the construction process - and this is mainly what I want to write here. The instructions from "LFS" for a base system and for the "BLFS" are pretty good. If you stick to it, you have a good chance of manually creating a working system step by step. You go through all the chapters one after the other on the browser and carry out the individual steps according to the instructions. To be honest, that's a hassle the first time - I speak from experience ;-). On the other hand, it is exciting to see how the Linux system grows with every step and actually looks more and more like what you know as a Linux user.

The automation " Automated Linux from scratch " (ALFS), however, is in a README- The file is only sparsely described. Once you have internalized the system, you have a wonderful and very esoteric possibility to install updates or to completely regenerate the entire system at the push of a button.

In this way I built a Linux overnight - or better said: had it built that would be protected against Specter and Meltdown with the latest kernel 4.15 and C compiler gcc 7.3 . - If, yes, if my craft system would have been a 64-bit system (x86_64) and not 32-bit (i686). And if I had the feeling that I was really threatened by these vulnerabilities. But I think I have to write my own article on the subject of risk analysis.

And one step above you do not use the "stable" version of the books, but the LFS and BLFS books that are currently in development. The authors of the chapters are constantly busy integrating new versions of the packages and adapting the articles. If, for example, the procedure for a package changes how the package is compiled in an executable manner, this will be adopted extremely quickly in the "development" version of LFS or BLFS. This is exactly what happened to me while writing this article: I started the Makefile , and in the middle of it, the book switched to ncurses 6.1. As soon as I was finished, the developers released the new glibc version 2.27. This is how it works ...

To come back to "Meltdown" and "Specter" again: the LFS book recently started to contain brand new kernel and gcc versions that are supposed to fix these security holes. This is of course always "work in progress". The current status is that Specter V2 and Meltdown are fixed, and there is still some development work to be done for Specter V1. The old 32-bit processors are unfortunately lagging behind, for 64-bit (i.e. everything that is roughly less than 10 years old) all fixes should definitely be in progress.

So now, as promised, a more detailed description of the automation for LFS (ALFS). To do this, first download the current package . For historical reasons, the package name is " jhalfs "and honors the first developer of the process with his initials" jh ". 
 
In order for jhalfs to work, a few additional Linux packages must be installed on the guest system, because they are normally not required for end users the C compiler gcc and some auxiliary programs and libraries like bison , awk , ncurses etc. The nice thing is: when you start jhalfs, it checks what is still missing and complains, "Install Subversion to download the latest files from the version control system."

The automation actually starts with the very first steps that one would carry out according to the LFS book: creating a new Unix user "lfs" for compiling the packages, creating directories, etc. The only step that you have to carry out yourself is creating a hard drive partition and then mounting it so that the scripts can find it. Traditionally this is / mnt / lfs , but you can change it if you know what you are doing.

First a few words about the design of jhalfs: the authors create LFS and the other books in a special XML format called " DocBook "; turn it into tricky XSLT-Transformations then readable books into HTML, PDF or even TeX. jhalfs also uses XSLT transformations to filter out the command line instructions from the book and uses them to create a Makefile and installation scripts for each chapter, ie each package to be installed. Automation with ALFS is a two-step process: first, the commands for building are filtered out of the book and converted into a makefile with auxiliary scripts, and in a second step this list of commands is executed.

The authors also provide a complete list of the software packages with version numbers that you can either download yourself or that can be retrieved automatically if you have a reasonably fast internet connection. Roughly estimated, you have to download around 400 MB of packages for LFS and up to 2 GB for BLFS, depending on the size.

The packages should be stored in a directory / mnt / lfs / sources below the future LFS partition so that all packages can be found during the process. To do this, a Unix technique called "chroot" (change root) is used to simulate a running program with a different hard drive structure - effectively, this is used to pretend that it is already running in the "real" LFS environment.

The Makefile for LFS is created in a new subdirectory, into which you have to change after a few basic assumptions have been made. Just like / sources , this directory should be on the future LFS partition so that all scripts can also be accessed in the "chroot" environment. If you now start " make " there , after a few hours (depending on the speed of the computer *) you should have an almost bootable Linux on the new partition. Steps that can be automated, but not mandatory, are compiling a kernel and specifying the partitions to be mounted on startup.

*)As a rough guide, two comparative figures that I measured with the current LFS version. The package that takes by far the longest is the final step in compiling the C compiler. This takes 540 minutes on an old Pentium 4, and just under 230 minutes on a more recent i5-3350. An SSD instead of a hard drive is a great help in saving time.

The first step after unpacking the jhalfs package is to change to the directory and enter "make" there. If you have ever compiled a kernel yourself, you will immediately experience an aha effect: the configuration uses the same text interface for menu selection as the kernel for "make menuconfig". Here you can choose LFS / BLFS, "stable" or "development", whether the kernel should also be compiled automatically and a lot more. The basic settings are not that bad, and you should only change what you understand ;-)

After "exit" from this ALFS menu, the question arises whether you are satisfied with the configuration. If "yes", the already mentioned checks are carried out to determine whether all developer packages are available on the guest Linux and meet certain minimum requirements, such as gcc at least in version 4.6 (because earlier versions contain errors, so that the LFS would not work or packages are not compiled correctly, etc.). If all of this has been checked successfully, change to the new directory (as a user, not as root) and start " make " again there .

Cool socks take a look at the files below chapter04  05  in the subdirectory lfs-commands.  First start with the editor before you start make . With the files for chapter 7, in particular, you could directly get the idea of ​​editing the passages marked with ** EDITME ** ;-)

At the same time, it is advisable to open the same version of the book in a browser and to read the chapters that the automatism is currently trying to build. In the event of problems, you can read what is happening in the respective chapter.

It will probably not work completely successfully the first time; But that's not bad: if an error is reported, you can look at the log file for this step from the logs subdirectory , correct the error and then simply go back to it "make ". The make program is so clever that it continues at the same point. Some packages are built multiple times, for example the C compiler and some auxiliary programs. The purpose of this is to avoid accidentally building dependencies on the guest system If an important program were linked to the guest system's C library, it would no longer work after booting, so an "intermediate system" is built in a different path ( / tools ), which can then compile the final LFS.

A few general tips if the compilation of a package fails: gcc 7.3 is "bleeding edge", so brand new that you can cut your fingers when you use it ;-). I mean to say that there are so many changes in it, for example adjustments to the current C and C ++ standards, which have not yet reached most packages and the brains of developers. But: you want to use  gcc 7.3 and current binutils, because this is where the repair work for Meltdown and Specter takes place. Nevertheless the recommendation again: first build a "stable" LFS and then switch to "development" as an increase.

Typical compilation problem:
  • a C program uses data types that are now declared in a newly introduced include file <stdint.h> and no longer in <stdlib.h> . For the time being, you have to put the additional include command somewhere before the program can be compiled successfully. Make kindly tells you exactly where a problem has occurred.
  • when correcting a problem, files or directories were edited or edited as root. This leads to a subsequent error, because LFS wants to do everything with the user " lfs " and then it can be aborted due to authorization problems (I can do it all the time ).
    chown lfs: lfs is your friend.
What else I came across:
  • the internal gcc macro __sigemptyset no longer exists. You can use sigemptyset (without the underscores) instead.
  • the macros major and minor for Devices are now in <sys / sysmacros.h> to find .
  • grub cannot be compiled with binutils 2.30 on 32-bit systems. In addition to the configure switches in the LFS book , you have to specify the switch " --enable-64-bit-bfd ". Alternatively, use binutils 2.29.1 instead of 2.30 .
Two steps are described somewhat vaguely in the LFS book because they depend very much on your own PC: the configuration of the kernel and the bootable hard disk. If you have a Linux guest system with "kernelconfig" support, you can build your own tailor-made kernel with " make oldconfig ", which then uses exactly the settings that are current at the moment.

The only important point is that the file system format of the boot drive should be compiled in the kernel. It is of no use if the root file system is formatted with ext4 and the kernel should first learn the ext4 capability with a module that is on the ext4 hard drive - this is where the cat will bite its tail. Oh yes:make modules_install "and check it in / lib / modules !

For later educational and research purposes you can of course also provide an" initial ramdisk "(initrd) and store the required modules and other files there, but if you have a tailor-made kernel for this special PC generated, this is not necessary at first. You can do it later to activate microcode updates via "early load", but it is not essential for life. For intel processors there are the microcode files .

Before Reboot you should then look in the new / etc directory (which is currently still called / mnt / lfs / etc ) for files that contain "** EDITME **". There you can then incorporate the host name, IP address, name server, etc. that match your own environment (if you do not operate your own DNS server, the IP address of the DSL router that serves as a DNS forwarder for the requests The files can be found with a courageous " grep -l EDITME / mnt / lfs / etc / * ", and if you want to edit all of them in one go, you just throw the list of results to an editor: " vi $ (grep -l EDITME / mnt / lfs / etc / *) " .

The most important file here is / etc / fstab  which describes which partition of the hard disk has which purpose and where it belongs in the file system. A swappable partition should definitely be provided, even if the PC feels that it has enough RAM installed. A reason for this can be found here  (the author of the article works in a data center on Facebook). The re used to be a rule of "twice as much swap as RAM", but in principle I would allow between 2 and 8 GB of swap for normal desktop systems.

One thing you should definitely not forget: give the root user of the new LFS system a password before rebooting. Otherwise you can boot wonderfully, but not log in ;-)

In all honesty: the feeling is indescribable when the self-compiled Linux actually boots for the first time and you see the login prompt ;-)

If the new system does not want to boot, you have to investigate the cause. A "kernel panic" occurs if the root file system was not found. The kernel module for the file system in question is then probably missing. Or the information in /boot/grub/grub.cfg does not match which partition it is. Unfortunately, the spelling of grub and Linux differ a little here. "sda" for Linux is "hd0" in grub.

A mistake I made once: all USB drivers were declared as modules and then not defined in / etc / modules . In this situation it becomes difficult for a USB keyboard to deliver its inputs :-).

In such situations, you boot the guest system again and mount the LFS partition again under / mnt / lfs and begins to repair.

When it boots up and you can log in, repairs are easier: the error messages, for example from the init scripts, are still on the screen, and you can correct everything you need to do step by step and set up the new, self-made Linux system. The LFS already has everything on board to translate and install packages independently.

After the successful LFS, the BLFS continues.
A few suggestions on how to make the LFS a little more convenient to use:
  • gpm (copy + paste with mouse in the text surface)
  • cpio (for building initrd)
  • openssl (ssl library)
  • openssh (ssh server and client)
  • dhcpcd (have the IP address set via DHCP)
  • nfs-utils (if you have a NAS, e.g. a Fritzbox, or want to build it yourself)
  • samba (if you want to build a NAS yourself or a Windows domain controller)
  • lm_sensors (hardware monitoring of CPU and fan)
  • lsusb (list USB devices)
  • lspci (list PCI devices)
  • ghostscript (for PDF)
  • cups (for printing)
  • Firefox (for cat videos on the internet)