project:bsd:start
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | project:bsd:start [2018/05/17 18:26] – created maxfx | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | {{template>: | ||
+ | [[user: | ||
+ | interested=[[user: | ||
+ | [[user: | ||
+ | [[user: | ||
+ | [[user: | ||
+ | [[user: | ||
+ | |||
+ | ~~META: | ||
+ | status = active | ||
+ | & | ||
+ | ~~ | ||
+ | |||
+ | ====== BSD OS Systems ====== | ||
+ | |||
+ | ====== FreeBSD ====== | ||
+ | **FreeBSD** is a freely available and open source implementation of the Berkeley version of the UNIX operating system.This system is in the same family of operating systems as Solaris, AIX, HP-UX, and Digital UNIX. The original UNIX operating system can trace its roots back to the 1960s. The designers of UNIX created a design so flexible and powerful that even 30 years later, UNIX (and thus FreeBSD as well) remains one of the most versatile, well-respected operating systems available. It runs on the following platforms: **AMD64, ARM, ARM64, I386, MIPS, PC98, PPC, SPARC, XBOX, RPI, PICO**. FreeBSD offers advanced networking, performance, | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ====== Goals and ideas project ====== | ||
+ | |||
+ | * More information about FreeBSD OS. | ||
+ | |||
+ | * More information about network layer | ||
+ | |||
+ | * More information about kernel | ||
+ | |||
+ | * Porting kernel for other unfriendly platforms | ||
+ | |||
+ | * Porting or Run kernel for other unfriendly android mobile phones or tablets. | ||
+ | |||
+ | * More desktops with BSD ! .... | ||
+ | |||
+ | ====== Derivates FreeBSD OS ====== | ||
+ | |||
+ | ^ Derivate FreeBSD | ||
+ | | FreeBSD | ||
+ | | TrueOS / PCBSD | Easy use | [[https:// | ||
+ | | GhostBSD | ||
+ | | DesktopBSD | ||
+ | | HardenedBSD | ||
+ | | MidnightBSD | ||
+ | | DragonFly | ||
+ | | TrustedBSD | ||
+ | | Frenzy | ||
+ | | Debian FreeBSD | ||
+ | | Gentoo FreeBSD | ||
+ | | Raspbsd | ||
+ | | Freesbie | ||
+ | | MfsBSD | ||
+ | | True-Pico | ||
+ | | | | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ====== Information about FreeBSD ====== | ||
+ | |||
+ | ==== Comparing BSD and Linux ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== For Beginner | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD is not Windows === | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== FreeBSD Myth (For linux users) ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD features ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD tips and tricks ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== FreeBSD Video ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | ==== FreeBSD Video ZFS ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD Video ASIANBSDCON 2018 ==== | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD Kernel Porting ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== FreeBSD Kernel for beringer ==== | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD Port ==== | ||
+ | [[https:// | ||
+ | |||
+ | ==== FreeBSD Jails ==== | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== How to build package ==== | ||
+ | === Poudriere === | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | === Making new port === | ||
+ | [[http:// | ||
+ | ==== How to Become a FreeBSD Committer ==== | ||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== FreeBSD Sound ==== | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Steam on FreeBSD ==== | ||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== FreeBSD as Bitcoin Full Node ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Avoiding Linuxisms ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Quick start for Linux users ==== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ^ Purpose | ||
+ | | Install package from remote repository | ||
+ | | Install local package | ||
+ | | List installed packages | ||
+ | | List PCI devices | ||
+ | | List loaded kernel modules | ||
+ | | Load/Unload kernel modules | ||
+ | | Trace system calls | truss | strace | ||
+ | |||
+ | |||
+ | ==== FreeBSD handbook ==== | ||
+ | {{ : | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Support Laptops ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Tuning Power Laptops ==== | ||
+ | [[https:// | ||
+ | |||
+ | ====== First step after installation FreeBSD ====== | ||
+ | |||
+ | The first step after installation system is good download security patches for the operating system | ||
+ | and download new files for operating system and install. | ||
+ | |||
+ | < | ||
+ | freebsd-update fetch install | ||
+ | shutdown -r now | ||
+ | </ | ||
+ | |||
+ | Next step is to update ports collection for the operating system. | ||
+ | |||
+ | for updating information for FreeBSD ports developers is / | ||
+ | |||
+ | < | ||
+ | portsnap auto | ||
+ | |||
+ | or | ||
+ | |||
+ | portsnap fetch | ||
+ | portsnap extract | ||
+ | </ | ||
+ | |||
+ | Update ports is east command | ||
+ | |||
+ | < | ||
+ | portsnap fetch update | ||
+ | </ | ||
+ | |||
+ | Security audit for package and FreeBSD | ||
+ | |||
+ | < | ||
+ | pkg audit -F | ||
+ | </ | ||
+ | |||
+ | ====== Apply security patches FreeBSD update, upgrade ====== | ||
+ | |||
+ | ==== Apply security patches ==== | ||
+ | < | ||
+ | freebsd-update fetch | ||
+ | freebsd-update install | ||
+ | </ | ||
+ | |||
+ | ==== Upgrade FreeBSD ==== | ||
+ | < | ||
+ | freebsd-update fetch | ||
+ | freebsd-update upgrade -r 11.0-RELEASE or other version | ||
+ | freebsd-update install | ||
+ | </ | ||
+ | ====== Desktop Environments ====== | ||
+ | |||
+ | FreeBSD has several desktop environments - Xfce4, Mate, Gnome3, Cinnamon, KDE, Lumina | ||
+ | |||
+ | ==== How install Mate desktop ==== | ||
+ | |||
+ | < | ||
+ | pkg install mate-desktop mate xorg slim | ||
+ | </ | ||
+ | |||
+ | Enable components for kernel in etc/rc.conf | ||
+ | |||
+ | You need enable this component: | ||
+ | |||
+ | < | ||
+ | zfs_enable=" | ||
+ | hald_enable=" | ||
+ | dbus_enable=" | ||
+ | slim_enable=" | ||
+ | </ | ||
+ | |||
+ | if you want to enable crash dump, if don't you write " | ||
+ | |||
+ | < | ||
+ | dumpdev=" | ||
+ | </ | ||
+ | |||
+ | Next step is create file .xinitrc in /root/ and /home/user/ with command | ||
+ | |||
+ | < | ||
+ | exec mate-session | ||
+ | </ | ||
+ | |||
+ | and reboot. | ||
+ | | ||
+ | |||
+ | ==== How install Xfce desktop ==== | ||
+ | |||
+ | < | ||
+ | pkg install xfce4-desktop xfce xorg slim | ||
+ | </ | ||
+ | |||
+ | Enable components for kernel in etc/rc.conf | ||
+ | |||
+ | You need to run desktop | ||
+ | |||
+ | < | ||
+ | zfs_enable=" | ||
+ | hald_enable=" | ||
+ | dbus_enable=" | ||
+ | slim_enable=" | ||
+ | </ | ||
+ | |||
+ | if you want to enable crash dump, if don't you write " | ||
+ | |||
+ | < | ||
+ | dumpdev=" | ||
+ | </ | ||
+ | |||
+ | Next step is create file .xinitrc in /root/ and /home/user/ with command | ||
+ | |||
+ | < | ||
+ | exec startxfce4 | ||
+ | </ | ||
+ | |||
+ | and reboot. | ||
+ | | ||
+ | ==== How to set slim theme ==== | ||
+ | < | ||
+ | # pkg install slim-themes | ||
+ | # cd / | ||
+ | # fetch http:// | ||
+ | # tar jxvf slim-freebsd.tar.bz2 | ||
+ | # rm slim-freebsd.tar.bz2 | ||
+ | |||
+ | Edit and set / | ||
+ | # | ||
+ | current_theme | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Optimus on Freebsd ==== | ||
+ | Comment out Nvidia-related parts from your [[ https:// | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | |||
+ | Section " | ||
+ | Identifier | ||
+ | Driver | ||
+ | BusID " | ||
+ | EndSection | ||
+ | |||
+ | #Section " | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #EndSection | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Then add the following bits to [[ https:// | ||
+ | |||
+ | < | ||
+ | kld_list=' | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== NTPD ==== | ||
+ | ==== NTPD synchronize ==== | ||
+ | |||
+ | < | ||
+ | ntpdate_enable=" | ||
+ | ntpdate_hosts=" | ||
+ | </ | ||
+ | |||
+ | Or manually update time and date | ||
+ | <WRAP center round important 60%> | ||
+ | securelevel on 2 then you cannot set time only about second. | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ntpdate -b pool.ntp.org | ||
+ | sudo service ntpd start | ||
+ | </ | ||
+ | |||
+ | ==== Disable Beep ==== | ||
+ | |||
+ | < | ||
+ | # sysctl hw.syscons.bell=0 | ||
+ | # reboot | ||
+ | </ | ||
+ | |||
+ | or if you use XFCE | ||
+ | |||
+ | < | ||
+ | set bell-style none | ||
+ | </ | ||
+ | |||
+ | ==== Enable sudo ==== | ||
+ | You must edit sudoers file | ||
+ | < | ||
+ | visudo | ||
+ | </ | ||
+ | |||
+ | ==== Change standard shell to fish ==== | ||
+ | |||
+ | You must add line in /etc/shells for example fish shell | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Change shell and path your favorite shell | ||
+ | < | ||
+ | chsh -s / | ||
+ | </ | ||
+ | |||
+ | === Aliases === | ||
+ | [[http:// | ||
+ | |||
+ | === Paths for shell === | ||
+ | If you need PATH for example compiler or some options | ||
+ | < | ||
+ | # ASAN settings | ||
+ | set -x ASAN_SYMBOLIZER_PATH / | ||
+ | set -x ASAN_OPTIONS verbosity=1 | ||
+ | set -x ASAN_OPTIONS symbolize=1 | ||
+ | set -x ASAN_OPTIONS detect_stack_use_after_scope=1 | ||
+ | |||
+ | # UBSAN settings | ||
+ | set -x UBSAN_SYMBOLIZER_PATH / | ||
+ | set -x UBSAN_OPTIONS verbosity=2 | ||
+ | |||
+ | # MSAN | ||
+ | set -x MSAN_SYMBOLIZER_PATH / | ||
+ | set -x MSAN_OPTIONS fsanitize-memory-track-origins=2 | ||
+ | set -x MSAN_OPTIONS verbosity=2 | ||
+ | set -x MSAN_OPTIONS symbolize=1 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Nano tuning ==== | ||
+ | < | ||
+ | set constantshow | ||
+ | set smooth | ||
+ | set autoindent | ||
+ | set casesensitive | ||
+ | set historylog | ||
+ | set morespace | ||
+ | |||
+ | syntax " | ||
+ | color blue " | ||
+ | |||
+ | ## nanorc files | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | include "/ | ||
+ | |||
+ | </ | ||
+ | ==== Mount Devices ==== | ||
+ | |||
+ | ==== Mount msdosfs ==== | ||
+ | < | ||
+ | # ls /dev/da* | ||
+ | # mount_msdosfs /dev/da0 /media/usb | ||
+ | </ | ||
+ | |||
+ | ==== Mount ext2/ | ||
+ | Fuse-ext2 mounts an ext2/ | ||
+ | |||
+ | For control kernels fuse modules is command: | ||
+ | < | ||
+ | kldstat | ||
+ | </ | ||
+ | |||
+ | If you don't have fuse.ko module in the kernel | ||
+ | you use this command | ||
+ | < | ||
+ | kldload fuse | ||
+ | </ | ||
+ | |||
+ | Then mount your partition | ||
+ | < | ||
+ | fuse-ext2 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Mount NTFS ==== | ||
+ | |||
+ | For mounting ntfs file system you must kernel module loaded. | ||
+ | |||
+ | For control kernels fuse modules is command: | ||
+ | < | ||
+ | kldstat | ||
+ | </ | ||
+ | |||
+ | and load FUSE kernel module: | ||
+ | < | ||
+ | kldload fuse | ||
+ | </ | ||
+ | |||
+ | and then you can mount ntfs filesystem. | ||
+ | |||
+ | < | ||
+ | # ls /dev/da* | ||
+ | # ntfs-3g | ||
+ | </ | ||
+ | |||
+ | ==== Automounting Removable Media ==== | ||
+ | |||
+ | Uncomment in config file in / | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Add lines to / | ||
+ | |||
+ | < | ||
+ | notify 100 { | ||
+ | match " | ||
+ | match " | ||
+ | action "/ | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | Reload service | ||
+ | |||
+ | < | ||
+ | service automount reload | ||
+ | service devd restart | ||
+ | </ | ||
+ | |||
+ | and added configuration / | ||
+ | < | ||
+ | autofs_enable=" | ||
+ | </ | ||
+ | ====== | ||
+ | < | ||
+ | portmaster -L - Check all update for ports | ||
+ | portmaster -a - Upgrade ports | ||
+ | portmaster -af - Rebuild of installed application | ||
+ | </ | ||
+ | |||
+ | ====== | ||
+ | |||
+ | Just put the following in / | ||
+ | you want to include debug symbols: | ||
+ | |||
+ | < | ||
+ | WITH_DEBUG= yes | ||
+ | </ | ||
+ | |||
+ | more information | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | ====== Compiling programs ====== | ||
+ | |||
+ | ==== Python3, Py3-QT5 ==== | ||
+ | |||
+ | First thing is to add version python to / | ||
+ | This conf file is for every compilation in system. | ||
+ | < | ||
+ | DEFAULT_VERSIONS+= python=3.5 python3=3.5 | ||
+ | </ | ||
+ | |||
+ | Next step is compile with default version python3.5 | ||
+ | < | ||
+ | sudo portmaster python3 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== How to setup MYSQL Database ===== | ||
+ | |||
+ | The first step is the installation | ||
+ | |||
+ | < | ||
+ | sudo pkg install mysql56-server | ||
+ | </ | ||
+ | |||
+ | next step is enable in / | ||
+ | |||
+ | < | ||
+ | sudo sysrc mysql_enable=yes | ||
+ | </ | ||
+ | |||
+ | Remember to run mysql_upgrade the first time you start the MySQL server after an upgrade from an earlier version. | ||
+ | |||
+ | Now start MYSQL Server | ||
+ | |||
+ | < | ||
+ | sudo service mysql-server start | ||
+ | </ | ||
+ | |||
+ | then set database | ||
+ | |||
+ | < | ||
+ | sudo mysql_secure_installation | ||
+ | </ | ||
+ | |||
+ | ====== Jails ===== | ||
+ | Simple script for create jail on zfs filesystem | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | |||
+ | ######################################################################## | ||
+ | # Donwload i386 base, ports tree FreeBSD OS | ||
+ | # and unpack base OS to your jail folder | ||
+ | ######################################################################## | ||
+ | |||
+ | name_jail=" | ||
+ | arch_jail=" | ||
+ | |||
+ | # Create new zfs dataset for jail - only once | ||
+ | #zfs create -o mountpoint=/ | ||
+ | |||
+ | # Create jail folder | ||
+ | zfs create zroot/ | ||
+ | | ||
+ | rm / | ||
+ | rm / | ||
+ | |||
+ | echo " | ||
+ | |||
+ | fetch ftp:// | ||
+ | fetch ftp:// | ||
+ | |||
+ | mkdir / | ||
+ | |||
+ | echo " | ||
+ | tar -xf / | ||
+ | tar -xf / | ||
+ | |||
+ | cp / | ||
+ | |||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | < | ||
+ | # / | ||
+ | |||
+ | # Global settings applied to all jails. | ||
+ | |||
+ | exec.start = "/ | ||
+ | exec.stop = "/ | ||
+ | exec.clean; | ||
+ | mount.devfs; | ||
+ | |||
+ | # The jail definition for freebsd386 | ||
+ | freebsd386 { | ||
+ | host.hostname = " | ||
+ | path = "/ | ||
+ | interface = " | ||
+ | ip4.addr = 10.0.2.15; | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | Packet forwarding | ||
+ | < | ||
+ | #Define the interfaces | ||
+ | ext_if = " | ||
+ | int_if = " | ||
+ | jail_net = $int_if: | ||
+ | |||
+ | #Define the NAT for the jails | ||
+ | nat on $ext_if from $jail_net to any -> ($ext_if) | ||
+ | </ | ||
+ | |||
+ | Run jail | ||
+ | < | ||
+ | bsd@ ~> sudo jail -c freebsd386 | ||
+ | bsd@ ~> jls | ||
+ | bsd@ ~> sudo jail -m jid=28 allow.raw_sockets=1 | ||
+ | </ | ||
+ | ====== ZFS ===== | ||
+ | |||
+ | ===== Mount ZFS ===== | ||
+ | < | ||
+ | zpool import | ||
+ | </ | ||
+ | |||
+ | For control command mount. | ||
+ | |||
+ | ===== Mount ZFS from Live CD ===== | ||
+ | < | ||
+ | zpool import -fR /media zroot | ||
+ | </ | ||
+ | |||
+ | ===== Tuning zfs on i386 ==== | ||
+ | If you will have i386 OS you must set wm.kmem_size=" | ||
+ | |||
+ | This is little tunables | ||
+ | more information on http:// | ||
+ | < | ||
+ | vfs.zfs.prefetch_disable=0 | ||
+ | vm.kmem_size=" | ||
+ | vm.kmem_size_max=" | ||
+ | vfs.zfs.arc_max=" | ||
+ | vfs.zfs.vdev.cache.size=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Resize partition ===== | ||
+ | |||
+ | We added space for virtual disk (VirtualBox, | ||
+ | but we have disk CORRUPT | ||
+ | < | ||
+ | lol@ ~/> gpart show ada0 | ||
+ | => 40 41942960 | ||
+ | 40 1024 | ||
+ | 1064 | ||
+ | 2048 | ||
+ | | ||
+ | 41940992 | ||
+ | </ | ||
+ | |||
+ | Fix is easy : | ||
+ | < | ||
+ | gpart recover ada0 | ||
+ | </ | ||
+ | |||
+ | Now we need resize partion 3. | ||
+ | < | ||
+ | lol@ ~/> gpart show | ||
+ | => 40 81919920 | ||
+ | 40 1024 | ||
+ | 1064 | ||
+ | 2048 | ||
+ | | ||
+ | 41940992 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | lol@ ~/> zpool list | ||
+ | NAME SIZE ALLOC | ||
+ | zroot 17.9G 17.3G | ||
+ | </ | ||
+ | |||
+ | For device is Busy , we have set this value: | ||
+ | < | ||
+ | lol@ ~/> sysctl kern.geom.debugflags=16 | ||
+ | kern.geom.debugflags: | ||
+ | </ | ||
+ | |||
+ | Now resize partition number 3 | ||
+ | < | ||
+ | lol@ ~/> gpart show | ||
+ | => 40 81919920 | ||
+ | 40 1024 | ||
+ | 1064 | ||
+ | 2048 | ||
+ | | ||
+ | 41940992 | ||
+ | |||
+ | lol@ ~/> sudo gpart resize -i 3 ada0 | ||
+ | |||
+ | ada0p3 resized | ||
+ | |||
+ | lol@ ~/> gpart show | ||
+ | => 40 81919920 | ||
+ | 40 1024 | ||
+ | 1064 | ||
+ | 2048 | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Last step with zfs pool: | ||
+ | < | ||
+ | lol@ ~/> sudo zpool set autoexpand=on zroot | ||
+ | lol@ ~/> sudo zpool online -e zroot ada0p3 ada0p3 | ||
+ | </ | ||
+ | |||
+ | Control space in zpool.Size of zroot is right. | ||
+ | < | ||
+ | lol@ ~/> zpool list | ||
+ | NAME SIZE ALLOC | ||
+ | zroot 37G 17.3G 19.7G | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | lol@ ~/ | ||
+ | kern.geom.debugflags: | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Virtualbox ====== | ||
+ | ===== Virtuabox in FreeBSD ===== | ||
+ | |||
+ | Added line with kernel module to / | ||
+ | |||
+ | < | ||
+ | vboxdrv_load=" | ||
+ | </ | ||
+ | |||
+ | Added line for bridged or host-only networking to / | ||
+ | < | ||
+ | vboxnet_enable=" | ||
+ | </ | ||
+ | |||
+ | Added to group | ||
+ | < | ||
+ | pw groupmod vboxusers -m yourusername | ||
+ | chown root: | ||
+ | chmod 0660 / | ||
+ | </ | ||
+ | |||
+ | Permanent permisions added lines to / | ||
+ | < | ||
+ | own | ||
+ | perm vboxnetctl 0660 | ||
+ | </ | ||
+ | |||
+ | ===== FreeBSD as guest Virtualbox ===== | ||
+ | |||
+ | Write to / | ||
+ | |||
+ | < | ||
+ | vboxguest_enable=" | ||
+ | vboxservice_enable=" | ||
+ | </ | ||
+ | |||
+ | ====== | ||
+ | |||
+ | ===== How to setup WIFI card ===== | ||
+ | < | ||
+ | pciconf -l - look for if see wifi hardware | ||
+ | sudo ifconfig wlan0 create wlandev wpi0 | ||
+ | sudo wpa_supplicant -i wlan0 -c / | ||
+ | </ | ||
+ | |||
+ | ===== How to setup USB WIFI ===== | ||
+ | |||
+ | Add kernel module to / | ||
+ | < | ||
+ | |||
+ | # Kenel drives for wifi | ||
+ | if_ath_load=" | ||
+ | if_iw_load=" | ||
+ | |||
+ | # Next wifi modules | ||
+ | wlan_wep_load=" | ||
+ | wlan_ccmp_load=" | ||
+ | wlan_tkip_load=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | Add to configure / | ||
+ | Configure you wifi device. | ||
+ | < | ||
+ | wlans_run0=" | ||
+ | create_args_wlan0=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | Look to your hardware if you have drivers. | ||
+ | < | ||
+ | |||
+ | # Look for if see wifi hardware (wpi, run0) | ||
+ | pciconf -l | ||
+ | |||
+ | # Create a device with name wlan0 | ||
+ | sudo ifconfig wlan0 create wlandev wpi0 | ||
+ | |||
+ | # Create wpa_supplicant configure file with ssid network | ||
+ | sudo wpa_supplicant -i wlan0 -c / | ||
+ | |||
+ | # Scan your wifi networks | ||
+ | ifconfig wlan0 up scan | ||
+ | SSID/MESH ID BSSID CHAN RATE | ||
+ | lol 00: | ||
+ | trololo | ||
+ | |||
+ | # IP address from DHCP server | ||
+ | sudo dhclient wlan0 | ||
+ | </ | ||
+ | |||
+ | ====== GELI ====== | ||
+ | < | ||
+ | Install CD -> Partition -> Shell | ||
+ | |||
+ | gpart create -s gpt vtbd0 | ||
+ | gpart add -t freebsd-boot -s 512k -a 4k vtbd0 | ||
+ | gpart add -t freebsd-ufs -a 1M vtbd0 | ||
+ | gpart bootcode -b /boot/pmbr -p / | ||
+ | |||
+ | geli init -b -g vtbd0p2 | ||
+ | geli attach vtbd0p2 | ||
+ | |||
+ | newfs -j / | ||
+ | mount / | ||
+ | |||
+ | - / | ||
+ | / | ||
+ | |||
+ | - / | ||
+ | geom_eli_load=" | ||
+ | |||
+ | exit (installer will continue) | ||
+ | |||
+ | Change | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ====== FreeBSD Kernel ====== | ||
+ | |||
+ | === Source code FreeBSD kernel === | ||
+ | < | ||
+ | sudo pkg install subversion | ||
+ | sudo svn checkout https:// | ||
+ | svn up /usr/src | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Profiling and debugging kernel === | ||
+ | {{ : | ||
+ | |||
+ | === Performance observality tools === | ||
+ | |||
+ | {{: | ||
+ | }===== Kernel module ===== | ||
+ | |||
+ | < | ||
+ | Simple kernel module. | ||
+ | https:// | ||
+ | </ | ||
+ | |||
+ | ====== FreeBSD Security ====== | ||
+ | ===== Security on FreeBSD ===== | ||
+ | |||
+ | To check the status of the securelevel on a running system: Add to / | ||
+ | |||
+ | < | ||
+ | kern.securelevel=2 | ||
+ | security.bsd.see_other_uids=0 | ||
+ | security.bsd.stack_guard_page=1 | ||
+ | net.inet.ip.random_id=1 | ||
+ | </ | ||
+ | |||
+ | more : [[http:// | ||
+ | |||
+ | ===== Enabling and Utilizing Process Accounting ===== | ||
+ | |||
+ | Tracking information such as CPU statistics and executed commands. | ||
+ | |||
+ | < | ||
+ | touch / | ||
+ | chmod 600 / | ||
+ | accton / | ||
+ | echo ' | ||
+ | </ | ||
+ | |||
+ | ====== | ||
+ | |||
+ | ===== IBM ACPI ===== | ||
+ | |||
+ | If you use notebooks, is better enable acpi driver in / | ||
+ | |||
+ | < | ||
+ | acpi_ibm_load=" | ||
+ | </ | ||
+ | |||
+ | ===== HP ACPI ===== | ||
+ | |||
+ | If you use notebooks, is better enable acpi driver in / | ||
+ | |||
+ | < | ||
+ | acpi_hp_load=" | ||
+ | </ | ||
+ | |||
+ | More : [[https:// | ||
+ | |||
+ | ====== Linux® Binary Compatibility ====== | ||
+ | |||
+ | < | ||
+ | # kldload linux | ||
+ | # kldload linux64 | ||
+ | |||
+ | # kldstat - you can look for modules | ||
+ | | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | 23 1 0xffffffff827bc000 389f4 linux64.ko | ||
+ | |||
+ | and add line to / | ||
+ | linux_enable=" | ||
+ | </ | ||
+ | |||
+ | ====== Troubleshooting with FreeBSD ====== | ||
+ | |||
+ | ===== SSH ===== | ||
+ | ==== Too many authentication failures ==== | ||
+ | If You are not able to authenticate via ssh and message "Too many authentication failures" | ||
+ | |||
+ | ===== BOOT on FreeBSD ===== | ||
+ | ==== Fatal double fault FreeBSD 10.3 - i386 , FreeBSD 11 - i386 ==== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The fatal double fault is a problem on FreeBSD - i386 with ZFS file system. | ||
+ | |||
+ | As described in / | ||
+ | This, however, is not an ideal solution for inclusion in the GENERIC kernel configuration, | ||
+ | implicitly decreases available usermode threads in an environment that is already resource-starved. | ||
+ | |||
+ | You must do this steps for new kernel: | ||
+ | < | ||
+ | # mkdir -p /usr/src | ||
+ | # svnlite co svn:// | ||
+ | # make -C /usr/src kernel-toolchain | ||
+ | # printf " | ||
+ | # make -C /usr/src buildkernel KERNCONF=ZFS | ||
+ | # make -C /usr/src installkernel KERNCONF=ZFS | ||
+ | </ | ||
+ | |||
+ | |||
+ | For FreeBSD 10.3 - More information on page https:// | ||
+ | For FreeBSD 11.0 - More information on page https:// | ||
+ | |||
+ | ==== How to boot from live CD ==== | ||
+ | |||
+ | If you have a problem with boot on FreeBSD and cannot run the system. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Back to FreeBSD menu and choose option 3. ( Escape to loader prompt ) | ||
+ | For help in command line is command help or ? (list of commands ) | ||
+ | help set are options for the command set | ||
+ | |||
+ | {{: | ||
+ | |||
+ | For boot from CD is commnad | ||
+ | < | ||
+ | set boot_cdrom (for mount filesystem) | ||
+ | boot | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | Look for a mounted filesystem with command mount.If you haven' | ||
+ | < | ||
+ | zpool import -f zroot | ||
+ | </ | ||