Friday, May 20, 2022

Long USB drive unmounting after copying data to it


After copying significant amount of data to a USB drive the data get cached and need to be physically flushed to the drive before unmounting. 
By default, Ubuntu uses 20% of RAM for file caches.

Solution

There are some tunable settings that influence how the Linux kernel deals with the file system cache. 
All of them are connected with dirty data (or dirty memory) - data that is written into the cache but not saved on disk.
  • dirty_ratio - maximum percentage of dirty system memory
  • dirty_bytes - the same as dirty_ratio but specified in bytes
  • dirty_background_ratio - percentage of dirty system memory at which background writeback will start
  • dirty_background_bytes - the same as dirty_background_ratio but specified in bytes
$ sudo bash -c 'echo $((64*1024*1024)) > /proc/sys/vm/dirty_background_bytes'
$ sudo bash -c 'echo $((128*1024*1024)) > /proc/sys/vm/dirty_bytes'
In this case, coping progress shows correct speed, and unmounting takes only several seconds. 
To save this setting after reboot it’s required to add such a line into /etc/sysctl.conf:
vm.dirty_background_bytes = 67108864
vm.dirty_bytes = 134217728
This option is applied to all disks - external and internal ones what can reduce system performance.

Saturday, January 2, 2021

Fixing Watchdog timer infinite boot loop on Arduino Pro Mini (atmega328p 8MHz 3.3V)

Here you can find a detailed explanation of the problem. Unfortunately, the solution provided there works well only for 5V 16MHz configuration. To solve the issue for the 3.3V 8Mhz boards several extra steps are required.

Arduino distro includes precompiled versions of the optiboot bootloader for several most common targets (including atmega328 5V 16MHz). However there is no precompiled binary for the 3.3V 8MHz version.

Monday, October 5, 2020

SSL notes

 Android CA paths

system

/system/etc/security/cacerts

System CA Certificates in Android are stored by the name of their hash, with a ‘0’ as extension.
Rename the CA certificate:
$ MY_CA_CERT=my-ca-cert.pem
$ cp $MY_CA_CERT $(openssl x509 -inform PEM -subject_hash_old -in $MY_CA_CERT | head -1).0

user

/data/misc/keystore/user_0


References:

Tuesday, September 22, 2020

Garmin SubMusic (on Ubuntu 18.04)

  1. Install dependencies
  2. Install Nextcloud
  3. Install Music
  4. Install Ampache
  5. Install Garmin SubMusic

Nextcloud

Reference guide

Nextcloud 19 dependencies:
  • PHP >=7.2
  • MySQL/MariaDB
  • Nginx
Ampache dependencies:
  • PHP >=7.2
  • MySQL/MariaDB
  • Nginx
  • Composer

Thursday, July 2, 2020

Run GUI application from chroot

xhost +local:
sudo chroot /mnt
export DISPLAY=:0
gedit

Wednesday, June 17, 2020

Gedit transparent background

Some gnome applications (usual ones: gedit, gnome-calculator) can suddenly get looking incorrect (transparent background, visual artifacts, etc).

The reason could be a change in:
- Settings => Region & Language => Manage Installed Languages => Keyboard input method system
- Language Support => Keyboard input method system

Solution:

- remove ~/.xinputrc
- reboot