Felipe's Blog

Your go-to source for Linux/Unix-like – tech – engineering.

Archive for the ‘Arch’ Category

Tips to Reduce Laptop Temperature

without comments

The solution is to limit the speed. When we use our laptops disconnected from the power source, the system “changes personality.” Now, the focus is not on providing maximum performance but on obtaining the maximum autonomy from our battery.

To achieve decent autonomy, the CPU speed is limited to the minimum possible, reducing CPU consumption, which, in turn, lowers its temperature and consequently reduces the time the fans need to be active, preserving our precious battery.

If you want to get the most out of your laptop’s battery on GNU/Linux, you can take a look at Slimbook Battery, a program designed by SLIMBOOK to improve the autonomy of their own laptops. It may also work on laptops from other brands, provided they are based on Intel processors.

cpupower allows us to manage our CPU more easily and even automate the parameters we want to use when our system starts.

Installation

For Arch Linux and its derivatives:


sudo pacman -S cpupower

Manual Usage

First, we need to use this command to find out which speeds our CPU accepts:


sudo cpupower frequency-info


This command will give us a result like the following, where we will find the information we need:


sudo cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 800 MHz – 4.50 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 800 MHz and 2.60 GHz.
The governor «powersave» may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 809 MHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes

To limit the maximum frequency of the CPU, you can use this command:


cpupower frequency-set -u 2600MHz

To set the minimum frequency of the CPU, you can use this command:

cpupower frequency-set -d 800MHz


Remember to change the frequency values in the above commands to the desired value. But do not remove the unit (MHz), otherwise, it will not work.

Daemon Configuration

The great advantage of cpupower is that it provides a systemd service that we can configure to start with the system and set the parameters we want at startup, so we don’t have to type any commands every time we turn on the computer.

First, we have to configure the service, for which we need to edit the /etc/default/cpupower file, for example:



sudo nano /etc/default/cpupower


Then, remove the hashtags (#) from the following lines and put the values you want to use. For example, my configuration is as follows:


governor='powersave'
min_freq="800MHz"
max_freq="2.6GHz"


Depending on your CPU, frequency values may be different.

Pay attention to the units used to set the frequency. The file usually includes comments with details about the allowed units.

Finally, activate and start the service to make the changes effective, and these will be applied automatically every time you start the system.


sudo systemctl enable cpupower.service
sudo systemctl start cpupower.service


If you want to disable the cpupower service, you can do it like this:


sudo systemctl disable cpupower.service
sudo systemctl stop cpupower.service


If you have modified the configuration file and want the changes to take effect immediately without restarting:


sudo systemctl restart cpupower.service

Checking Your System:

Here are the commands from the ls family that serve to obtain detailed information about the hardware you have. Their operation is simple, and they obtain information through the identification of each component and the information available on the internet.

  1. lscpu: This command will show detailed information about the central processor in your CPU; it does not have any additional options or functionality.bashCopy codelscpu
  2. lshw -short: This is a general-purpose utility that reports detailed but summarized information about all the hardware installed on the system, such as the processor, RAM, storage, USB drivers, or network adapters.bashCopy codelshw -short
  3. lspci: This command will display a list of all the peripherals connected to the PCI ports on your PC, along with their details. You can filter the results using grep, for example:bashCopy codelspci -v | grep "VGA" -A 12
  4. lsscsi: Shows information about SCSI devices connected to the system.bashCopy codelsscsi
  5. lsusb: Lists all devices connected to USB ports, as well as the USB controllers on the system. This helps you identify working ports and troubleshoot problematic peripherals.bashCopy codelsusb
  6. lsblk: Lists information about partitions on hard drives and other storage devices, including optical drives like DVD or BluRay.bashCopy codelsblk

Additional Commands:

Apart from the ls commands described earlier, there are other very useful commands that provide more information than a simple list of components. They are more precise in showing the exact overall state of the system:

  1. df -H: Displays all system partitions, their mount points, and the available space on each.bashCopy codedf -H
  2. fdisk: Equivalent to Diskpart in Windows, fdisk not only shows information about system partitions and volumes but also allows you to make modifications to them.bashCopy codefdisk
  3. free -m: Shows the amount of installed, free, and used RAM.bashCopy codefree -m
  4. dmidecode: Differs from the previous commands as it extracts hardware information directly from the DMI tables.bashCopy codedmidecode
  5. hdparm: Shows information about SATA devices connected to the system.bashCopy codehdparm

This article has been written based on readings from the websites: https://tecnoysoft.com/2023/03/08/como-reducir-la-temperatura-de-trabajo-de-nuestros-portatiles/ and https://hardzone.es/tutoriales/mantenimiento/informacion-hardware-linux/

Written by Felipe

December 13th, 2023 at 12:08 am

Posted in Arch,Linux

Tagged with , , ,

Fix issue ‘Initiate a full system upgrade. Nothing to do’ on Arch Linux.

without comments

I have experienced recently this, unable to update the whole system:

:: Synchronizing package databases... 
core is up to date extra is up to date 
community is up to date 
multilib is up to date 
archlinuxfr is up to date 
:: Starting full system upgrade... 
there is nothing to do

The main reason for this issue is that the duplicate list is outdated. If you encounter the same problem, your duplicate list may also be outdated.

It’s an online replica list generator that can be employed to generate the latest replica list for Arch Linux.

Once you locate the replica list, you can manually replace the outdated replica list with the newly created one. If you prefer an automated approach, you can use a utility called reflector. It is used to find the latest replica list for your Arch Linux and automatically update the replica list

To fix it? Simple:

sudo pacman -S reflector rsync curl

Use the following commands to back up your existing mirrorlist and update the mirror list:

# Back up the existing mirrorlist 
$ sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak 
# Update the mirrorlist using reflector command 
$ sudo reflector --verbose -l 50 -p http --sort rate --save /etc/pacman.d/mirrorlist

The above command filters the 50 most recently synchronized HTTP servers, sorts them by download speed, and automatically updates the mirrorlist. For more detailed information about Reflector, refer to our previously attached guide.

After updating the mirrorlist, try updating your Arch Linux system using either of the following commands:

# Update the system 
$ sudo pacman -Syu

or

# Force update the system 
$ sudo pacman -Syyu

Written by Felipe

October 3rd, 2023 at 4:46 am

Posted in Arch,Linux

Tagged with , ,

Configure openvpn for protonvpn or any other vpn service on Arch Linux using the Terminal

without comments

Very simple, first need to install openvpn, right

sudo pacman -S openvpn

Now we need to install using yay, two packages that are necessary to configure the whole thing, once we try to connect to a vpn:

One is this,

https://aur.archlinux.org/packages/openvpn-update-resolv-conf-git

yay -S openvpn-update-resolv-conf-git

Why? because otherwise we will get this:

Options error: –up script fails with ‘/etc/openvpn/update-resolv-conf’: No such file or directory (errno=2)
Options error: Please correct this error.
Use –help for more information.

so we need to install the openresolv package.

Then we need to modify or add actually, this lines at the bottom of the file to update the custom script:

sudo nano /etc/openvpn/update-resolv-conf

And we add:

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf


Now we have to consider this:
The update-systemd-resolved custom script
Note: Since systemd 229, systemd-networkd has exposed an API through DBus allowing management of DNS configuration on a per-link basis. Tools such as openresolv may not work reliably when /etc/resolv.conf is managed by systemd-resolved, and will not work at all if using resolve instead of dns in /etc/nsswitch.conf.
The update-systemd-resolved script links OpenVPN with systemd-resolved via DBus to update the DNS records.

Copy the script into /etc/openvpn/scripts and mark as executable (or install openvpn-update-systemd-resolvedAUR) and append the following lines into the OpenVPN client configuration file:

/etc/openvpn/client/client.conf
client
remote example.com 1194 udp

script-security 2
setenv PATH /usr/bin
up /etc/openvpn/scripts/update-systemd-resolved
down /etc/openvpn/scripts/update-systemd-resolved
down-pre
In order to send all DNS traffic through the VPN tunnel and prevent DNS leaks, also add the following line (see [7]):

/etc/openvpn/client/client.conf
dhcp-option DOMAIN-ROUTE .

So, according this documentation that is possible to find on the official website of Arch, we install :

https://aur.archlinux.org/packages/openvpn-update-systemd-resolved

yay -S penvpn-update-systemd-resolved

Now we can connect to prontonvpn using the console:

[felipe@SDFCSC protonvpn]$ sudo openvpn –config us-free-20.protonvpn.net.tcp.ovpn
2023-07-24 22:51:27 DEPRECATED OPTION: –cipher set to ‘AES-256-CBC’ but missing in –data-ciphers (AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305). OpenVPN ignores –cipher for cipher negotiations.
2023-07-24 22:51:27 Note: Kernel support for ovpn-dco missing, disabling data channel offload.
2023-07-24 22:51:27 OpenVPN 2.6.5 [git:makepkg/cbc9e0ce412e7b42+] x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] [DCO] built on Jun 13 2023
2023-07-24 22:51:27 library versions: OpenSSL 3.1.1 30 May 2023, LZO 2.10
2023-07-24 22:51:27 DCO version: N/A
Enter Auth Username: *************************
Enter Auth Password: *********************

NOTE: For protonvpn proper usage we need the openvpn-IKEv2 password and username, you can get it in the dashboard of the protonvpn site.

For any other connection, use the common user and password to enter a vpn server.

[felipe@SDFCSC protonvpn]$ sudo openvpn --config us-free-20.server.net.tcp.ovpn


Written by Felipe

July 25th, 2023 at 12:09 am

Posted in Arch,Linux

Tagged with , , ,