Categories
Linux Networking

Optimize CIFS mounts for slow connections in Linux

With the default settings on mounting CIFS I had the problem while uploading a large file (200 – 300 MB) that my system frozen for some seconds. Additionally progress bars in Midnight Commander for example filled up to 100 % in some milliseconds and then it took 5 till 10 minutes until the copy job was finished.

The reason for this was that the dirty block cache of the Linux Kernel was filled by the copy job and sometimes was also full and could only cleared slowly, because of the slow connection to the server.

You can watch the current state of the dirty_cache with:

watch -n 2 "cat /proc/meminfo | egrep -i 'dirty|write'"

Also you can adjust the dirty_background_bytes and dirty_bytes of the kernel, but these settings are system wide and not only for a mountpoint. So you need more cache for local storage to get things fast and small cache for slow remote operations. But you should check the following settings of your kernel:

  • vm.dirty_background_bytes
  • vm.dirty_bytes
  • vm.dirty_expire_centisecs
  • vm.dirty_writeback_centisecs

There are many different “best values” found on the internet, but it depends. So I will not add more here.

Sometimes I also get some errors (Error 4 and Error 5), I assume due to timeouts or thatever, after the copy job was finished. Also in kernellog the following entries was reported:

CIFS VFS: No writable handles for inode<br>CIFS VFS: cifs_invalidate_mapping: could not invalidate inode

To solve the problem with the cifs mount, one solution is to disable the cache of this mount. You can do it with the mount option cache=none of mount.cifs.

The upload is a little bit slower, but it is stable now.

Categories
Virtualization

running macOS with QEMU

using QEMU / KVM manual

Running macOS not on Apple hardware is quite not easy and full of surprises. A working way is the use of QEMU / KVM on any Linux you like. You will find a detailed howto inclusive needed scripts at foxlet’s github account. This is the recommend solution, if you plan to use it in a complex scenario.

Currently you can install macOS High Sierra (10.13), Mojave (10.14) or Catalina (10.15).

sosumi

A really simple and for most cases sufficient solution is a snap based application named Sosumi. It is based on the scripts of the first named solution. You can easily install it via snap:

snap install sosumi

After that you can simple start it via command:

sosumi

The snap will download all necessary installation media and create a 64 GB disk image file (QCOW2) in your home directory (~/snap/sosumi/common/macos.qcow2). So check if you have enough free space. It will then install macOS catalina.

Categories
Linux

distorted sound in Ubuntu

In some constellations I use Ubuntu with HDMI output. Sometimes I had some problems using sound output via HDMI. These were distorted sound with scratches and echoes. Sometimes it hides after some seconds or minutes and sometimes I had to reboot.

I used then pavucontrol (install via apt install pavucontrol) to check the settings. This application is very nice, because you can see which application is using the sound output and you can adjust the volume per application.

The application showed me multiple processes of speech-dispatcher using my sound card. After i muted these application instances, the distorted sound was gone.

But what is speech-dispatcher? Speech-dispatcher is a server for text to speech. Some applications like Firefox seems to use it. For me I don’t need text to speech, so I uninstalled the package.

apt purge speech-dispatcher

For those who need it, there is also a related issue in Ubuntu’s bug tracker with some alternative solutions or workarounds.