Tuesday, June 9, 2020

ipfire and Raspberry Pi 3+

I have recently tried out ipfire on my Raspberry Pi 3+, and here are few things may worth to note down.

1) Set SERIAL-CONSOLE=ON to OFF if you are using HDMI output.

2) On-board Ethernet port is known as usb: Standard Microsystems Corp. SMSC95. And the wireless/WiFi is known as sdio: brcmfmac.  Hence, if you are like myself, who uses the WiFi for WAN and Ethernet for LAN, then usb: Standard Microsystems Corp. SMSC95 should be assigned to GREEN and sdio: brcmfmac for RED.

3) To access the Web Interface, you need to use HTTPS and specify the port number 444, e.g. https://192.168.60.1:444

4) Use the Wifi Client to setup the WiFi WAN

ipFire Wifi Client

4) ipfire supports DNS over TLS (DoT).  When DoT option is used, you need provide hostname.  You can find popular DNS servers and their details at https://wiki.ipfire.org/dns/public-servers

DoT

5) Default firewall setup may block PakFire to connect to remote servers.  When this happens, changing the default outgoing rule from DROP to REJECT may help.

If the firewall behavior operates with an blocked outgoing chain, you need to add rules for downloading packages via port 443 (HTTPS), so that IPFire itself are allowed to download packages and the icmp protocol is able to check if the IPFire server-is-alive. (https://wiki.ipfire.org/configuration/ipfire/pakfire)

Default behavior of (outgoing) firewall in model "blocked"

Personally I think ipfire works much better than OpenWRT on my Raspberry Pi 3+.  With OpenWRT, settings often fail to apply which in turns causes rollback.  ipfire seems not having this issue.  Also, WiFi seems to be much stable too. 

However, I won't say it is better than OpenWRT or vice versa.  There are features offered in one but not available to another.  For example, if you planning to set up VLANs, ipfire may not be the solution for you.  Similar, if you are looking for a strong firewall with features such geo blocking, a better DNS server (unbound vs. dnsmasq), then ipfire may be the solution for you.  It is all boiled down to what you want.


Thursday, May 28, 2020

Linux and SSD

Don't know if you should call this an advantage or a disadvantage. Customizable is a double edge sword.  If you know what you are doing, it allows you to tailor precisely to your liking.  However, if you are like myself, a casual user, I am afraid it is a shortfall.

SSD is a very common component found in computers now, however it still requires quite a bit of efforts to set it up correctly.  If you leave it at the default, you may risk to shorten its lifespan by writing to it excessively.

It is not hard to find an article similar to this one to show your 3 main customizations you need for using a SSD drive.

First, you will get suggested to set noatime to your drive by editing the /etc/fstab.  By default atime, i.e. Access Time is enable, and it gets updated every time a file or directory is accessed.

Access time shows the last time the data from a file or directory was accessed – read by one of the Unix processes directly or through commands and scripts.


Due to its definition, atime attribute must be updated – meaning written to a disk – every time a Unix file is accessed, even if it was just a read operation. (https://www.unixtutorial.org/atime-ctime-mtime-in-unix-filesystems/)

To apply the noatime to your drive, you open the /etc/fstab file with your favourite editor, e.g.
sudo nano /etc/fstab

You look for the line similar to below for your SSD, and add the noatime option to it, e.g.

UUID=xxxxxxx / ext4 noatime,errors=remount-ro 0 1

Second, you will get told to set up a schedule for performing the TRIM operation.

The tutorial mentioned before suggested to create a schedule by

1) Create a folder within the /etc/systemd/system/ for this schedule.


sudo mkdir -v /etc/systemd/system/fstrim.timer.d
2) Create a setting file in the newly created folder.
sudo touch /etc/systemd/system/fstrim.timer.d/override.conf


3) Specify the run time by adding settings similar to the file created in (2).
[Timer]
OnCalendar=
OnCalendar=daily


Third and the last, you will be asked to reduce the usage of swap by adjusting the swappiness.

Linux's inclination to use the swap, is determined by a setting called swappiness. The lower the setting number, the more system load is required before your Linux starts using the swap.

On a scale of 0-100, the default setting is 60. Which is much too high for normal desktop use, and only fit for servers. For SSD's, it's just crazy. (https://easylinuxtipsproject.blogspot.com/p/ssd.html#ID3)
With the default value, your system will start to use swap when 40% of your memory is being used.  As you can see why this is bad for your SSD.  If your system has decent amount of memory, 10 would be more friendly figure to your SSD.

To change the swappiness, you add this line to the /etc/sysctl.conf file if it wasn't there already.

# Sharply reduce the inclination to swap

vm.swappiness=5


I wrote this post as a reminder to myself for my future setup, hence it may not be as details as the other posts online.  However, hopefully this gives you enough pointers to what to look for.


Saturday, May 23, 2020

PowerShell Script for batch WAV/APE to FLAC

This is a script I use for converting any WAV/APE files in a folder to FLAC.

$files = Get-ChildItem -Recurse -path . -filter *.ape
foreach ($file in $files) {
    $path = Split-Path -Path $file.FullName
    $new_name = [IO.Path]::GetFileNameWithoutExtension($file) + ".wav"
  
    $new_name = Join-Path $path $new_name
  
    mac $file.FullName $new_name -d
}

$files = Get-ChildItem -Recurse -path . -filter *.wav
foreach ($file in $files) {
    flac --best $file.FullName
}

Friday, May 8, 2020

JDownloader2 Displays CJK chracters as Squares on Windows

If you found your JDownloader 2 displays CJK characters as squares on Windows, then you may want to give below a try.


Go to Advanced Settings -> Search for "Font" -> Look for LAFSettings: Font Name, and change value from default to Dialog.


Restart JDownloader2, hopeful CJK characters are displaying correctly now.

Thursday, May 7, 2020

Ubuntu 20.04 and Windows shares

If you got this error when you were accessing your Windows share by click on the connecting machine on your file browser, you may want to try to use the direct path instead, i.e. smb://machine name/shared path

Apparently there is a bug in gvfs which causes this issue.

https://askubuntu.com/questions/1179576/ubuntu-18-04-problem-to-connect-to-windows-10-smb-share






Wednesday, May 6, 2020

Open Graphics Drivers

If you want to improve your graphics card performance, you may want to give the Open Graphics Drivers a try using the instructions from this URL.

https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers