Tagged: Slackware

Kernel 4.4.172 on Slackware64 and NVIDIA

Today, I noticed the kernel update to 4.4.172 from Security Advisories and updated my system. After rebooting the system, it couldn't start my X-Window system! It just failed. From the log file, I was able to determine that there was some kind of incompatibility with current NVIDIA driver.

After much of trial-and-error, I was able to install the correct NVIDIA driver for my system and got X-Window system running again. This is just a note to myself and others who might face the same issues, and hopefully they don't need to go through all the troubles.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

First of all, I just go though the ways to install package updates from the slackware website, just for a formality. The procedure was pretty simple and I followed the instruction in that page (well, most of the part). $ cd /tmp/patches $ wget ftp://ftp.slackware.com/pub/slackware/slackware64-14.2/patches/packages/*.txz # upgradepkg *.txz ... #

Now, download the kernel packages:$ wget ftp://ftp.slackware.com/pub/slackware/slackware64-14.2/patches/packages/linux-4.4.172/*.txz # upgradepkg kernel-*.txz ... # /usr/share/mkinitrd/mkinitrd_command_generator.sh -k 4.4.172 | bash ...

The instruction says to run the lilo command to reinstall lilo:# lilo Fatal: open /boot/vmlinuz-generic=4.4.xx: No such file or directory

Oops, it looks like I do need to update the lilo.conf file to reflect with new updated kernel image and version. To do this, open the /etc/lilo.conf file and point to the right image name and label:# nvim /etc/lilo.conf ... image = /boot/vmlinuz-generic-4.4.xx <-- Change this to /boot/vmlinuz-generic-4.4.172 initrd = /boot/initrd.gz root = /dev/sda2 label = 4.4.xx <-- Change this to 4.4.172 read-only ...

Then, re-run the lilo command:# lilo Added 4.4.172 + * # reboot

After rebooting and loging in, startx failed.

The log, /var/log/Xorg.0.log, indicates something about nvidia driver missing, so I figured there was an incompatibility with the updated kernel. Then, I google'ed for a solution and learned that SlackBuilds.org had NVIDIA driver packages (418.43).

I downloaded and installed. During the installation, it warned that this driver packages were not compatible with my NVIDIA card, GeForce GTS 450, and recommended to use 390.xx. Of course, installation of this packages didn't fix the problem.

Then, I searched the nvidia site for the correct driver for my card and found 390.87. But this driver always failed to build against the kernel 4.4.172. I desperately searched the Net for a solution but couldn't find any. So, I went back to the nvidia site for older drivers to try on. Under the Beta and older version link, I found the newer version 390.116, which was released a few weeks ago. This driver set does support my old card, GeForce GTS 450, so I gave it a shot.# sh NVIDIA-Linux-x86_64-390.116.run ...

The installation went successful without any issues. Moreover, startx was able to bring up the X-Window system!

That's all!
-gibb

Creating ISO images from CD or DVD

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

1. Reading the block size and the volume size:
# isoinfo -d -i /dev/sr0 | grep -i -E 'block size|volume size' Logical block size is: 2048 Volume size is: 327867

2. Running dd with the parameters for block size and volume size: # dd if=/dev/sr0 of=/tmp/test.iso bs= count= status=progress

That's all!
-gibb

Building My Work Environment (Part 6)

Part 6 - Let's type in Japanese

Now, we can view Japanese in terminal, let's try installing some input method framework. The CHANGES_AND_HINTS.TXT for Slackware64 14.2 suggests to use SCIM, but according to Arch wiki, SCIM is a dead project now. So, we'll try installing IBus.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Installation:

Installation of ibus as well as its dependencies and Japanese engine, ibus-anthy, is no difficult tasks. If you are planning to input Japanese characters, you might consider installing ibus-qt as well. They are available from Slackbuilds.org as usual.

Configurations:

Once the installation is done, start the setup program to do some configurations.$ ibus-setup

All I changed was the keyboard shortcuts and input methods. For keyboard shortcuts, I was hoping Alt+Shift would just work but it didn't, so I changed it to Alt+Shift+space.

For input methods, I added Japanese - Anthy to enable Japanese input. You might have noticed that its icon is different from the default one. This is because I replaced its default icon with my own.

The configuration of ibus should be done now. You'll see a small EN icon in its systray. That confirms ibus is running now. Left click on the icon will show you the list available input methods, in this case, English and Japanese - Anthy.

.bashrc:

We need to tell the system that we are using ibus for alternate language inputs after logging out or shutdown. To do this, we update .bashrc and add some environment variables.$ nvim ~/.bashrc ----------------------------------------- ... export GTK_IM_MODULE=ibus export XMODIFIERS=@im=ibus export QT_IM_MODULE=ibus ...

i3/config:

Now, we need to start ibus each time we log into i3 window manager. To do this, we add ibus-autostart to at the end of i3's config file.$ nvim ~/.config/i3/config ----------------------------------------- ... exec --no-startup-id ibus-autostart

Japanese input is enabled and available for terminal as well.

Changing Default Anthy Icon:

I thought the default Anthy icon was not pretty and didn't like it. So, I decided to change it to my own. After searching for the icon in the system, I found it in /usr/share/ibus-anthy/icons/. It's called ibus-anthy.png. I used GIMP to create another icon and replaced it.

That's all!
-gibb

Building My Work Environment (Part 5)

Part 5 - Show Me Japanese in my Terminal

At this moment, any Japanese characters will show up as little rectangle shapes or some gibberish characters. This is, by default, because Slackware uses en_US as its locale. Locale is set using an environment variable, $LANG, and it is set in /etc/profile.d/lang.sh for system wide configuration.

I'd like to be able to read Japanese in terminals for myself, and don't need to apply this for the whole system. All I need to do is to export $LANG in .bashrc.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

The locale for Japanese can be found by running the following command:$ locale -a | grep -i jp ja_JP.eucjp ja_JP.utf8

The Japanese locale for my system is jp_JP.utf8 (or jp_JP.UTF-8). To apply this in my environment, update .bashrc:$ nvim ~/.bashrc ----------------------------------------- export LANG=ja_JP.UTF-8

After this, either logout and back-in or source .bashrc will display Japanese characters properly in terminal.

However, this brings a bit of problem in my status bar. Time/date is displaying in Japanese as well. This is not what I wanted.

To fix this, I forced i3pystatus to use the en_US locale in its configuration file.$ nvim ~/.config/i3/i3pystatusconfig.py ----------------------------------------- from i3pystatus import Status import os # Setting LANG to en_US to avoid # showing dates in Japanese os.environ['LANG'] = 'en_US' ...

After saving the file, $Mod+Shift+r will change date/time in English.

In next article, let's talk about enabling Japanese input.

That's all!
-gibb

Building My Work Environment (Part 3)

Part 3 - Oh, what's that Window Manager?

Openbox used to be my de facto window manager for my systems for years. You can see some of my posts related to Openbox here. I have nothing but praises for its lightweight and solid performance (Not to mention it's highly customizable).

Then, I learned about Tiling window manager by chance. Tiling WM is designed to arrange windows in a way that they don't overlap each other. Also, it supports key-bindings to operate around keystrokes instead of using a mouse. That reminded me of vi/vim editor. Those facts piqued my interest.

I first started using Awesome Window Manager because it was a tiling window manger but also supported the floating option, which somewhat gave me a peace of mind. Awesome wm was highly configurable from a configuration file written in lua language. I quickly got around and configured it the way I wanted. However, a few months after, I noticed some keybindings stopped working and/or didn't behave the ways they should.

Then, I moved onto i3 window manager. It was next logical thing to try this wm as I read so many positive inputs about it. No regrets. It's easier to configure than Awesome wm because its configuration file is plain text, and it just worked. I've been using it a little more than a few months but I don't think I could go back to Awesome wm or stacking/floating window manager like Openbox ever again!

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Installation:

Installation of i3wm isn't that difficult with Slackware. Go to slackbuilds.org, download all dependencies, and install them one by one.... Installation of dependencies ... $ tar -xzvf i3.tar.gz i3/ i3/slack-desc i3/README i3/i3.SlackBuild i3/i3.info i3/doinst.sh i3/xinitrc.i3 $ mv i3-4.15.tar.bz2 i3/ # cd i3/ # ./i3.SlackBuild ... Slackware package /tmp/i3-4.15-x86_64-1_SBo.tgz created. # installpkg /tmp/i3-4.15-x86_64-1_SBo.tgz ... Executing install script for i3-4.15-x86_64-1_SBo.tgz. Package i3-4.15-x86_64-1_SBo.tgz installed.

At the beginning, I referred i3 like vi/vim. It's just like that. If you know right key combinations, your productivity would increase. But if you are not familiar with it, it's just so hard to deal with. In my humble opinion, although its learning curve is steep, it's worth learning how to properly use it.

To set i3 as your default windows manager, you'd need to run xwmconfig. $ xwmconfig

Config File:

i3's config file is located at ~/.config/i3/config, and it's a plain text file. It should be fairly easy to understand because of all the comments there. One thing you do need to remember is to reload the config file with $Mod+Shift+r each time the file has been modified.
=====
~/.config/i3/config
=====

Status Bar:

By default, i3 does not offer a status bar unless you install one. I tried with i3blocks and configured it with mpd/ncmpcpp support and everything I wanted to show in my status bar on my notebook with Debian stretch; however, to install i3blocks on Slackware, you need to go through ridiculous number of dependencies. For that reason, I gave up on installing i3blocks. Instead, I installed i3pystatus. i3pystatus was so easy to set up and manage it because each piece is a module, and it didn't take me long to configure it as I wanted.

Before i3pystatus can properly display, some python modules need to be installed: $ pip3 install --upgrade pip ... $ pip3 install netifaces \ > psutil \ > colour ... $

The i3pystatus version I downloaded from slackbuilds.org is 3.35. I'm not sure if this problem only applies to this version but when memory usage is displayed with {used_mem}, it displays a negative value. After reading up on different forums, I figured out that its source code for mem.py did not support newer version of psutil. Within the code, to get the value of used memory, it was subtracting cached and buffers values from used value. This was ok for psutil version before 4.4.0. With newer psutil (> 4.4.0), getting the used value itself was good enough, I guess.

To prove my point, this is what's going on: $ python3 >>> import psutil >>> psutil.__version__ '5.4.5' >>> mem = psutil.virtual_memory() svmem(total=...) >>> print(mem.used - mem.cached - mem.buffers) <== This is what's done in the code -311427072 <== Gives a negative value >>> print(mem.used) <== For newer psutil version, this is all you need 301985792

Now, we need to edit the source code to take care of newer version for psutil. 1) Change 2nd line from this:from psutil import virtual_memory to: import psutil 2) On line 45 and 46, there is a piece of code to get used memory. That should be changed from:memory_usage = virtual_memory() used = memory_usage.used - memory_usage.cached - memory_usage.buffers to:memory_usage = psutil.virtual_memory() if psutil.version_info < (4, 4, 0): used = memory_usage.used - memory_usage.cached - memory_usage.buffers else: used = memory_usage.used This should take care of displaying a negative value for used memory in i3pystatus.

=====
~/.config/i3/i3pystatusconf.py
=====

Screen Lock:

I use i3lock to lock the screen. It's simple and customizable.

Shutdown, Reboot, and Logout:

The official way of getting out of i3 is to press $Mod+Shift+e simultaneously. This will show a message bar on top of the screen. Then click on yes, exit i3 to exit. I found this step a bit cumbersome. I could type sudo /sbin/shutdown -h now in a terminal but I'd need to open one if I'm in say web browser workspace. So, I created a i3 mode to handle key combinations to logout, lock screen, reboot, or shutdown (referenced Arch Linux Wiki).

For this to work, sudoer needs to be enabled for a regular user to run the shutdown or reboot command.# visudo ------------------------ [user_name] ALL=NOPASSWD: /sbin/shutdown,/sbin/reboot

In next article, let's talk about changing the look and feel of i3 window manager.

That's all!
-gibb