Is it difficult to use the OSS4 sound drivers in TrueNAS?

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
I have (now) allocated the VM some more RAM: 2400MB. When I monitor RAM and SWAP usage it seems that this is enough to boot TrueNAS (and it is set to boot Nextcloud as well). In any case, no SWAP memory is used after a full startup of TrueNAS + Nextcloud. Maybe 4500MB would indeed be a bit tight, I'll allocate 5600MB RAM to the 'real build' just to be sure and then I can check if it's sufficient for all the tasks.
Could you perhaps explain what you are trying to achieve? Because we all believe you that you can bring up and run a VM with less than the required/recommended amount of RAM on a hypervisor that is not production-grade and play around with it. Nobody argues that. But it is meaningless relative to running a NAS and trusting it to keep your data safe. At least that is how I see it. And I really want to understand your line of thinking, besides the technical details.

Thanks!
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
On other thing. ZFS can produce an extreme amount of I/O traffic during scrubs or disk replacement. This stresses the disk I/O sub-system. Less tested disk controllers, (or virtual disk controller software), may exhibit bugs that don't normally occur in general NAS usage. Further, those bugs may not occur during every scrub or disk replacement.

ZFS scrubs are one way ZFS detects block or complete disk failures. We recommend scrubbing pool(s) regularly, like every 2 to 3 weeks. The GUI has a special place to set it up. Both for the boot-pool and any data pool(s).

Most of us are conservative for our TrueNAS because we want reliability and data safety over odd or extremely optimized configurations.
 

Cabanel

Dabbler
Joined
Dec 12, 2022
Messages
15
Oh yes it will. ZFS assumes actual physical control of the drives and requires certainty as to when a piece of data is firmly committed to stable storage. Virtual drives take this certainty away.
Virtual drives are fine for tests and learning to play with the GUI. No real data should ever be trusted to virtual disks. Never ever.
It only takes one crash of the hypervisor with critical data in flight that ZFS trusted was committed to disk but was held in hypervisor cache to loose the pool. ZFS constantly generates and rewrites pool-critical metadata. There is no zfsck. This is not a case of "bad things may happen", this is "bad things WILL happen". 100%, and some more.
I will disable 'use Host I/O Cache' for the AHCI controller .vhd file to be more secure. Then I should be better protected against data loss.

VirtualBox becomes even more interesting with its snapshotting feature, which allow to store the virtualized machine state and restore it quickly. We'll also see how to use multiple snapshot branches to work on different apps on the same machine.
  • Oracle VM VirtualBox can use large image files on a real hard disk and present them to a guest as a virtual hard disk. This is the most common method, described in Section 5.2, “Disk Image Files (VDI, VMDK, VHD, HDD)”.
  • iSCSI storage servers can be attached to Oracle VM VirtualBox. This is described in Section 5.10, “iSCSI Servers”.
  • You can allow a virtual machine to access one of your host disks directly. This is an advanced feature, described in Using a Raw Host Hard Disk From a Guest.
A large part of the data in the cloud is ultimately stored by virtual machines.
It has been shown many times that you can use VirtualBox in production and it sometimes proves to be more stable than commercial options.

Using VirtualBox as a Cloud Computing Server

5 reasons why VirtualBox has a place in the data center

Is it a good idea to Use Virtualbox in production?

Another important advantage is that TrueNAS virtualization on VirtualBox can be an extra layer of security so that the host cannot be directly attacked. Virtual box is considered a safe ground to prevent viruses to cross through the system.

I think the next thing I'm going to do is compare the performance of bhyve with that of VirtualBox and the native performance.

It also seems easy to use FreeBSD as a NAS without having to virtualize TrueNAS:
Building a FreeBSD NAS

It would also be (very) easy to configure all the necessary tools and services on FreeBSD:
..

But this seems a little less safe to me because malware can immediately infect the host. Is that correct?
 

Etorix

Wizard
Joined
Dec 30, 2020
Messages
2,134
5 reasons why VirtualBox has a place in the data center
There's a difference between using VirtualBox "in production" in a data centre and using VirtualBox to host a storage server…:eek:
It also seems easy to use FreeBSD as a NAS without having to virtualize TrueNAS:
This is what I suggested to do. Your clients only access a network share; they don't need an administrative GUI, do they?
But this seems a little less safe to me because malware can immediately infect the host. Is that correct?
Well, it seems that you consider first the risk of a malware attacking your home NAS and the risk of losing your data to a NAS failure is a secondary consideration. I'd rank concerns the other way around—especially if the NAS is behind a firewall.

It also seems obvious that no one or nothing will stop you from virtualising TrueNAS on VirtualBox. Your choice. It's a free country and all that sort of things…
Please report how it goes. (But keep a SAFE backup of your data outside of the NAS. Because it is obvious that we generally anticipate that the ZFS-on-VirtualBox experiment will end in a catastrophic failure sooner rather than later.)
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
When running a production server in a type 2 hypervisor like VirtualBox you are first and foremost relying on the network stack and storage of a desktop host which is not at all suited to running 24x7 and providing a service like this.

If you want to avoid wasting resources, run TrueNAS on the bare metal and use jails and/or VMs to provide additional service to do something with all those CPU cycles.

But you do you - whatever.
 
Joined
Jun 15, 2022
Messages
674
Hello, I've been using FreeBSD as my daily driver on a desktop for several years. I'm pretty good with OSS4 and the sysctl options for 'bitperfect mode' and 'real-time audio' in FreeBSD. I am also good at configuring musicpd. I also have extensive experience with Linux systems and with ALSA, pavucontrol, pulseaudio and PipeWire.

I will be purchasing the following hardware for the NAS:

I wonder if on one of the TrueNAS versions can use the audio drivers from FreeBSD (or Linux)?

As you can see, the hardware I'm going to use has connections for analog audio and it's obviously a huge asset if I can play music and movies directly from the NAS. Is this possible on TrueNAS? If this is not possible or very difficult, I might be better off installing FreeBSD directly and manually configuring it as a NAS.

Regards!
Back to the beginning, why not run a slim Gentoo system that does what you want it to do, the way you want it to do what you want?

By using FreeNAS you're basically taking a Mac truck (a semi) and trying to force it to perform like an SUV. Two totally different things....

Members here really are trying to help you out, at some point in time you may realize just how accurate and well-founded their advice is.

Whatever you choose I wish you the best,
--=Hedge
 
Last edited:

Cabanel

Dabbler
Joined
Dec 12, 2022
Messages
15
I will mostly follow your advice. Most of the storage will be used for running the main services directly on FreeBSD. I can also use a small portion of the storage to run TrueNAS in a VM for easy plugin installation. (For data that is not critical)

I have now also discovered that I find Nextcloud a more convenient means of exchanging data from my FreeBSD desktop to eg my laptop or eg other people's systems than via USB or via magic-wormhole. I will definitely continue to use the TrueNAS VM with Nextcloud, not to store critical data, but to easily exchange data between many different devices. The Nextcloud UI works pretty fast in the end and it reaches the maximum speeds of my network, I have now discovered that.

My problem with Gentoo is mainly that it's meant to compile most packages itself, which isn't really an ecological philosophy. I can also say from experience that the audio stack of windows and Linux is not as good as that of FreeBSD and macOS. I use MX Linux, Void Linux and Clear Linux regularly and every time I play audio I notice that it doesn't sound quite as good as the FreeBSD setup. I always wonder how Linux users don't hear that this sound is (very) unqualitative. And I feel like it's gotten worse than it used to be, maybe because I've gotten used to FreeBSD now.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Why are you planning to run TN CORE at all? TN excels as a storage platform. Running applications is definitely its weakes point and best when you run TN on the bare hardware anyway for storage purposes.

Using plain FreeBSD for storage and a TN VM for applications looks pretty nonsensical to me. If you are experienced enough to set up your own jails, just install iocage or bastille on FreeBSD and go. The experience will be way better than with TN.

This is BTW the reason why people in this thread have been discouraging running on virtualised disk images or type 2 hypervisors. TN is intended for Terabytes of storage. If you do that in the virtualised fashion you first proposed you will lose data. If you manage your storage outside TN then - what's the point of running TN?
 

Cabanel

Dabbler
Joined
Dec 12, 2022
Messages
15
Why are you planning to run TN CORE at all? TN excels as a storage platform. Running applications is definitely its weakes point and best when you run TN on the bare hardware anyway for storage purposes.

Using plain FreeBSD for storage and a TN VM for applications looks pretty nonsensical to me. If you are experienced enough to set up your own jails, just install iocage or bastille on FreeBSD and go. The experience will be way better than with TN.
1. Stability. I'm sure a lot of people are going to say that OMV or Unraid or whatever else is better suited to me. But in reality that is not the case because I attach great importance to stability and robustness. And Linux, which is already better than windows, still has a lot of bugs and it doesn't have an equally good ZFS implementation. And their other file systems have many shortcomings.

2. Installing plugins is plug and play on TrueNAS, I can't imagine how it could be any easier. This is BSD vs Linux again in the end. In Linux you always find that you spend a lot of time setting things up, things that could be made much simpler.
Just take for example the installation of Nextcloud on Ubuntu, the most popular of all Linux systems: https://docs.nextcloud.com/server/latest/admin_manual/installation/example_ubuntu.html
This installation 'could' also be done in one command, right?

If you use Ubuntu for a long time and use FreeBSD for a long time, you will soon find that the administration of systems based on BSD is much smoother. And that Linux systems are still a collection of random components glued together into a whole.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
1. Stability. I'm sure a lot of people are going to say that OMV or Unraid or whatever else is better suited to me. But in reality that is not the case because I attach great importance to stability and robustness. And Linux, which is already better than windows, still has a lot of bugs and it doesn't have an equally good ZFS implementation. And their other file systems have many shortcomings.

...
One thing you may not know, FreeBSD has been using the exact same OpenZFS code base as Linux. FreeBSD dumped their own dedicated code tree for one that is combined from the Linux OpenZFS tree. This has been occuring for perhaps 1 year, (or is it 2 years?).

That said, their are differences between the 2 OSes, so they do have OS specific code paths for some things.

To be clear, FreeBSD wanted to use the same code base as Linux for OpenZFS, because new features were being implemented on Linux first. Thus, FreeBSD would have to port the changes over. Using a combined code tree allows new features and many bug fixes that don't have OS specific impact, to apply to both Linux & FreeBSD with a simple update.

All that said, their does appear to be a quirk, (or some would call it a bug), in which OpenZFS' ARC is not properly managed in Linux, the way it was supposed to be.
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Plugins in TrueNAS CORE are deprecated, many known broken, and generally not recommended. That's why I'm asking. If you want to run applications in jails, you need to roll your own. But then instead of virtualising TN on top of plain FreeBSD, just install iocage and create jails.

Repeating myself: DON'T USE PLUGINS. THEY ARE UNSUPPORTED.

Edit: proof - https://www.truenas.com/community/t...etending-that-core-has-usable-plugins.104355/
 
Last edited:

TDi39

Dabbler
Joined
Nov 28, 2022
Messages
39
TrueNAS is an appliance OS. It is not meant to be modified, have drivers added to it, and is missing lots of the tools one might need in order to manipulate the system to do this. No compilers, no linkers, no include files. If you do try to force the issue, expect your NAS updates/upgrades to break your changes, and the changes may also break your ability to do those updates.

Instead, you need to do something along the lines of a jail or virtual machine where you then make the host hardware available to the jail/virtual machine. Inside those environments, you have a lot more freedom to do as you wish.
Sorry to jump in, I need to decide if to use TrueNAS Core or SCALE, which one would you suggest for Linux VMs that need audio and maybe microphone too?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
@TDi39 please open a new thread for that. Thank you. I'd recommend a Mac an VMware Fusion. Seriously.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Sorry to jump in, I need to decide if to use TrueNAS Core or SCALE, which one would you suggest for Linux VMs that need audio and maybe microphone too?

Bearing in mind that I HAVE NOT TRIED THIS, I would first try passing through a USB audio device (either to a VM or a jail), and if that didn't work, I'd move on to seeing if modern audio devices show up as a separate PCIe device that you can pass thru to a VM.
 

Cabanel

Dabbler
Joined
Dec 12, 2022
Messages
15
All that said, their does appear to be a quirk, (or some would call it a bug), in which OpenZFS' ARC is not properly managed in Linux, the way it was supposed to be.
The implementations of NixOS and Void Linux for ZFS are still acceptable. Ubuntu's isn't really. By that I don't mean that ZFS on Ubuntu is going to fail right away or something like that. I've used it on a USB stick to transfer data between Ubuntu and FreeBSD and it always worked flawlessly.

I read https://news.ycombinator.com/ almost daily and I've heard a lot of people there complaining about Ubuntu's ZFS implementation. That it often happens that you have problems with GRUB after updates and that you have to do workarounds to get ZFS working again. It also has more bugs on Ubuntu than on FreeBSD, not just with the bootloader. ZFS has been the default recommended file system on FreeBSD for 10 years already. So it's bound to feel more like a native experience on FreeBSD. If you want to use ZFS as a storage for containers on Linux, you have to spend hours hunting around for some poorly maintained 3rd party shell scripts or build some tooling yourself. Whereas on FreeBSD all the tooling around Jails is built with ZFS in mind.

If you start using ZFS on Linux, you lose some of the benefits of ZFS, including perhaps the most important: stability and foolproof data protection.

I should also say that yesterday I did a benchmark of Clear Linux and FreeBSD. I've run some CPU benchmarks of CSS, JavaScript, WASM, and HTML5 and my overall conclusion is that they're generally just as fast, with no overall differences greater than 5%. FreeBSD was even slightly faster than Clear Linux in HTML5 and WASM. Clear Linux is the fastest Linux out there.

In terms of IOPS, I must say that FreeBSD has much more IOPS for ZFS than any other Linux system. Obviously Clear Linux doesn't have a decent ZFS implementation, which says enough..

What this means is that with standard Linux systems such as AlmaLinux and Ubuntu you lose an average of around 10% CPU performance and a huge amount of IOPS if you want to use ZFS. FreeBSD is also more stable and robust than Linux.. I don't see the point of Linux honestly.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
ZFS has been the default recommended file system on FreeBSD for 10 years already.

This is categorically false. ZFS on FreeBSD was a crapfest ten years ago, and iXsystems had to do a fair bit of work to help make it a usable and reliable filesystem.

UFS2 (a.k.a. BSD FFS) is the default recommended filesystem for FreeBSD. This is especially true for small footprint systems. ZFS is usable on modern (FreeBSD 12+, I'd say) systems that have more resources, such as maybe a gig or more of memory. This makes it an undesirable and unrecommended filesystem for many virtual machine applications, for example.


The default FreeBSD filesystem is ufs.


Traditionally, the native FreeBSD file system has been the Unix File System UFS which has been modernized as UFS2. Since FreeBSD 7.0, the Z File System (ZFS) is also available as a native file system.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
This is categorically false. ZFS on FreeBSD was a crapfest ten years ago
Guess I was lucky :smile: We have been running ZFS as the default for all storage oriented workloads since FreeBSD 8.0, i.e. 2009/2010-ish. Default for all installations since 10.0, 2014.
 

Cabanel

Dabbler
Joined
Dec 12, 2022
Messages
15
iXsystems had to do a fair bit of work to help make it a usable and reliable filesystem.
I have no knowledge of what iXsystems did so I can't say anything about that. I know that eight years ago we saw posts from Quora asking which is more robust: FreeBSD or Linux. What was then always answered to that question is that XFS and EXT crashed very often at random at that time, and that you had much easier data loss with XFS and EXT on Linux than with ZFS on FreeBSD during power cuts.
UFS2 (a.k.a. BSD FFS) is the default recommended filesystem for FreeBSD.
I think ZFS has been the default choice for the FreeBSD installer for quite some time now. It is correct to say that ZFS is now the default. You are right that this has not been the default for very long, but it has been a popular option for a long time. There are also the performance differences which can sometimes be sizeable depending on the workload. In general tests, ZFS is often faster than UFS in more areas. This does not alter the fact that there are workloads where UFS is faster than ZFS. Netflix still uses UFS.
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Guess I was lucky :smile: We have been running ZFS as the default for all storage oriented workloads since FreeBSD 8.0, i.e. 2009/2010-ish. Default for all installations since 10.0, 2014.

Yes, lots of people have been. But there's a big difference between it being a native filesystem (that'd be FreeBSD 7.0) and it having proven itself stable and robust. One of the previous problems with ZFS was that at various points in the past, there were just a few people working on it on the FreeBSD team; now, the FreeBSD version is ZoL which is being worked on by a much greater number of people. This is more likely to result in better stability.
 
Top