Jump to content

FreeBSD - Faster Boot, Cleaner, Shortcuts to ease your work | UPDATE 12.10.2021


Recommended Posts

1. Faster and cleaner boot:

Spoiler

1. Reduce boot time. Standard you have 10 seconds to wait. Enter /boot/loader.conf and type:

This is the hidden content, please

2. We will modify the following startup scripts

  • /etc/rc.d/ldconfig
  • /etc/rc.d/netif
  • /etc/rc.d/nfsclient
  • /etc/rc.d/random
  • /etc/rc.d/routing

Here is the summary of the changes. In most cases its just adding 1> /dev/null OR 1> /dev/null 2> /dev/null to not display unneeded information at boot process.

This is the hidden content, please

3. Next up is /etc/rc.d/random , search random_start() and comment the 5 lines shown below:

45:random_start()
46-{
47-
48-   # if [ ${harvest_mask} -gt 0 ]; then
49-   #       echo -n 'Setting up harvesting: '
50-   #       ${SYSCTL} kern.random.harvest.mask=${harvest_mask} > /dev/null
51-   #       ${SYSCTL_N} kern.random.harvest.mask_symbolic
52-   # fi
53-

4. Open /etc/rc.conf and at the end add:

rc_startmsgs=NO
defaultroute_delay="0"

5. In /etc open csh.login and csh.logout and at the end add: (this clears the console after login and logout)

clear

6. Open /etc/gettytab and search: P|Pc|Pc console:\  and modify like down below: (this clears the console after booting)

P|Pc|Pc console:\
    :ht:np:sp#9600:\  #the number is different for each machine. don't change this row!
    :cl=\E[H\E[2J:  #add just this line

 

2. Alias for shortcuts such as paths and executions.

Spoiler

Aliases are used like this: 

alias mycommand path
or
alias mycommand "path && execution"

The idea is to build shortcuts that will help us compile or open / close the server without typing addresses and file executions, giving them only a name. They can be used ANYWHERE in the system. Personal example:

alias server    "cd /usr/home/game/main && sh admin_panel.sh"
alias compileall    "cd /usr/src/Server/ && gmake all -j5"
alias compiledb    "cd /usr/src/Server/ && gmake db -j5"
alias compilegame    "cd /usr/src/Server/ && gmake game -j5"

these settings for me do the following:

  • server              #opens my admin panel for server start/stop/clear_logs/etc..
  • compileall        #compiles game&db
  • compiledb       #compiles db only
  • compilegame  #compiles game only

( That -j5 at the end is the use of 4 CPU cores at compilation execution. In your case it will be the number of cores used by your virtual machine and add +1 . Example: 8 cores? You will use -j9 )


Aliases are retained in memory, but after reboot they are deleted, so we have to set them permanently:
1.  We enter in the base folder of our machine user. For example, user root has /root folder.
in there you will find .cshrc or .shrc file (depends on FreeBSD version) and search for: alias ll
Under it add the alias you need, as shown above in the examples

UPDATED! 12.10.2021

3. Disable Send Mail - Credits to: @ martysama0134 (Not waiting after Send Mail Service on boot, it will reduce your boot time with 10 more seconds)

Spoiler

Open /etc/rc.conf and Edit/Add these options:

# NO SENDMAIL
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Note: on old fbsd versions, it was used "NONE" instead of "NO" for sendmail_enable

Now, lets stop the sendmail service:

service sendmail stop

That's it! You can reboot and test it!

Hope it's usefull. It was for me ? 
Hope you have a great day!


Shahin

  • Metin2 Dev 103
  • Eyes 5
  • Dislove 1
  • Confused 2
  • Good 30
  • Love 9
  • Love 45
6 hours ago, Denizeri24 said:

wtf is this, how many times do you have to reboot freebsd?

I just turn off sendmail, that's more than enough..

If you don't like it, just ignore it.

It's pretty good tutorial and this can save you some time.

Yes, you need to reboot freebsd when you work, but you will experience this once you will be more advanced.

  • Lmao 4
  • Love 1

PeriodWars

release kraken GIF

  • 6 months later...
  • 1 year later...
  • 5 months later...
On 10/8/2021 at 2:53 AM, Shahin said:

1. Faster and cleaner boot:

  Hide contents

1. Reduce boot time. Standard you have 10 seconds to wait. Enter /boot/loader.conf and type:

Hidden Content

 

autoboot_delay=2 #Where "2" is the delay in seconds. "-1" means no delay. "NO" means INFINITE DELAY
boot_mute=YES 
loader_logo="beastie" #New logo!
hw.usb.no_boot_wait=1 #Not waiting for USB devices for root

 

 

2. We will modify the following startup scripts

  • /etc/rc.d/ldconfig
  • /etc/rc.d/netif
  • /etc/rc.d/nfsclient
  • /etc/rc.d/random
  • /etc/rc.d/routing

Here is the summary of the changes. In most cases its just adding 1> /dev/null OR 1> /dev/null 2> /dev/null to not display unneeded information at boot process.

Hidden Content

 

/etc/rc.d/ldconfig:40: check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} 1> /dev/null
/etc/rc.d/ldconfig:60: echo '32-bit compatibility ldconfig path:' ${_LDC} 1> /dev/null
/etc/rc.d/netif:260: /sbin/ifconfig ${ifn} 1> /dev/null 2> /dev/null
/etc/rc.d/routing:70: eval static_${_a} delete $_if 1> /dev/null 2> /dev/null
/etc/rc.d/routing:97: static_$2 add $3 1> /dev/null 2> /dev/null
/etc/rc.d/routing:104: static_$2 add $3 add $3 1> /dev/null 2> /dev/null

 

 

3. Next up is /etc/rc.d/random , search random_start() and comment the 5 lines shown below:

45:random_start()
46-{
47-
48-   # if [ ${harvest_mask} -gt 0 ]; then
49-   #       echo -n 'Setting up harvesting: '
50-   #       ${SYSCTL} kern.random.harvest.mask=${harvest_mask} > /dev/null
51-   #       ${SYSCTL_N} kern.random.harvest.mask_symbolic
52-   # fi
53-

4. Open /etc/rc.conf and at the end add:

rc_startmsgs=NO
defaultroute_delay="0"

5. In /etc open csh.login and csh.logout and at the end add: (this clears the console after login and logout)

clear

6. Open /etc/gettytab and search: P|Pc|Pc console:\  and modify like down below: (this clears the console after booting)

P|Pc|Pc console:\
    :ht:np:sp#9600:\  #the number is different for each machine. don't change this row!
    :cl=\E[H\E[2J:  #add just this line

 

2. Alias for shortcuts such as paths and executions.

  Hide contents

Aliases are used like this: 

alias mycommand path
or
alias mycommand "path && execution"

The idea is to build shortcuts that will help us compile or open / close the server without typing addresses and file executions, giving them only a name. They can be used ANYWHERE in the system. Personal example:

alias server    "cd /usr/home/game/main && sh admin_panel.sh"
alias compileall    "cd /usr/src/Server/ && gmake all -j5"
alias compiledb    "cd /usr/src/Server/ && gmake db -j5"
alias compilegame    "cd /usr/src/Server/ && gmake game -j5"

these settings for me do the following:

  • server              #opens my admin panel for server start/stop/clear_logs/etc..
  • compileall        #compiles game&db
  • compiledb       #compiles db only
  • compilegame  #compiles game only

( That -j5 at the end is the use of 4 CPU cores at compilation execution. In your case it will be the number of cores used by your virtual machine and add +1 . Example: 8 cores? You will use -j9 )


Aliases are retained in memory, but after reboot they are deleted, so we have to set them permanently:
1.  We enter in the base folder of our machine user. For example, user root has /root folder.
in there you will find .cshrc or .shrc file (depends on FreeBSD version) and search for: alias ll
Under it add the alias you need, as shown above in the examples

UPDATED! 12.10.2021

3. Disable Send Mail - Credits to: @ martysama0134 (Not waiting after Send Mail Service on boot, it will reduce your boot time with 10 more seconds)

  Hide contents

Open /etc/rc.conf and Edit/Add these options:

# NO SENDMAIL
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Note: on old fbsd versions, it was used "NONE" instead of "NO" for sendmail_enable

Now, lets stop the sendmail service:

service sendmail stop

That's it! You can reboot and test it!

Hope it's usefull. It was for me ? 
Hope you have a great day!


Shahin

i have this problem

https://metin2.download/picture/l33PYDy4Yjyr10hO4F4acw3twJd5Ez7h/.png

Edited by Metin2 Dev International
Core X - External 2 Internal
  • 3 months later...
On 6/27/2024 at 11:44 AM, forum80 said:

If u have .py , then python blabla.py

 

  • Premium

For some dumb reason the default shell has been changed to sh in FreeBSD 14. The .cshrc file you show is a csh configuration file, which was the standard in previous versions of FreeBSD.

To set your root shell back to csh you can run this command:

chsh -s /bin/csh root

Then login again to SSH to see the change.

On a side note about the OP, this may be a good idea in a local, development machine. I would not recommend to do it in an actual server as those timeouts are there for a reason.

Edited by Shogun

The "Disable Send Mail" part is no longer necessary starting with FreeBSD 14.x, as it has been removed. Therefore, adding those lines on FreeBSD 14 is pointless. But i suggest using FreeBSD 13.x while it's still supported.

Kind regards, iFreakTime.

  • Think 1
13 hours ago, iFreakTime~.~ said:

The "Disable Send Mail" part is no longer necessary starting with FreeBSD 14.x, as it has been removed. Therefore, adding those lines on FreeBSD 14 is pointless. But i suggest using FreeBSD 13.x while it's still supported.

Kind regards, iFreakTime.

Why suggest using FreeBSD 13.x when 14.x is here and more current? Makes no sense.

12 hours ago, realmoulinrouge said:

Why suggest using FreeBSD 13.x when 14.x is here and more current? Makes no sense.

Hello, on FreeBSD version 14.0, I have experienced several unexpected kernel panics on 3 different live systems. Now, maybe only I and a few others have had this issue, but on 13.x I did not encounter these problems. I haven't tested 14.1 yet, but I will, just to see if it's okay now.

Kind regards, iFreakTime.

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.