Archive for the ‘Linux’ Category
Creating a systemd service for xscreensaver
First, is to define a systemd service:
$ cat > ~/.config/systemd/user/xscreensaver.service <<EOF
[Unit]
Description=XScreenSaver
After=network.target
[Service]
ExecStart=/usr/bin/xscreensaver -nosplash
Restart=always
RestartSec=3
[Install]
WantedBy=default.target
EOF
Then,
$ systemctl --user enable xscreensaver.service
$ systemctl --user start xscreensaver.service
$ systemctl --user status xscreensaver.service
BTW it could appear to fail at first if the xscreensaver daemon is already running. In that case, do:
$ pkill xscreensaver
Then check the status again, and it should now be active.
$ systemctl –user status xscreensaver.service
Tips to Reduce Laptop Temperature
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.
- lscpu: This command will show detailed information about the central processor in your CPU; it does not have any additional options or functionality.bashCopy code
lscpu
- 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 code
lshw -short
- 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 code
lspci -v | grep "VGA" -A 12
- lsscsi: Shows information about SCSI devices connected to the system.bashCopy code
lsscsi
- 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 code
lsusb
- lsblk: Lists information about partitions on hard drives and other storage devices, including optical drives like DVD or BluRay.bashCopy code
lsblk
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:
- df -H: Displays all system partitions, their mount points, and the available space on each.bashCopy code
df -H
- 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 code
fdisk
- free -m: Shows the amount of installed, free, and used RAM.bashCopy code
free -m
- dmidecode: Differs from the previous commands as it extracts hardware information directly from the DMI tables.bashCopy code
dmidecode
- hdparm: Shows information about SATA devices connected to the system.bashCopy code
hdparm
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/
Fix issue ‘Initiate a full system upgrade. Nothing to do’ on Arch Linux.
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