Archive for the ‘bsd’ Category

FreeBSD View Memory Usage

November 17, 2014 Leave a comment

Get memory from dmesg:

[root@freebitch10 /]# dmesg | grep memory
real memory = 134152192 (127 MB)
avail memory = 102039552 (97 MB)

To see swap memory only

[root@freebitch10 /]# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ada0p3        314368    13052   301316     4%

Total physical memory in the system (with sysctl):

[root@freebitch10 /]# sysctl hw.physmem
hw.physmem: 110563328

Another way is to use top command

[root@freebitch10 /]# top -n | grep Mem
Mem: 3704K Active, 35M Inact, 41M Wired, 940K Cache, 20M Buf, 20M Free

Just to see free memory

[root@freebitch10 /]# top -d 1|grep '^Mem:'|cut -d ',' -f 6
 20M Free

You can also install sysinfo (utility used to gather system configuration information)

[root@freebitch10 /]# pkg install sysinfo
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
	sysinfo: 1.0.1_2

The process will require 39 KB more space.
16 KB to be downloaded.

Proceed with this action? [y/N]: y
Fetching sysinfo-1.0.1_2.txz: 100%   16 KB  16.7k/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing sysinfo-1.0.1_2: 100%

And get the memory information:

[root@freebitch10 /]# sysinfo mem
Generated by SysInfo v1.0.1 by Daniel Gerzo

RAM information

Memory information from dmidecode(8)
WARNING: You will need to install the sysutils/dmidecode port in order to obtain this information.

System memory summary
Total real memory available:	105 MB
Logically used memory:		51 MB
Logically available memory:	53 MB

Swap information
Device          1K-blocks     Used    Avail Capacity
/dev/ada0p3        314368      13M     294M     4%

Or install freecolor ( like Linux free command )

[root@freebitch10 /]# pkg install freecolor
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 2 packages will be affected (of 0 checked):

New packages to be INSTALLED:
	freecolor: 0.9.2_1
	libstatgrab: 0.91

The process will require 549 KB more space.
118 KB to be downloaded.

Proceed with this action? [y/N]: y
Fetching freecolor-0.9.2_1.txz: 100%    5 KB   5.3k/s    00:01    
Fetching libstatgrab-0.91.txz: 100%  113 KB 115.7k/s    00:01    
Checking integrity... done (0 conflicting)
[1/2] Installing libstatgrab-0.91: 100%
[2/2] Installing freecolor-0.9.2_1: 100%

To view memory information in text mode

[root@freebitch10 /]# freecolor -t -m -o
             total       used       free     shared    buffers     cached
Mem:           101         45         56          0          0          0
Swap:          307         12        294
Total:         408 = (      57 (used) +      351 (free))

To view memory information in graphical mode

[root@freebitch10 /]# freecolor -t -m
Physical  : [###################................] 56%	(57/101)
Swap      : [#################################..] 95%	(294/307)
Total     : [##############################%%%%%] (408=351+56)

Freebsd 10 pkg manager

November 8, 2014 Leave a comment

With the fresh install when you try to install any package you will get something like: No package found

To solve this issue:

# cp /usr/local/etc/pkg.conf.sample /usr/local/etc/pkg.conf
# pkg update



replace -> url: “pkg+${ABI}/latest”
with      -> url: “pkg+${ABI}/release_1”

Colorize your freebsd terminal

September 25, 2011 Leave a comment






Categories: bsd

Freebsd Installing ports via distcc

September 5, 2011 Leave a comment

Our main machine is freebsd 8.2 on ibm t22 which sucks at compiling anything:

CPU: Intel Pentium III (696.97-MHz 686-class CPU)
Origin = "GenuineIntel"  Id = 0x68a  Family = 6  Model = 8  Stepping = 10
real memory  = 402653184 (384 MB)
avail memory = 379080704 (361 MB)

So what we’ll do is;

Use distcc and compile ports with couple of machines (kind of clustering) in our network and hope it will be much more faster…..

Distcc lets you to compile any source across the network with as many machines as you want. Distcc has 2 modes pump and plain.

Plain mode:

With plain distcc, the preprocessor must always run locally because it needs to access various header files on the local machine
which may not be present, or  may  not be  the  same, on the volunteer.

Pump Mode:

In pump mode, distcc runs the preprocessor remotely too.  To do so, the preprocessor must have access  to  all  the files  that it would have accessed if had been running locally.  In pump mode, therefore, distcc gathers all of the recursively included headers, except the ones that are default system headers, and sends them along with the source file to the compilation server

We will use plain mode. Main machine freebsd other machines various linux servers. Mix and match……

Under freebsd we will also use bsdadminscripts which makes life a lot of easier when dealing with distcc with ports compile

If you do not have port tree installed than:

[root@freeslut ~]# portsnap fetch
[root@freeslut ~]# portsnap extract

if you already have ports:

[root@freeslut ~]# portsnap fetch update

install distcc:

[root@freeslut ~]# cd /usr/ports/devel/distcc
[root@freeslut ~]# make install clean

install ccache:

[root@freeslut distcc]# cd ../ccache/
[root@freeslut distcc]# make install clean

install bsdadminscripts:

[root@freeslut ccache]# cd ../../sysutils/bsdadminscripts/
[root@freeslut ccache]# make install clean

create buildflags.conf file

[root@freeslut ccache]# cp /usr/local/etc/buildflags.conf.sample /usr/local/etc/buildflags.conf

Add fallowing to /etc/make.conf (this tells make to use bsdscripts directives)

[root@freeslut ccache]# cat /etc/make.conf
# /usr/local/etc/buildflags.conf
BUILDFLAGS= /usr/local/share/bsdadminscripts/
.if exists(${BUILDFLAGS})
.include "${BUILDFLAGS}"

distcc is looking 3 places before it connects to any servers these are in order of:

A “host list” tells distcc which machines to use for  compilation. In order,  distcc  looks  in  the  $DISTCC_HOSTS environment variable, the user’s $DISTCC_DIR/hosts file, and the system-wide host  file.   If  no host list can be found, distcc emits a warning and compiles locally.

freebsd 8.2 does not create distcc hosts file and folder so we will create it:

[root@freeslut ccache]# mkdir /usr/local/etc/distcc/
[root@freeslut ccache]# touch /usr/local/etc/distcc/hosts

Define hosts 1:

Lets add some hosts to connect:

[root@freeslut ccache]# echo > /usr/local/etc/distcc/hosts
[root@freeslut ccache]# echo >> /usr/local/etc/distcc/hosts

Add check hosts:

[root@freeslut ccache]# distcc --show-hosts

Define hosts 2:

Also if you have your hosts links in your /etc/hosts file

[root@freeslut ccache]#cat /etc/hosts
----------    kuku    tirtil    sales

You can define your hosts with fallowing command (within bash shell)

[root@freeslut ccache]# export DISTCC_HOSTS="tirtil sales kuku"

I prefer this way because somehow other one is not working for me (Define host 1 system)

[root@freeslut ccache]# distcc --show-hosts

ok under linux machines distcc is seperated to 2 files server and client (im using fedora)

so install them by:

[root@tirtil ~]# yum install distcc distcc-server ccache

Edit server conf file to allow clients to connect

[root@tirtil ~]# vim /etc/rc.d/init.d/distccd

i’ll allow full 192.168.1 network so i add  “–allow” under options:

distccd editing

save it and start the service:

[root@tirtil ~]# service distccd start
Starting distccd (via systemctl):                          [  OK  ]

Repeat this step on every machine you want to use for compiling ports.

We are done with setup so lets start to compile something, on freebsd machine :

[root@freeslut ccache]# cd ../../www/apache22/
[root@freeslut ccache]# make

And in another console run fallowing command to see distrubution list:

[root@freeslut ~]# distccmon-text 5

77701  Compile                   tirtil[0]
77745  Compile                localhost[0]
77759  Compile                   kuku[0]
77811  Compile                 kaypak[0]

so thats all folks……………

Thoughts about vim

September 3, 2011 2 comments

By the way why do i ever intend to use vim on this fat bitch…Whats wrong with vi??? Nothing its absolutely perfect …

Look at this clean log just for additional “m” . Am i stupid or what?????

===>   Compressing manual pages for vim-7.3.121
===>   Registering installation for vim-7.3.121
fatbitch# make clean
===>  Cleaning for libXt-1.0.9
===>  Cleaning for intltool-0.41.1
===>  Cleaning for pkg-config-0.25_1
===>  Cleaning for libiconv-1.13.1_1
===>  Cleaning for gettext-
===>  Cleaning for atk-2.0.1
===>  Cleaning for glib-2.28.8
===>  Cleaning for gtk-2.24.6
===>  Cleaning for pango-1.28.4
===>  Cleaning for gio-fam-backend-2.28.8
===>  Cleaning for kbproto-1.0.5
===>  Cleaning for libX11-1.3.6,1
===>  Cleaning for libSM-1.1.1_3,1
===>  Cleaning for xproto-7.0.16
===>  Cleaning for perl-threaded-5.12.4_1
===>  Cleaning for p5-XML-Parser-2.41
===>  Cleaning for gmake-3.82
===>  Cleaning for libtool-2.4
===>  Cleaning for gobject-introspection-0.10.8
===>  Cleaning for python27-2.7.2_1
===>  Cleaning for pcre-8.13_1
===>  Cleaning for libXext-1.1.2,1
===>  Cleaning for libXrender-0.9.5
===>  Cleaning for libXinerama-1.1,1
===>  Cleaning for libXi-1.3.2,1
===>  Cleaning for libXrandr-1.3.0
===>  Cleaning for libXcursor-1.1.11
===>  Cleaning for libXfixes-4.0.4
===>  Cleaning for libXdamage-1.1.3
===>  Cleaning for libXcomposite-0.4.3,1
===>  Cleaning for gtk-update-icon-cache-2.24.6
===>  Cleaning for cups-client-1.4.8
===>  Cleaning for gdk-pixbuf-2.23.5
===>  Cleaning for shared-mime-info-0.90
===>  Cleaning for hicolor-icon-theme-0.12
===>  Cleaning for freetype2-2.4.6
===>  Cleaning for libXft-2.1.14
===>  Cleaning for cairo-1.10.2_2,1
===>  Cleaning for xorg-fonts-truetype-7.5.1
===>  Cleaning for encodings-1.0.4,1
===>  Cleaning for gamin-0.1.10_4
===>  Cleaning for libxcb-1.7
===>  Cleaning for xorg-macros-1.11.0
===>  Cleaning for bigreqsproto-1.1.1
===>  Cleaning for xcmiscproto-1.2.0
===>  Cleaning for xextproto-7.1.1
===>  Cleaning for xtrans-1.2.5
===>  Cleaning for inputproto-2.0.1
===>  Cleaning for xf86bigfontproto-1.2.0
===>  Cleaning for libXau-1.0.6
===>  Cleaning for libXdmcp-1.0.3
===>  Cleaning for libICE-1.0.7,1
===>  Cleaning for automake-1.11.1
===>  Cleaning for autoconf-2.68
===>  Cleaning for gdbm-1.8.3_3
===>  Cleaning for expat-2.0.1_2
===>  Cleaning for bison-2.4.3,1
===>  Cleaning for libffi-3.0.9
===>  Cleaning for renderproto-0.11
===>  Cleaning for xineramaproto-1.2
===>  Cleaning for randrproto-1.3.2
===>  Cleaning for fixesproto-4.1.2
===>  Cleaning for damageproto-1.2.1
===>  Cleaning for compositeproto-0.4.2
===>  Cleaning for png-1.4.8
===>  Cleaning for tiff-4.0.0_2
===>  Cleaning for jpeg-8_3
===>  Cleaning for jasper-1.900.1_9
===>  Cleaning for libxml2-2.7.8_1
===>  Cleaning for fontconfig-2.8.0_1,1
===>  Cleaning for xcb-util-0.3.6_1
===>  Cleaning for pixman-0.22.0
===>  Cleaning for libGL-7.4.4
===>  Cleaning for font-bh-ttf-1.0.3
===>  Cleaning for font-misc-meltho-1.0.3
===>  Cleaning for font-misc-ethiopic-1.0.3
===>  Cleaning for bitstream-vera-1.10_5
===>  Cleaning for mkfontscale-1.0.8
===>  Cleaning for bdftopcf-1.0.3
===>  Cleaning for font-util-1.2.0
===>  Cleaning for libcheck-0.9.8
===>  Cleaning for libxslt-1.1.26_3
===>  Cleaning for xcb-proto-1.6
===>  Cleaning for libpthread-stubs-0.3_3
===>  Cleaning for automake-wrapper-20101119
===>  Cleaning for m4-1.4.16,1
===>  Cleaning for help2man-1.40.4
===>  Cleaning for autoconf-wrapper-20101119
===>  Cleaning for jbigkit-1.6
===>  Cleaning for unzip-6.0_1
===>  Cleaning for libglut-7.4.4
===>  Cleaning for gperf-3.0.3
===>  Cleaning for makedepend-1.0.3,1
===>  Cleaning for glproto-1.4.12
===>  Cleaning for dri2proto-2.3
===>  Cleaning for libXxf86vm-1.1.0
===>  Cleaning for libdrm-2.4.12_1
===>  Cleaning for mkfontdir-1.0.6
===>  Cleaning for libfontenc-1.1.0
===>  Cleaning for libXfont-1.4.4,1
===>  Cleaning for libgcrypt-1.5.0
===>  Cleaning for p5-Locale-gettext-1.05_3
===>  Cleaning for libXmu-1.1.0,1
===>  Cleaning for libGLU-7.4.4
===>  Cleaning for xf86vidmodeproto-2.3
===>  Cleaning for fontsproto-2.1.1
===>  Cleaning for libgpg-error-1.10
===>  Cleaning for vim-7.3.121
Categories: bsd Tags: ,

More about ports

September 3, 2011 Leave a comment

i was thinking to write about distcc before i got this new computer w i5 processor…..When i was running my ibm t22 distcc really seamed like decent solution but now….unless you have a bluefire ( in your network distcc is useless against ports system…

Did i mention “Fuck port system!!!!!!!!!”

Update: Probably you’ll need couple of bluefire systems in your network to make this fat bitch compile faster…..

Port system sucks

September 3, 2011 Leave a comment

This port system is really fucked up situation…What ever people say its useless….

intel icore 5 2.3 Ghz 8 gb ram

CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz (2294.80-MHz 686-class CPU)

make vim takes longer than 2 hours…i know it has depencies and such but seriously fuck it..

Categories: bsd Tags: ,