Serial Console

這邊說的是 FreeBSD 6.x (20060127 之後), 7.x 的用法,之前的可以看in2's Serial Console(他的不太對,最後還要用 bsdlabel(8) update Bootstraps 才對)。如果不是直接裝 20060127 以後的 6.x,請先用 bsdlabel(8) 更新過 Bootstraps 才行,否則認不得 -S 這個(可能要關掉 GEOM 防射腳,才能更新)。

  • kernel conf
device sio
  • /boot.config
-Dh -S115200
  • /boot/loader.conf
console="comconsole,vidconsole"
comconsole_speed="115200"
boot_multicons="YES"
boot_serial="YES"
  • /etc/ttys
ttyu0   "/usr/libexec/getty std.115200" cons25  on secure
  • /etc/remote (接 serial console 的)
console:dv=/dev/cuad0:br#115200:pa=none:
  • 開機用 screen 接的話
/usr/bin/env HOME=/root TERM=cons25 LANG=C /usr/local/bin/screen -dm -c /root/screenrc-console

defscrollback 20000
vbell off
screen -t con /root/tip.sh con

#!/bin/sh

export HOME=/root
export TERM=cons25
while true; do
        /usr/bin/tip $@
        echo "sleep 10 secs"
        /bin/sleep 10
done

GEOM Journaling

If you see 'panic: journal overflow', tune

kern.geom.journal.force_switch=50
kern.geom.journal.cache.switch=75

to force journal flush more frequently.

If kern.geom.journal.stats.wait_for_copy is higher, tune

kern.geom.journal.parallel_copies=24 # default 16
kern.geom.journal.parallel_flushes=12 # default 16

to force gjournal copies data faster.

Increase gjournal cache (by increase total kernel memory)

vm.kmem_size_max=419430400

PXE Install

  • Load bootonly CD into /pxe
    • vfs.root.mountfrom=“ufs:/dev/md0c” in loader.conf
    • gzip -d boot/mfsroot.gz
  • [OPTIONAL] export installation CD via NFS
  • DHCP
host pxe {
  hardware ethernet 00:11:22:33:44:55;
  fixed-address 10.0.0.1;
  next-server 10.0.0.254; # server ip (nfs, also for tftp server)
  # server-identifier 10.0.0.254;
  filename "/boot/pxeboot"; # relative to tftp root
  option root-path "/pxe/"; # bootonly, absolute path
}
  • NFS [OPTIONAL?]
/pxe 10.0.0.1
  • tftp
/usr/libexec/tftpd -s /pxe

IPMI

ipmitool -I open chassis status
ipmitool -I open lan set 7 ipaddr 該網卡的IP
ipmitool -I open lan set 7 netmask 該網卡的netmask
ipmitool -I open lan set 7 defgw ipaddr 該網卡的DefaultGateway # 不見得
ipmitool -I open lan set 7 access on
ipmitool -I open lan set 7 password 你的密碼
ipmitool -I open lan set 7 auth CALLBACK MD5
ipmitool -I open lan set 7 auth USER MD5
ipmitool -I open lan set 7 auth OPERATOR MD5
ipmitool -I open lan set 7 auth ADMIN MD5
ipmitool -I open lan set 7 user
  • 測試
ipmitool -A PASSWORD -I lan -H 該機器的ip -P 密碼 chassis status
  • 常用功能
    • power status
    • power on
    • power off
    • power reset
    • power soft (via acpi)
    • power cycle

Booting

Reference

  • boot0 (boot manager)
    • fdisk -B -b /boot/boot0 device
F1 DOS
F2 FreeBSD
F3 Linux
F4 ??
F5 Drive 1

Default: F2
  • boot1 (Stage 1) (boot block)
    • bsdlabel -B diskslice
    • 512 bytes
    • knows about disklabel
    • a rotating bar (\ - | /)
    • find and exectute boot2
  • boot2 (Stage 2) (boot block)
    • bsdlabel -B diskslice
    • knows about filesystem
    • choose loader or kernel
    • read /boot.config from slice a only
>> FreeBSD/i386 BOOT
Default: 0:ad(0,a)/boot/loader
boot:
  • loader (Stage 3)

pkgtools.conf

  • AFTERINSTALL
  AFTERINSTALL = {
    '*' => proc { |origin|
      cmd_restart_rc(origin)
    },
  }

Jail

  • periodic.conf
daily_status_disks_enable="NO"
daily_status_network_enable="NO"

daily_status_security_chksetuid_enable="NO"
daily_status_security_chkmounts_enable="NO"
daily_status_security_ipfwdenied_enable="NO"
daily_status_security_ipfdenied_enable="NO"
daily_status_security_pfdenied_enable="NO"
daily_status_security_ipfwlimit_enable="NO"
daily_status_security_ip6fwdenied_enable="NO"
daily_status_security_ip6fwlimit_enable="NO"
daily_status_security_kernelmsg_enable="NO"

ports tinderbox

  • Install to /home/tinderbox (from tarball)
  • Follow README
  • Setup ccache
  • Compile kernel with COMPAT_FREEBSD[67]
  • etc/env/portstree.FreeBSD
export FORCE_PACKAGE=1
export TRYBROKEN=1
  • etc/env/8-FreeBSD-nodoc
export NOPORTDOCS=1
export NOPORTEXAMPLES=1
export NOPORTDATA=1
# no real benefits...
#export NO_INSTALL_MANPAGES=1
export WITHOUT_NLS=1
  • etc/env/build.8-FreeBSD-PREFIX
export PREFIX=/usr/all-ports-go-here
export LOCALBASE=${PREFIX}
export X11BASE=${PREFIX}
  • etc/env/build.8-FreeBSD-i386 (jail created via -a i386)
export ARCH=i386
export MACHINE_ARCH=i386
  • KSE on 8
ln -fs /path/to/tinderbox/scripts/contrib/hooks/kse-fix/libmap.conf patches/
cd scripts
./tc updateHookCmd -h prePortBuild -c contrib/hooks/kse-fix/kse-fix.sh
  • etc/env/GLOBAL
export defaultUpdateHost=freebsd.csie.org
export defaultUpdateType=CSUP
  • apache conf
  DocumentRoot /home/tinderbox/scripts/webui

  Alias /logs/ "/home/tinderbox/logs/"
  Alias /packages/ "/home/tinderbox/packages/"
  Alias /errors/ "/home/tinderbox/errors/"
  #Alias /tb/ "/home/tinderbox/scripts/webui/"

  <Directory "/home/tinderbox/">
      Order allow,deny
      Allow from all
  </Directory>

  <Directory "/home/tinderbox/packages/">
      Order deny,allow
      Deny from all      
      Allow from localhost
  </Directory>
 
doc/freebsd.txt · Last modified: 2013/09/15 04:30 by 118.166.221.194     Back to top