AMD Lenovo laptop hangs when using battery
Posted by vostorga - 11/10/24 at 07:10:41 amI have a laptop that ironically, most of the time is connected to power outlet. Recently I started using its battery and noticed when in battery its performance was very poor.
Journal shows the following message:
oct 11 07:08:55 legion /usr/libexec/gdm-x-session[3458]: (II) event5 – MSFT0001:00 06CB:CE2D Touchpad: SYN_DROPPED event – some input events have been lost.
In summary hardware cursor was giving problems, so I enabled software cursor creating the file /etc/X11/xorg.conf.d/20-amdgpu.conf and restarting:
Section “OutputClass”
Identifier “AMD”
MatchDriver “amdgpu”
Driver “amdgpu”
Option “SWCursor” “True”
EndSection
Assigning the priority of services during the boot process
Posted by vostorga - 10/03/21 at 11:03:06 amLinux provides the following choices for Process Scheduling:
- SCHED_FIFO: Static Priority scheduling
- SCHED_RR: round-robin variant of the
SCHED_FIFO
- SCHED_OTHER: default scheduling policy which uses the Completely Fair Scheduler (CFS)
- SCHED_BATCH: for “batch” style execution of processes
- SCHED_IDLE: for running very low priority background jobs
Usually to check and assign policies we use the chrt command, for example:
Checking Current policy of PID 1012:
# chrt -p 1012
pid 1012's current scheduling policy: SCHED_OTHER
pid 1012's current scheduling priority: 0
Assigning Policy FIFO with priority 50 to PID 1012:
#chrt -fifo -p 50 1-12 # chrt -p 1012
pid 1012's current scheduling policy: SCHED_FIFO
pid 1012's current scheduling priority: 50
But if we want a service to always have the same Scheduling policy, we may modify systemd service file as follows:
[Service]
....
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=50
Then reloading daemon (systemctl daemon-reload) and restarting service will show our service with new scheduling.
Redefining CFLAGS in Makefile
Posted by vostorga - 22/04/15 at 04:04:27 pmI am used to the old way of defining CFLAGS in the console when needed but recently in Debian exporting CFLAGS didn’t have the desired effect.
So In case CFLAGS variable for command line and even in makefile doesn’t work for you, this will make the trick in Makefile:
EXTRA_CFLAGS += foo bar baz
Adding a permanent network route in Windows
Posted by vostorga - 30/07/14 at 05:07:26 pmIt’s not that common to add a network route in windows, but if you have more than one network interface and there are many networks hidden over there, you will need to do it
The syntax is quite simple
route -p add the_network mask the_netmask the_gateway metric the_metric
As an example, we will use the following information:
the_network 192.168.254.144
the_netmask 255.255.255.240
the_gateway 192.168.203.158
the_metric 10
And the resulting command is:
route -p add 192.168.254.144 mask 255.255.255.240 192.168.203.158 metric 10
-p means the network will be added permanently in windows registry, if you want to play with this new network until the next reboot, don’t use it.
If you do not what to do with metric , simply use 10
To check the routing table, use the command
route print
Squid 3.3 in Raspbian Wheezy
Posted by vostorga - 28/07/14 at 10:07:15 amI have been playing recently with Squid and “Splash pages”, but this function works fine on Squid 3.2 and later; however Raspbian only offers Squid 3.1.
I looked for a ready to install 3.2+ version in the Webz but didn’t find one, so I backported the Debian Jessie version.
For the lazy ones, here are the links (try them at your own):
libecap2 (This dependency is not available in Wheezy)
libecap2-dev_0.2.0-1_armhf.deb
Then install squid3 (install according to your needs)
squid3-dbg_3.3.8-1.1_armhf.deb
squidclient_3.3.8-1.1_armhf.deb
squid3-common_3.3.8-1.1_all.deb
squid-purge_3.3.8-1.1_armhf.deb
Mounting a partition from a dd image
Posted by vostorga - 12/07/14 at 12:07:43 pmAt some point, everybody may have done a dd image of a USB/SD stick, as the below example shows:
dd if=/dev/sdb of=foo.img
But it is usual that at some point in time we would like to access the information inside the image, doing that is quite easy:
First,you should do a fdisk on the image:
fdisk -l foo.img
Disk foo.img: 7998 MB, 7998537728 bytes, 15622144 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002fc6dDevice Boot Start End Blocks Id System
foo.img1 * 1 15622143 7811071+ c W95 FAT32 (LBA)
Then some maths are needed. The operators are the start of the partition and the sector size in bytes. The operation is simply start * sector size in bytes.
In this particular case the operation is 1 * 512 = 512.
Now that we have the result, that we call the offset. In other words, 512 is the offset where the partition starts in this dd image.
So the command to mount the partition is:
mount -t vfat -o loop,ro,noexec,offset=512 foo.img /mnt/mountpoint
And then we can copy the information from the partition inside!
Seeing what is being written or read in real time in Linux
Posted by vostorga - 09/11/13 at 09:11:02 pmHave you ever wondered which processes/tasks write or read to disk in Linux? Maybe a real time log?
It’s quite simple to enable that feature with the following command:
echo 1 >/proc/sys/vm/block_dump
The output of the command goes to /var/log/messages or /var/log/kernel.log . It depends on the distribution you are using and how your log manager is configured.
Nov 9 21:21:01 hellboy kernel: [140072.428410] bash(31632): READ block 14156776 on md126p4 (8 sectors)
Nov 9 21:21:01 hellboy kernel: [140072.443138] bash(31632): READ block 14156816 on md126p4 (8 sectors)
Nov 9 21:21:57 hellboy kernel: [140127.746763] gnome-shell(5073): WRITE block 120375776 on md126p4 (8 sectors)
Nov 9 21:21:57 hellboy kernel: [140127.765385] gnome-shell(5073): dirtied inode 3627285 (?) on md126p4
Nov 9 21:22:00 hellboy kernel: [140130.602614] nvidia-settings(31743): dirtied inode 689070 (exe) on proc
The output shows the timestamp, the process name, the operation being done (read/write/dirty inode), block or inode number and the device.
Just to take note, a dirty inode is an inode that has had new data written into it but it has not been flushed to disk.
Dropping Linux Memory Cache
Posted by vostorga - 18/03/13 at 04:03:18 pmA Linux server of my own executes from time to time an rsync script, which one it finishes up doing its magic, leaves behind a lot of stuff cached in memory.
In order to “make available” the memory again to other applications, I recommend reading the following as seen on linux-mm.org
Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache…
To use /proc/sys/vm/drop_caches, just echo a number to it.
To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches
To free directory entries and inodes:
# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run “sync” first to flush them out to disk, these drop operations will tend to free more memory.
Purging WINS cache on Windows
Posted by vostorga - 31/08/12 at 12:08:56 pmOn cmd execute:
nbtstat -R
parted: the resulting partition is not properly aligned for best performance
Posted by vostorga - 27/05/12 at 07:05:51 pmRather than explaining the problem the title says, I’ll point you to the link you must read to understand/fix it:
http://blog.aloisiojr.com/?p=28
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.