-- Leo's gemini proxy

-- Connecting to warp.geminispace.club:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en

Installing FreeBSD 13 with VirtualBox over Windows 10 as Host (Part 3)


> In case you missed the first and the second part below you find the proper links:


↩ Go back to "Part 01"

↩ Go back to "Part 02"


Introduction


The third part is dedicated to the post-installation setup and tuning. This is usually my favorite part because this is the best moment wherein you can funneling, all together, your newer acquired knowledge and achieving what you were not been able to perform during the last installation.


A very well done installation combined with a very well done post-installation setup is a guarantee that your operative system (from now OS) will continue to be snappy and lean for a considerable amount of time, even with a rolling distro.


Regarding the third part, it is ideally divided in further four parts:


Part 1: fix tethering, updating the OS, assigning super power to the default user;

Part 2: tuning the system for VirtualBox;

Part 3: Setting up X11 and XFCE4;

Part 4: Personal tuning.


> Personal tuning are those configurations I consider necessary for tailoring the OS around my needs, skills and knowledge; you may find some tips in what I wrote but I do not expect the very last part being quite "universal".


(RE)BOOT


If you have not already noticed when you finish the installation an entry is created on the left panel of the VirtualBox GUI, from there you can select your VM. If you have already several VMs check for the latest you just created!


[screenshot:01]


> Before to start the VM remember to remove the virtual cd-rom and to deactivate the network interface.


Starting the VM the first time


If you, like me, come from Linux the way to release the encrypted disk and to go to the boot loader is slightly different. A screen text will require you to type in the passphrase. The amount of time to make the disk readable looks like the same as on Linux.


[screenshot:02] "GELI requiring the password to release the encryption"


Post-installation


The post-installation is the necessary passage to make the OS working the way you expect to, in particular FreeBSD does only the bare minimum hence the majority of the settings is up to the user.


The real goal of the first part is to make the default user able to modify the OS without using "su". Below are listed steps that are going to be addressed:


enabling the tethering

changing the repository from "quarterly" to "latest"

updating the entire system

installing "doas" and optionally "Micro"


> Do not forget to log-in as ROOT!


Enabling tethering


During the boot stage you may have noticed the OS was complaining about the lack of the Ethernet interface and of course internet does not work because we deactivate the virtual network interface; this section is about enabling the tethering and use the connection data of your mobile plan.


The first thing to do is to load the right kernel module, since my phone is Android the module is called "urndis", if you use Apple refer the to handbook for the right module.


kldload if_urndis

It is wise to make this module loading permanently at each boot hence it is necessary modifying the "/boot/loader.conf" file:


ee /boot/loader.conf

# Customization
if_urndis_load="YES"

Next step is to modify the "/etc/rc.conf" file, comment the "ifconfig_em0..." line and follow the block text:


ee /etc/rc.conf

# ifconfig_em0="DHCP"
ifconfig_ue0="SYNCDHCP"

> Android tethering devices are always ue#.


Now you can connect your phone, that should be already prepared to use the tethering.


[screenshot:03] "RC.CONF at this stage"


> You may reset the authorization key if the mobile was not recognized and tethering unavailable.


If the device is recognized you should see a output like this one:


ifconfig

ue0: flags=8843<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
     ether 96:ab:2b:97:4e:2a
     nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Now it should be possible using the tethering simply restarting the network service:


service netif restart

Did it work out? ☺


Updating the system


Now that the tethering is working you can update the OS, however I prefer having the system slightly more updated rather than rock solid, especially because this is a Desktop installation, hence I am going to modify the repository from "quarterly" to "latest".


Setup quarterly


mkdir -p /usr/local/etc/pkg/repos
cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf
ee /usr/local/etc/pkg/repos/FreeBSD.conf

Modify from:


quarterly --> latest


Update the repository with:


pkg update -f


Now it is possible update the base system and the third party packages:


freebsd-update fetch

freebsd-update install

pkg update

pkg upgrade

From now on the OS will get only the most updated packages.


Installing DOAS and MICRO


"Doas" and "Micro" are respectively a FreeBSD alternative to "sudo", easier to setup and lesser convoluted than the latter; while the other is a modern, features rich, editor that is just nice and intuitive to use, although "ee" (FreeBSD default editor) is pretty cool as well.


Read more about Micro:


My gemlog about Micro


pkg install doas micro

Setup DOAS


Set-up "doas" is pretty easy, once it is installed it creates a sample file that you can copy and edit it or create a new one:


> I actually copied and edited but for this documentation I decided to put only the relevant content


ee /usr/local/etc/doas.conf


The file is empty just copy inside these block:


# Sample file for doas
# Please see doas.conf manual page for information on setting
# up a doas.conf file.

# Permit members of the wheel group to perform actions as root.
permit :wheel

# Permit user your user to run commands a root user.
permit nopass "YOUR-USER" as root


Where for "YOUR-USER" you must add the user created during the installation. If you noticed has been used the parameter "nopass", that means that when using "doas" password will not request.


If you are curious about the sample file just type:


cat /usr/local/etc/doas.conf.sample

Now you can exit from the session as ROOT and enter as your current user!


X11


A virtual machine can have a graphic session and can act as computer inside another computer. To enable the graphic session you need to install the graphic server, in FreeBSD (as well in Linux) is called "X.ORG" or "X11".


> I noticed that dependencies in FreeBSD are way more generous than in Debian and often a package requires more dependencies than the ones I would expect. I did not dig at all on how to tune this side effect hence I have been installing everything the way it is.


doas pkg install xorg

Kernel mode settings


The handbook suggests to add the Kernel Mode Settings:


doas micro /boot/loader.conf

kern.vty=vt

Fonts Setup


The handbook also suggests to follow the steps below:


doas pkg install urwfonts

TrueType fonts


The handbook section suggest as well a convoluted way to enable TrueType fonts:


Handbook: 5.5. Using Fonts in Xorg


However I did not follow this passage, included the anti-aliasing section, everything looks fine with the defaults.


Xorg.d setup


Rather than create a "xorg.conf: file I followed the latest trend and create a specific configuration file:


doas micro /usr/local/etc/X11/xorg.conf.d/files.conf

Copy and paste this:


Section "Files"
    ModulePath    "/usr/local/lib/xorg/modules"
    FontPath    "/usr/local/share/fonts/100dpi/"
    FontPath    "/usr/local/share/fonts/75dpi/"
    FontPath    "/usr/local/share/fonts/OTF/"
    FontPath    "/usr/local/share/fonts/TTF/"
    FontPath    "/usr/local/share/fonts/Type1/"
    FontPath    "/usr/local/share/fonts/cyrillic/"
    FontPath    "/usr/local/share/fonts/dejavu/"
    FontPath    "/usr/local/share/fonts/encodings/"
    FontPath    "/usr/local/share/fonts/misc/"
    FontPath    "/usr/local/share/fonts/urwfonts/"
EndSection

The basic Xorg configuration has been made!


XFCE4


Since the advent of Gnome 3 my default DE became XFCE. You are free to install any other DE, in this case you should follow the handbook, however XFCE is fast and lightweight (more than MATE) and it is perfect for a virtual machine as well as for any real super computer (actually I use it everywhere).


> Also in this case the amount of dependencies involved is bigger than a Debian installation.


Below the packages I installed to get all the XFCE4 components I like to use and I need:


doas pkg install xfce4 xfce4-goodies xfce4-docklike-plugin xdg-user-dirs galculator

> At the time I did this installation "xfce4-docklike-plugin" was available through the latest repo only.


Enabling XFCE


In order to work properly "dbus" must be enabled:


doas sysrc dbus_enable="YES"

Even though this is not specified in the Handbook I noticed the panel was complaining about missing "/proc"; add this line to "/etc/fstab" as well:


proc           /proc       procfs   rw		0   0

Launching XFCE


To run XFCE4 a "xinitrc" file must be properly setup in the user home:


micro .xinitrc

Copy inside:


#! /bin/sh

exec /usr/local/bin/startxfce4 --with-ck-launch

Make the file executable:


chmod +x .xinitrc

Cool! However it is not time to start XFCE yet!


Virtualbox


In order to take full advantage of VirtualBox the guest additions must be installed and configurations are needed into "/etc/rc.conf":


doas pkg install virtualbox-ose-additions

Modifying "/etc/rc.conf" adding this lines:


vboxguest_enable="YES"
vboxservice_enable="YES"
vboxservice_flags="--disable-timesync"

Even though this is not written in the handbook VirtualBox requires that your user belongs to the "vboxsf" group:


doas pw groupadd vboxsf
doas pw groupmod vboxsf -m YOUR-USER

Last things to do before rebooting


Before to reboot I would like to install some terminal utilities:


doas pkg install mc wget htop

Post XFCE4 installation


Assuming the system has been rebooted in order to make the guest-additions working properly, you have to login into the terminal session as the user you created during the installation time.


At this stage, before to run X, I like to install already some packages:


doas pkg install firefox thunderbird fish gtk-arc-themes papirus-icon-theme aspell en-aspell es-aspell it-aspell terminator

> tips: run midnight commander with mc -u until you change the shell to FISH.


Fish Shell


I have been starting using Fish shell for simply curiosity but eventually I found this interactive shell pretty handful, hence it became my default shell.


Use the command below to change the shell:


chsh -s /usr/local/bin/fish

> Root password is required.


Run X11 + XFCE4


Now you can finally start X.org plus XFCE4:


startx > ~/.xsession.log

The first time you run XFCE4 it will ask about the default appearance you would like to use. I am not going to illustrate this part, if you want learn more about XFCE use the following link:


XFCE4 Website


> I am not going to illustrate this part [...]


Fixing VirtualBox & XFCE4 issues


I can not tell if these are shared issues or not, however there are high probability anyone follow this documentation will step up in one these:


Missing desired resolution.

Weird behavior with Firefox and the scroll wheel.


Missing desired resolution


By default the VBOXDRV driver video offers a good amount of choice but not the one I need. On a 27" monitor with 2K/4K pixel density I found quite comfortable having this resolution for the VM: 1360x768 pixels.


> I found quite comfortable having this resolution for the VM: 1360x768 pixels.


It is possible adding the desired resolution following this procedure:


Generate the "modeline" by using cvt: cvt width height refresh-rate.


cvt 1360 768 60

My output:


# 1360x768 59.80 Hz (CVT) hsync: 47.72 kHz; pclk: 84.75 MHz
Modeline "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync

Create a new entry:


xrandr --newmode "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync

Add the new entry:


xrandr --addmode VGA-0 1360x768_60.00

Now you can select the right solution from the control panel, however this setup will lost the next login.


> This setup will lost the next login.


The majority of the shells, but Fish, can read the ".xprofile" file in your home and automatically adding the custom resolution you made.


be sure to be in the root of your $HOME


cd ~
micro .xprofile

prepare the file with the xrandr commands used before (be sure to use your output):


#! /bin/sh
xrandr --newmode "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync
xrandr --addmode VGA-0 1360x768_60.00

Make the file executable


chmod +x .xprofile

What if...?


> What if your shell ignore the .xprofile file?


In this case you can create an autostart command to run the .xprofile file.


Go to "Menu -> Settings-> Session and Autostart -> Application Autostart" click on the "plus" icon and create a new entry like the screenshot below:


[screenshot:04] ".xprofile autostart entry"


Weird behavior with Firefox and the scroll wheel


This is a very weird and annoying issue and it falls down on those bugs that will be never addressed and resolved. It looks like happens only with Firefox + FreeBSD + VirtualBox, a very unusual combination for which nobody really cares about.


> I recently discovered the same annoying behavior happens also with Virt-Manager, at this point I would say the problem is within the mouse and FreeBSD rather than Firefox.


The bug consists in the behavior of the scroll wheel that once you scroll up alternatively moves the page back and forth in his chronological history.


I tried to change this behavior directly in X but it didn't work out:


cat /usr/local/etc/X11/xorg.conf.d/mouse0-buttons.conf
Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "vboxmouse"
    Option      "Buttons" "7"
    Option      "ButtonMapping" "1 2 3 4 5 6 7 0 0 0 11 12"
EndSection

But it works if you use the "xmodmap" utility, disabling the buttons from 8 to 10:


/usr/local/bin/xmodmap -e "pointer = 1 2 3 4 5 6 7 0 0 0 11 12"

I tried to add this command to Fish but it didn't work out the same, "xmodmap" requires X in order to work, never mind! The easy way to fix this is creating another autostart entry as I showed earlier for the other issue.


Go to "Menu -> Settings-> Session and Autostart -> Application Autostart" click on the "plus" icon and create a new entry like the screenshot below:


[screenshot:05] ".xmodmap autostart entry"


Graphic Stack


I like to have the mythical open-source graphic software always available, unfortunately Trimage is not available on FreeBSD, I will look another time the way to compile it, in the meanwhile:


doas pkg install gimp gimp-data-extras gimp-resynthesizer \
gimp-lqr-plugin gimp-lensfun-plugin gmic-qt-gimp mypaint  \
inkscape scribus gpicview

> Unfortunately I realized that Gimp and or other packages are in a very bad shape, many of those lack a maintainer and are potentially bugged. I wonder how I could improve the adoption of FreeBSD among the open-source designers.


LibreOffice


LibreOffice is the best office suite available on the open-source sphere, even dough for such virtual machine I have been doing a limited use documentation editing, however it is always useful having such tools at your disposal should you ever need it.


First: install LO and the languages you need:


doas pkg install libreoffice en-hunspell es-hunspell it-hunspell

Second: add the following line to the "Files" section of "files.conf" configuration file:


	FontPath "/usr/local/share/fonts/LinLibertineG/"
	FontPath "/usr/local/share/fonts/Liberation/"
	FontPath "/usr/local/share/fonts/GentiumBasic/"
	FontPath "/usr/local/share/fonts/Carlito/"
	FontPath "/usr/local/share/fonts/Caladea/"

It is important to mention that after installing LO you receive this message:


> Users of older versions of X may additionally have to make sure that the freetype module is loaded. Check /var/log/Xorg.0.log for error messages. If freetype is required, add the following line to the "Modules" section of xorg.conf:

>

> Load "freetype"

>

> This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and procfs(5) mounted on /proc.

>

> If you have not done it yet, please do the following:

>

> mount -t fdescfs fdesc /dev/fd

> mount -t procfs proc /proc


Third modify your /etc/fstab as OpenJDK requires:


fdesc	/dev/fd		fdescfs		rw	0	0
proc	/proc		procfs		rw	0	0

> As you noted it is actually needed to add only the "fdesc" line ;)


Cute LibreOffice


Unfortunately there are some quirks. LibreOffice on FreeBSD is only available as QT version since the GTK3 is still considered unstable.


> LibreOffice GTK3 is still considered unstable.


Unfortunately I haven't dug yet about how to fix it and, as a matter of fact, the default QT looks ugly on XFCE. I re-post the same link available on the webography for the lazy people (like me):


LibreOffice Theme fix


From the port it is still possible compiling as GTK3 though.


Gemini stack


This is the section that I need the most, all this documentation is particularly oriented to have my Gemini production environment ready to use; It mainly consists in:


Micro as default editor;

Lagrange & Telescope as main clients;

SSH & Midnight-Commander to transfer files;

WebDav user space connection cause I use it as my capsule draft folder from all my places.


I use also IRC to get in touch with the Gemini Italian Community on Libera.chat#gemini-it, from the repository the following packages are available:


doas pkg install hexchat weechat lagrange amfora irc/py-fishcrypt

Telescope


This my favorite Gemini TUI client! Yuhm, the author of Telescope made a port for FreeBSD 12 once, but this hasn't been ported to 13 yet. Recently Yuhm asked me if I was interested to being the port maintainer for FreeBSD, and I accepted even though I don't think I qualify for such task. Anyway I am not going to talk about any port here, but only how to compile the tarball version on FreeBSD.


> During the time I was writing this documentation was born the desire to learn how to compile and run Telescope inside a FreeBSD Jail.


Check the guide here:


Telescope on FreeBSD 13 Inside a Jail


Compiling Telescope


Compiling Telescope is pretty straightforward, below the commands:


doas pkg install pkg libretls ncurses libevent byacc autotools pkgconf
curl -LO https://github.com/omar-polo/telescope/releases/download/0.5.2/telescope-0.5.2.tar.gz
tar xzvf telescope-0.5.2.tar.gz
cd telescope-0.5.2
./configure CFLAGS='-I /usr/local/include' LDFLAGS='-L /usr/local/lib'
make
doas make install

Check if a new version is available by the way:


Telescope's capsule


WebDav Connection


To work seamlessly on my capsule all my files are stored on a WebDav cloud storage that is provided by my email provider. WebDav is a standard protocol that can be used with the tools available on your OS, although FreeBSD and GNU/Linux offer different solutions, it is still possible connect to a webdav resource with FreeBSD.


FUSE Module


You need the right FUSE module installed, I also added other modules which aren't related but are good to have.


doas pkg install fusefs-libs3 fusefs-ntfs fusefs-webdavfs libfsntfs

Then you need to activate and make the fuse module persistent.


doas sysrc kld_list+=fusefs
doas kldload fusefs

RCLONE


Rclone is actually the utility the will handle the WebDav connection, it works pretty well as DavFS on Linux. It has a robust way to connect to your remote WebDav resource included an encrypted password. The complete guide is available in the webography.


> The complete guide is available in the webography.


Below are a synthetic recap (I actually moved some folders from an installation to another).


doas pkg install rclone
doas mkdir /mnt/drive
doas chown freezer:freezer /mnt/drive
doas sysctl vfs.usermount=1

Wrapping This Up!


This documentation ends here. There is anything more to add, if you have the right to install anything on your computer this documentation will save you a bunch of headaches, otherwise is pretty useless.


My next plan is to recycle an unused board I have to do a local remote connection from your Windows position to this mini-computer. In this case the scenario is the opposite, you do not have any ways to install anything on your computer hence this might be a strategy to overcome this situation while getting the same result as here.


=> /gemlog/ ↩ Go back to "Part 02"


For comments or suggestion write me at:


freezr AT disroot DOT org



↩ go back

-- Response ended

-- Page fetched on Tue May 21 13:34:46 2024