stuff/os/FreeBSD/FreeBSD_on_Clevo_Laptop.md
Moni Ghaoui 47aa1a3484 FC
2025-04-14 19:51:40 +02:00

280 lines
4.7 KiB
Markdown

# Setup
Install my favorite packages
```sh
pkg install bash sudo tmux htop neovim git bastille
```
Add "wheel" to the suoers file:
```sh
visudo
```
Change shell
```sh
chsh -s /usr/local/bin/bash
```
Do a system update:
```sh
freebsd-update fetch install
```
# Wifi
Find out what network cards we have:
```sh
pciconf -lv | grep -A1 -B3 network
```
On my Clevo laptop it looks like this:
```
re0@pci0:2:0:0: class=0x020000 rev=0x15 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x1558 subdevice=0xa600
vendor = 'Realtek Semiconductor Co., Ltd.'
device = 'RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller'
class = network
subclass = ethernet
iwlwifi0@pci0:3:0:0: class=0x028000 rev=0x1a hdr=0x00 vendor=0x8086 device=0x2723 subvendor=0x8086 subdevice=0x0084
vendor = 'Intel Corporation'
device = 'Wi-Fi 6 AX200'
class = network
nvme0@pci0:4:0:0: class=0x010802 rev=0x00 hdr=0x00 vendor=0x144d device=0xa809 subvendor=0x144d subdevice=0xa801
```
So we have an Intel Wifi.
We're going to configure the wireless card iwlwifi0 to the interface wlan0:
```sh
ifconfig wlan0 create wlandev iwlwifi0
```
To make the change persist across reboots:
```sh
sysrc wlans_iwlwifi0="wlan0"
```
We need to set the regulatory domain:
```sh
ifconfig wlan0 regdomain ETSI country NL
```
To scan the networks. I had to run the command twice to see the list:
```sh
ifconfig wlan0 up list scan
```
I see my networks:
```
SSID/MESH ID BSSID CHAN RATE S:N INT CAPS
TMNL-3EF981_24G d8:0d:17:b9:b2:f0 11 54M -37:-96 100 EPS HTCAP WME ATH RSN WPS
TMNL-3EF981 98:0d:67:3e:f9:81 11 54M -72:-96 100 EP APCHANREP RSN WPS BSSLOAD HTCAP VHTCAP VHTOPMODE WME
TMNL-3EF981_5G d8:0d:17:b9:b2:f1 64 54M -42:-96 100 EP HTCAP VHTCAP VHTOPMODE VHTPWRENV WME ATH RSN WPS
```
I want to connect to `TMNL-3EF981_5G`. We need to edit the `/etc/wpa_supplicant.conf` file:
```sh
nvim /etc/wpa_supplicant.conf
```
The contents. The password need to be set in psk.
```
country=NL
network={
ssid="TMNL-3EF981_5G"
psk="3J6YJHNRG8W7KMMF"
priority=5
}
```
To set it to use DHCP:
```sh
sysrc ifconfig_wlan0="WPA SYNCDHCP"
```
For some reason, we need to add the country code in the rc.conf:
```sh
sysrc create_args_wlan0="country NL"
```
Now bring it up!
```sh
service netif restart
```
Restart the laptop to see if it persists.
For some reason, it won't work (no suprise, wifi is awful in FreeBSD).
This worked for me after boot
```sh
ifconfig wlan0 down
ifconfig wlan0 ssid "TMNL-3EF981_5G"
ifconfig wlan0 regdomain etsi2 country NL
service netif restart
```
# X11
https://docs.freebsd.org/en/books/handbook/x11/
Don't forget to start `tmux`:
```sh
tmux
```
Add `moni` to the `video` group:
```sh
pw groupmod video -m moni
```
And then install, but don't forget to read the messages when the install is complete! Scroll up with tmux
```sh
pkg install xorg
```
This will improve mnuse and touchscreen support:
```sh
sysctl kern.evdev.rcpt_mask=6
```
And add this to `/etc/sysctl.conf` to persist it:
```sh
kern.evdev.rcpt_mask=6
```
# Amd
```sh
pkg install drm-kmod
```
```sh
sysrc kld_list+=amdgpu
```
# Kde
```sh
pkg install kde5
```
```sh
sysrc dbus_enable="YES"
```
```sh
sysctl net.local.stream.recvspace=65536
sysctl net.local.stream.sendspace=65536
```
```sh
pkg install sddm
sysrc sddm_enable="YES"
```
# Fonts
```sh
pkg install urwfonts
```
But you're not done yet, you need to add a conf file:
```sh
nvim /usr/local/etc/X11/xorg.conf.d/90-fonts.conf
```
With the following:
```
Section "Files"
FontPath "/usr/local/share/fonts/urwfonts/"
EndSection
```
# CPU
Too see your CPU 0
```sh
sysctl dev.cpu.0
```
If you don't see a temperature:
```sh
kldload amdtemp
```
Add it to startup:
```sh
sysrc kld_list+=amdtemp
```
# Linux compatibility
```sh
sysrc linux_enable="YES"
```
```sh
service linux start
```
# Final configs
My `/etc/rc.conf`
```
hostname="moni-freebsd"
ifconfig_re0="DHCP"
sshd_enable="YES"
moused_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
kld_list="amdgpu amdtemp"
dbus_enable="YES"
sddm_enable="YES"
linux_enable="YES"
create_args_wlan0="country NL"
wlans_iwlwifi0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
```
My `/etc/sysctl.conf`:
```
#
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#
# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
kern.evdev.rcpt_mask=6
```