LightDM background image


Recently my old laptop, due to some unknown configuration, it shows a background image in the LightDM login. It is annoying, and it is user specific. Meaning, if I choose another user, the background image will be changed to black background.

Searched for the solution on Internet, most of links are about gsettings, or edit the image in /etc/lightdm/lightdm.conf. But none of the related to my issue.

Finally, I found the solution. The problem is not LightDM itself, but related to AccountsService.

To solve the issue, edit the /var/lib/AccountsService/users/[username], there is a line

[org.freedesktop.DisplayManager.AccountsService]
BackgroundFile='/path/to/custom/image.jpg'

That’s the culprit. Remove or comment out the BackgroundFile, then the problem solved.

Advertisements

Patch Wine and supports both 64-bit and 32-bit


We can build Wine that supports both 64-bit and 32-bit.

The below shows the example that involves patch of a specific Wine version. Sometimes official or latest Wine just doesn’t work. And the patches can be found in the bug report attachment.

Download a patch from Wine bug report, and download the source code. Extract the source

tar xJf wine-4.2.tar.xz
patch -u -p1 < ../swshader_ivb.patch

To build Wine that can work on both 64-bit and 32-bit, we can follow this.

The following is the script to build wine.

#!/bin/bash

srcdir="$(pwd)"
mkdir build-64 build-32

cd "$srcdir/build-64"
../configure --prefix=$HOME/mywines/wine-4.2-sw-blend \
  --libdir=$HOME/mywines/wine-4.2-sw-blend/lib \
  --enable-win64 --with-x
make -j4
cd "$srcdir/build-32"
PKG_CONFIG_PATH=/usr/lib32/pkgconfig ../configure \
  --prefix=$HOME/mywines/wine-4.2-sw-blend \
  --libdir=$HOME/mywines/wine-4.2-sw-blend/lib32 \
  --with-wine64=$HOME/mywines/wines/wine-4.2/build-64 \
  --with-x
make -j4

cd "$srcdir/build-64"
make install
cd "$srcdir/build-32"
make install

Now, you can use the this Wine to run specific game.

A Wine wrapper script can be found here

NVIDIA with Nouveau and Wine


I updated my old laptop HP Pavilion dv3 (2238tx) recently, which was bought in year 2010, installed with Arch Linux.

Because of Linux kernel version, the NVIDIA driver is not officially supported by Arch Linux (detail).

There are two options to resolve this: install (i) Nouveau or (ii) NVIDIA driver from AUR. The former is open source, the latter is closed source from NVIDIA official site. Furthermore, using the latter theoretically allows the usage of CUDA, which is important if I am using it to do some neural networks training.

Now, since this old laptop, 说好不好,说坏不坏, I tried to install games. Unluckily, the Windows 7 (it is dual boot) is 32-bit, which I don’t plan to re-install new version of Windows with 64-bit. So, I am trying to figure out Linux Wine whether it can work or not.

Firstly, I tried PlayOnLinux to install 64-bit Wine. But I found that 64-bit Wine in PlayOnLinux can run only 64-bit programs. Then after some study, I found that Arch Linux official Wine package supports both 64-bit and 32-bit.

So, I wrote a Bash script to do something like PlayOnLinux which can be found here, so that I can isolate the WINEPREFIX for different programs, and allows to use different versions of compiled Wine.

After some trial and errors, I make an almost 9 years old laptop to run a 64-bit game released in 2018, though the performance is not very good.

The followings are the setup/configuration:

  • Nvidia G98M (GeForce G 105M)
  • Nouveau and related packages like “mesa”
  • Wine 4.13
  • VirtualGL (Not sure whether it is required)
  • Winetricks and installed “d3dx9” (Not sure whether this is required)

Chinese (and CJK) fonts


I am using Arch Linux, and recently I found that my fonts are little different after upgrade.

In DBeaver, the monospace font shows this:

This causes the monospace doesn’t follow the same width. And I found that, the default “Monospace” doesn’t use DejaVu Sans Mono anymore after the recent upgrade.

After looking some solutions, I tried edit ~/.conf/fontconfig/fonts.conf according to this this one.

<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>DejaVu Sans Mono</string></edit>
</match>

The above solution solves the monospace in most applications like Mousepad and DBeaver.

But then, I found CJK issue in Mousepad when using monospace font, like this,

The Simplified Chinese font and Traditional Chinese font are different.

If open with “charmap” and choose Monospace font, we can check what are the fonts being rendered, like this

I right-clicked the character, found that two fonts are being used in Monospace for these Chinese characters: Meiryo and KaiTi. Meiryo was installed with “ttf-vista-fonts” package, and KaiTi I installed directly to ~/.local/share/fonts.

After some study, I found that the above fontconfig is not good enough. Lastly, I changed my setting to

<alias>
  <family>sans</family>
  <prefer>
    <family>DejaVu Sans</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>
<alias>
  <family>monospace</family>
  <prefer>
    <family>DejaVu Sans Mono</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>

After saving the changes, the application must be restarted in order to see the effect.

And this finally solved the font issues.

Script to notify myself


Sharing a simple script I recently used. Because recent development, I need to run a build command which needs about 2-3 minutes. I run it in the background so that I can continue my other work.

But switching the window in order to check whether the build is completed, it is frustrating. To make it easy, I wrote the following script,

#!/bin/bash

notify-send -t 1500 -i applications-utilities "$@"
aplay /usr/share/orage/sounds/Knock.wav &> /dev/null

notify-send comes from the libnotify package. By running this command, you will see a popup notification on your desktop.

/usr/share/orage/sounds/Knock.wav comes from orage package. I just simply searched for a wave file that sounds good to me.

So, once I run the command such as,

build_my_project && /path/to/script/notify_me.sh

Once the project is built, my desktop will notify me with popup notification and play a sound.

Med (Linux Memory Editor) 3.0


Med (Linux Memory Editor) 3.0 released.

Recently I did a great revamp. Remove most of the old code which was not rightly designed. And previously I wrote a ByteManager, which I guess it causes a lot of trouble and crash, together with the memory value locking using multi-threading.

As a result, I spent some times to do a revamp. Remove the ByteManager and use the shared_ptr instead. Because C++ doesn’t have garbage collection. It is hardly for this application to manage the dynamically allocated memory, because the scanned address needs to be hold awhile, or stored for saving, or hold for editing. By using shared_ptr, the memory will be freed automatically when it has no reference.

Secondly, I use only one single background thread for memory value locking. (Previously, each value locking will create a background thread.) For the UI component, only a single background thread to refresh the values. This reduces unnecessary race condition and accessing error memory and causes crash.

Furthermore, I wrote an object, namely MemIO, to perform memory read/write. So that the mutex will make sure only one thread can access the process memory at one time.

For the 3.0, I remove the “scan unknown” feature. As it was wrongly implemented and causes a lot of crash. Will re-implement this feature in future.

NVidia and hibernation issue, partially solved


In my previous post, I mentioned about NVidia and xcompmgr, it is not true reason that causes the Chrome not updating the display.

The root cause is partially found. The issue is caused by the optimus laptop (dual graphic card, NVidia with Intel). In unknown conditions, resume from hibernation will cause the Intel graphic card doesn’t work properly. This can be checked by running “glxgears” after resume. You will see the OpenGL fails to refresh on the display.

However, if installed bumblebee, then we can run “optirun glxgears”, and this solves the graphic card issue.

Children process

Now, there is a tricky issue. because I use GNOME-Do, it is not started with “optirun”, as a result, launching the application through GNOME-Do doesn’t use the NVidia graphic card. As a result, I need to quit GNOME-Do and start it with “optirun”. So, all the application launched by GNOME-Do will use the grphic card correctly.

Run with NVidia only

Unfortunately, I experienced failing to start the X window with NVidia graphic card only. And I didn’t disable Intel graphic card, because it becomes a waste for an optimus laptop. As a result, I cannot confirm whether if only using NVidia graphic card, will the display refresh issue exist.

But so far, I use the “optirun” to run the application, if the graphic card fails to refresh the display.