# New to FreeBSD but a Linux vet



## dazealex (Feb 16, 2012)

Hi guys,

I am liking FreeBSD's ZFS feature for my home server. It's great. But coming from a Linux background, it'll take some time for me to get the hang of FreeBSD. Any pointers or things you wished you knew?

I'm trying to get netatalk working, but it just won't budge. 

And also, one of my NFS shares from my Linux machine is not recognizing the user properly, it shows 1000 instead of user name. Is there a way to map it properly?

Thanks,

daze


----------



## throAU (Feb 16, 2012)

First point (I came from Linux originally too):  FreeBSD is not Linux.  It will mess with your head during an adjustment period, until things click into place.  Once they do it is far more logical and consistent, but it will be painful for a bit.  All add on packages tend to store config under /usr/local rather than scattered everywhere throughout the base filesystem like Linux.

Make use of the handbook.

Ports are great, but they're not required - packages are just fine in most instances

If you can, run GENERIC kernel, and track RELEASE rather than STABLE.  For most uses, its fine and you get easy binary upgrades (and you'll never get bitten by a case of getting a broken source tree during your upgrade).  Also, unlike most distributions of Linux, you can run current ports on an older base OS - so you don't typically end up wanting to upgrade to say, latest KDE or whatever and have to upgrade almost the entire OS to do so.

Haven't used NFS or Appletalk much here, so sorry can't help with that...


----------



## nekoexmachina (Feb 16, 2012)

> Any pointers or things you wished you knew?


1) Ports dependencies may be configured with variables /etc/make.conf, not with only make configure. Look for the variables WITH_* or WITHOUT_* in Makefile.
1.1) vim with default install pulls in GTK-1.0 and Xorg, which is not good for both desktop and server.

1.1.1-P.s.) Why is it still GTK1 not GTK2?


2) You may set PACKAGESITE of X-stable for any version greater than X. Packages there are built with X.0-RELEASE.
3) You may set 
MASTER_SITE_BACKUP 
MASTER_SITE_OVERRIDE
in /etc/make.conf.
4) csh is better than bash. You may find it strange and not-compatible with your bash scripts, but it is better, you should learn it's syntax.
5) before any actions, read the manual. Its not that obvious on Linux that you should, plus BSD- and GNU- versions of programs differ, so you should do it. Even if 'I know what this command will do'. You may find awesome features in the program with man.
6) Search for solution in (firstly) mailing list, than wiki, than forums. The best explained solutions are usually in the mailing lists.



> And also, one of my NFS shares from my Linux machine is not recognizing the user properly, it shows 1000 instead of user name. Is there a way to map it properly?


That's uid of a user. 
You are mounting NFS share on side of FreeBSD-server, yes? do you have user with uid=1000?
Try 
`$ grep 1000 /etc/passwd` to check.
Probably you do not, cause UIDs for users start with 1001 on FreeBSD.


----------



## Beastie (Feb 16, 2012)

nekoexmachina said:
			
		

> vim with default install pulls in GTK-1.0


It supports GTK2 since 2003.

http://www.freebsd.org/cgi/ports.cgi?query=vim&stype=name


> vim-7.3.121
> Vi "workalike", with many additional features
> Long description : Sources : Changes : Download
> Maintained by: obrien@FreeBSD.org
> Requires: atk-2.0.1, bitstream-vera-1.10_5, cairo-1.10.2_3,1, compositeproto-0.4.2, cups-client-1.5.2, damageproto-1.2.1, encodings-1.0.4,1, expat-2.0.1_2, fixesproto-5.0, font-bh-ttf-1.0.3, font-misc-ethiopic-1.0.3, font-misc-meltho-1.0.3, font-util-1.2.0, fontconfig-2.8.0_1,1, freetype2-2.4.7, gamin-0.1.10_4, gdk-pixbuf-2.23.5_1, gettext-0.18.1.1, gio-fam-backend-2.28.8_1, glib-2.28.8_4, gobject-introspection-0.10.8_1, *gtk-2.24.6*, gtk-update-icon-cache-2.24.6, hicolor-icon-theme-0.12, inputproto-2.0.2, intltool-0.41.1, jasper-1.900.1_10, jbigkit-1.6, jpeg-8_3, kbproto-1.0.5, libICE-1.0.7,1, libSM-1.2.0,1, libX11-1.4.4,1, libXau-1.0.6, libXcomposite-0.4.3,1, libXcursor-1.1.12, libXdamage-1.1.3, libXdmcp-1.1.0, libXext-1.3.0_1,1, libXfixes-5.0, libXft-2.1.14, libXi-1.4.3,1, libXinerama-1.1.1,1, libXrandr-1.3.2, libXrender-0.9.6, libXt-1.0.9,1, libffi-3.0.9, libfontenc-1.1.0, libiconv-1.13.1_1, libpthread-stubs-0.3_3, libxcb-1.7, libxml2-2.7.8_1, mkfontdir-1.0.6, mkfontscale-1.0.9, p5-XML-Parser-2.41, pango-1.28.4, pcre-8.30, perl-5.12.4_4, pixman-0.24.2, pkg-config-0.25_1, png-1.4.8, python27-2.7.2_3, randrproto-1.3.2, renderproto-0.11.1, shared-mime-info-0.90, tiff-4.0.0_3, xcb-util-0.3.8,1, xcb-util-renderutil-0.3.8, xextproto-7.2.0, xineramaproto-1.2.1, xorg-fonts-truetype-7.5.1, xproto-7.0.22


----------



## nekoexmachina (Feb 16, 2012)

> It supports GTK2 since 2003.


Yeah I know. I mean by default last time I've installed it without WITH_GTK2=yes (about a couple of month ago) it pulled in X11 support with GTK1.
I've looked over the Makefile in ports tree and yes, it has GTK2 by default now.


----------



## sossego (Feb 16, 2012)

Having an open mind with a desire to learn should be the first requirement when learning anything new and different.


----------



## jalla (Feb 16, 2012)

dazealex said:
			
		

> And also, one of my NFS shares from my Linux machine is not recognizing the user properly, it shows 1000 instead of user name. Is there a way to map it properly?



You mean that you don't see the user name from linux? If that's the case just enter the correct user and group

```
addgroup --gid 1000 <group>
adduser --uid 1000 --gid 1000 <user>
```

The primary group in FreeBSD is by default the same as your username (and they both start on 1000, not 1001),

If in doubt, check the actual values with id(1)()


----------



## dazealex (Feb 17, 2012)

jalla said:
			
		

> You mean that you don't see the user name from linux? If that's the case just enter the correct user and group
> 
> ```
> addgroup --gid 1000 <group>
> ...



On my FreeBSD machine, the UUID I have starts from 1001:

[aaron@cruise ~]$ id     
uid=1001(aaron) gid=1001(aaron) groups=1001(aaron),0(wheel)

Oh my Linux machine:

aaron@karmic:~$ id
uid=1000(aaron) gid=1000(aaron) groups=1000(aaron),4(adm),20(dialout),24(cdrom),46(plugdev),112(sambashare),116(lpadmin),117(admin),1001(media)

Can I just edit /etc/passwd on my FreeBSD box to change the UUID from 1001 to 1000 without issues?

Thanks guys for the response to this thread. It's existing and scary at the same time in learning to use FreeBSD. 

daze


----------



## LateNiteTV (Feb 17, 2012)

You should use pw.


----------



## kpa (Feb 17, 2012)

vipw(8) if you want edit /etc/master.passwd directly, /etc/passwd is kept in sync automatically but you have to use the proper utilities.


----------



## dazealex (Feb 17, 2012)

kpa said:
			
		

> vipw(8) if you want edit /etc/master.passwd directly, /etc/passwd is kept in sync automatically but you have to use the proper utilities.



Thanks, I got it to work. I had to chown the /home/aaron directory since it was now showing the old 1001 UID. 

FreeBSD isn't as lax as is Linux in taking hyphenated argumented anywhere. For example, *chown aaron -RV /home/aaron* doesn't work on FreeBSD, but it does on Linux. So I guess I have to get used to this difference. Any reason why it works this way on FreeBSD?

Thanks again for the help!

daze


----------



## roddierod (Feb 17, 2012)

dazealex said:
			
		

> FreeBSD isn't as lax as is Linux in taking hyphenated argumented anywhere. For example, *chown aaron -RV /home/aaron* doesn't work on FreeBSD, but it does on Linux. So I guess I have to get used to this difference. Any reason why it works this way on FreeBSD?




```
chown -Rv aaron /home/aaron
```


----------



## UNIXgod (Feb 17, 2012)

As nekoexmachina pointed out editors/vim will install xorg and other components. If your a vim user you can install editors/vim-lite instead which won't install it's gui counterpart. Of course already in base is Bostic's nvi which is the systems _vi()_.

Other editors on the system are ee() which is a simple editor for non veterans and absolute beginners. The venerable UNIX line editor ed() is also in base.

Both emacs (editors/emacs) and Bill Joy's historical vi (editors/2bsd-vi) ( are ports which can be installed as well as a plethora of other command line or gui editors.



			
				sossego said:
			
		

> Having an open mind with a desire to learn should be the first requirement when learning anything new and different.



This statement is true of learning FreeBSD( especially from it's GNU cousin)
FreeBSD has very well documented man pages. In fact everything in base has a man page and more (i.e. security(), tuning())

Organization is much different than GNU/Linux. On your login screen there is a note to read man hier().

You don't have to do everything a BSD or Linux way. After all these years I run zsh for my interactive shell and use gnuls instead of the base BSD ls(). But that is my preference. You can use csh() which many people use. You can use korn or bash or whatever you prefer. It's all about preferences.

The base sh() is The Almquist shell( i.e. ash). it's a very small bourne derived posix complaint shell. It tends to be used for scripting as it provides minimal burden on memory and execution speed.

If you install bash and use a bash script found on the web many times it will have the infamous noob first liner 
	
	



```
#!/bin/bash
```

This comes from those creating shells not realizing that are non gnu OSes which install bash as a separate third party program. In BSD it's installed in /usr/local/bin

A more portable script would begin with 
	
	



```
#!/usr/bin/env bash
```
 for use with a portable bash script.

BSD may feel like an alternative universe for you at first. Once you experience the logic and organization I'm sure you'll appreciate it ten fold over the GNU based systems. Several examples on what to look for are FreeBSD jails. Almost a perfect low level virtualization tool which would be a good match to use with ZFS. There are several system based packet filters to choose from. Kernghan's "One True AWK" is in base vs Arnold Robbin's gawk. One example of FreeBSD's organization is mailer.conf(). Yes both rc and conf files have man page documentation. Of course these examples are just the tip of the iceberg.

Take the time to become familiar with the handbook which is located here: http://freebsd.org/handbook.

good luck.


----------



## estrabd (Feb 18, 2012)

nekoexmachina said:
			
		

> 4) csh is better than bash. You may find it strange and not-compatible with your bash scripts, but it is better, you should learn its syntax.



False. Don't write scripts in csh, evar. /bin/sh is also available, though csh is default for root. Not sure why.


----------



## UNIXgod (Feb 18, 2012)

estrabd said:
			
		

> False. Don't write scripts in csh, evar. /bin/sh is also available, though csh is default for root. Not sure why.



nekoexmachina mentioned to learn it's syntactical structure. He said nothing about scripting with it. He was referring to the history syntax (i.e. !! !42) and the difference in exporting variables and other idiosyncrasies associated with a non Bourne derived shell.

csh is root for historical reasons and part the FreeBSD's heritage that makes it BSD. Bill Joy set up BSD UNIX derived from Bell Labs UNIX in the mid 70's. BSD1 he implemented ex which would become the core of vi because he was sick of using ed.  csh and vi where released in BSD2 at the end of the 70's. He implimented the tcp/ip stack in the system in the early 80's before he left to start Sun Microsystems.

csh is one of the first shells to implement history and interactive (tab) completion. It's been well documented why one shouldn't script with it but there is nothing stopping someone to experiment if they desired.

csh will always be the root user shell.

csh/ksh/bash/zsh are great interactive shells for the user. sh is the lightest and is best suited for administrative level system scripts but not so enjoyable as an interactive shell as it doesn't have interactive bloat implemented into it.

zsh is pretty over the top. If you haven't worked with it it's worth a look at. It is a very powerful user interactive shell with all the good things from Joy's C Shell, Steven Bourne's Shell, and David Korn's Shell.


----------



## kpa (Feb 18, 2012)

I still find this amusing. 

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/


----------



## freethread (Feb 18, 2012)

csh script is more easy to write/read than sh (for me), anyway it has no functions and variable content manipulation as in sh ${x opr y} (or I not digged enough in the man page).

@kpa
That document is 15+ years old, there is an updated version somewhere but it state the same old things, only date is changed, and the axamples are insane.

I tested it in Windows for scripting (v6.16.00-6.17.00), better than batch scripts, anyway JavaScript has no rivals (in Windows), well CS script, perhaps... but still in JS. Compiled last version 2 days ago (in win) but not tested, only a speedy run to see if I made compilation mistakes, anyway I guess it does not support functions & co.


----------



## kpa (Feb 18, 2012)

Yes I know it's old but that's how csh(1) was 15-20 years ago because of totally brain-dead design that went to it, especially with the parsing of input.


----------

