Tagged: command

Working with rxvt-unicode

I've been using rxvt-unicode (urxvt) since the Openbox days. I like it because it's lightweight and highly configurable. Best of all, it's Desktop Environment independent, unlike Konsole for KDE and GNOME Terminal for GNOME.

When I switched the distro from Slackware to Gentoo on my main workstation, I revisited its configuration and started fiddling. I learned quite a lot of things that I didn't know how to do or cared about back then.

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.

Configuration File

Configuration of urxvt is done through ~/.Xresources. The details of the file can be referenced in Arch wiki. I didn't know this but you can include sub files for different applications in this file, like you'd do in many programming files.# cat ~/.Xresources ========================================== #include ".config/urxvt" #include ".config/xterm" ...But, I have the config only for urxvt so I didn't want to do this.

Fonts

I used to have problems setting fonts properly in urxvt and it was a tedious process. When I updated the file, I logged out and back in to see the changes reflected because I didn't know other ways to let the changes have effect. But it's no more. There is a way to load the file without logging out/in. # xrdb ~/.Xresources

That's it. If there is an error in .Xresources, it'll mention in its output though messages can be sometime cryptic.

Also, there is a way to test if specified font(s) is correct by running the following command: # urxvt -fn "xft:Inconsolata:size=13"

This opens up a new urxvt terminal with specified font type and size. That's how I test a font before I put it in the config file.

That's all!
-gibb

Getting Sound (ALSA) Working on Gentoo

I don't think this is limited to only Gentoo setup, but the sound isn't working after the installation. These are the steps I took to get my sound cards recognized by ALSA and got it working.

I use ALSA instead of PulseAudio with no particular reasonings. Some say ALSA is better or vice-versa, but I'm using it since I'm just used to.

I had a suspicion that the sound might not work after the installation. I ran alsamixer to test if my suspicion was right. Well, there was no alsamixer, so I installed media-sound/alsa-utils.# emerge --ask media-sound/alsa-utils

When alsamixer was executed, it returned the following error message as I suspected.$ alsamixer cannot open mixer: No such file or directory

The system recognizes its hardware and the driver seems to be installed but ALSA didn't see them.# lspci -k | grep -iA2 audio 00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) Subsystem: Hewlett-Packard Company SBx00 Azalia (Intel HDA) Kernel driver in use: snd_hda_intel -- 01:00.1 Audio device: NVIDIA Corporation GF106 High Definition Audio Controller (rev a1) Subsystem: eVga.com. Corp. GeForce GTS 450 Kernel driver in use: snd_hda_intel

But, ALSA didn't seem to recognize those sound cards.# cat /proc/asound/cards --- no soundcards ---

I google'd around and found that the HD-audio component consists of two parts, the driver (which I seem to have installed) and codec from the Linux Kernel site as well as some Gentoo forum posts.# dmsg | grep -i codec [ 1.626139] snd_hda_intel 0000:01:00.1: no codecs found!

Yup, I don't have codecs installed. I google'd again and found that conexant for my audio device. So, I searched that codec name in the kernel config file.# grep -i conexant /usr/src/linux/.config CONFIG_SND_HDA_CODEC_CONEXANT=n

I enabled the kernel options following by ALSA in Gentto Wiki, including SND_HDA_CODEC_CONEXANT, and rebuilt the kernel.# cd /usr/src/linux # make menuconfig # make && make modules_install # make install # shudown -r now

After the reboot, kernel version should be incremented/updated.# uname -v #3 SMP Thu Feb 13 14:46:50 EST

Codecs are now installed.# dmesg | grep -i codec [ 1.254990] snd_hda_codec_realtek hdaudioC0D0: ALC888: SKU not ready 0x411111f0 [ 1.255697] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC888: line_outs=4 (0x14/0x15/0x16/0x17/0x0) type:line [ 1.255879] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.256057] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0) [ 1.256231] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 [ 1.256361] snd_hda_codec_realtek hdaudioC0D0: dig-out=0x11/0x1e [ 1.256491] snd_hda_codec_realtek hdaudioC0D0: inputs: [ 1.256623] snd_hda_codec_realtek hdaudioC0D0: Front Mic=0x19 [ 1.256768] snd_hda_codec_realtek hdaudioC0D0: Rear Mic=0x18 [ 1.256863] snd_hda_codec_realtek hdaudioC0D0: Line=0x1c [ 1.514180] snd_hda_codec_generic hdaudioC1D0: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.514376] snd_hda_codec_generic hdaudioC1D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.514544] snd_hda_codec_generic hdaudioC1D0: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.514727] snd_hda_codec_generic hdaudioC1D0: mono: mono_out=0x0 [ 1.514829] snd_hda_codec_generic hdaudioC1D0: dig-out=0x5/0x0 [ 1.514967] snd_hda_codec_generic hdaudioC1D0: inputs: [ 1.561175] snd_hda_codec_generic hdaudioC1D1: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.561370] snd_hda_codec_generic hdaudioC1D1: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.561554] snd_hda_codec_generic hdaudioC1D1: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.561738] snd_hda_codec_generic hdaudioC1D1: mono: mono_out=0x0 [ 1.561833] snd_hda_codec_generic hdaudioC1D1: dig-out=0x5/0x0 [ 1.561962] snd_hda_codec_generic hdaudioC1D1: inputs: [ 1.600184] snd_hda_codec_generic hdaudioC1D2: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.600378] snd_hda_codec_generic hdaudioC1D2: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.600563] snd_hda_codec_generic hdaudioC1D2: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.600745] snd_hda_codec_generic hdaudioC1D2: mono: mono_out=0x0 [ 1.600882] snd_hda_codec_generic hdaudioC1D2: dig-out=0x5/0x0 [ 1.601018] snd_hda_codec_generic hdaudioC1D2: inputs: [ 1.638124] snd_hda_codec_generic hdaudioC1D3: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line [ 1.638271] snd_hda_codec_generic hdaudioC1D3: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.638411] snd_hda_codec_generic hdaudioC1D3: hp_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 1.638551] snd_hda_codec_generic hdaudioC1D3: mono: mono_out=0x0 [ 1.638690] snd_hda_codec_generic hdaudioC1D3: dig-out=0x5/0x0 [ 1.638822] snd_hda_codec_generic hdaudioC1D3: inputs:

/proc/asound/cards which showed "--- no soundcards ---" now shows found sound cards.# cat /proc/asound/cards 0 [SB ]: HDA-Intel - HDA ATI SB HDA ATI SB at 0xfbff4000 irq 16 1 [NVidia ]: HDA-Intel - HDA NVidia HDA NVidia at 0xfe97c000 irq 19

Yes, ALSA now sees the sound cards. I checked with alsamixer and it seems to be working fine. alsamixer

When I tested with aplay, I heard a noise from my speaker! I now confirmed that the sound is working on my Gentoo.# aplay < /dev/urandom

That's all!
-gibb

Forced Reboot/Shutdown on Linux

In my previous post, I mentioned my old PC that had Slackware Linux on it went haywire because of hardware issues, and I installed Gentoo Linux for experimemts. At the last part of the installation, I couldn't reboot the system with the following error message:# reboot bash: /sbin/shutdown: Input/output error

I searched the Net and they said the error was due to bad blocks or something hard drive related issues. But it's a brand new hard disk and I most likely messed up the installation somewhere. Another quick research showed me ways to reboot/shutdown without the commands or pressing tje button.

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.

To force reboot or shutdown, follow below steps.

Reboot:# echo 1 > /proc/sys/kernel/sysrq # echo b > /proc/sysrq-trigger Forced Shutdown:# echo 1 > /proc/sys/kernel/sysrq # echo o > /proc/sysrq-trigger

That's all!
-gibb

Resetting MariaDB “root” Password on Termux

I just started learning Laravel framework for my self-interest and wanted to play with it on my Galaxy Note 8 since I already had Termux installed on it. A tutorial I found from Google search uses mySQL so I installed MariaDB with the following command:$ pkg install mariadb

The installation was successful, but when I tried to log in as root with no password, it failed with ERROR 1698 (28000): Access denied for user 'root'@'localhost'. I tried various passwords but none was successful. So, I searched for a solution.

Disclaimer: The information described here is from Termux Wiki. This information below is solely used for my purpose and may not be suitable for others.

Post Installation Tasks:

After the first login attempt, I realized that it was not connecting to mysql server because of the following error message:$ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/data/com.termux/files/usr/tmp/mysqld.sock' (2)

Was mysql server not running...? $ ps -aux | grep mysql xxx 8451 0.2 1.4 560836 79496 ? S

It looks to me, it's running fine. Is mysqld.sock file missing from the directory?:$ ls ../usr/tmp/ $

Ok, the directory was empty. So, I manually started mysql daemon with the following command:$ mysqld_safe -u root & [1] 8379 191029 20:48:14 mysqld_safe Logging to '/data/data/com.termux/files/usr/var/lib/mysql/localhost.err'. 191029 20:48:14 mysqld_safe Starting mysqld daemon with databases from /data/data/com.termux/files/usr/var/lib/mysql

After this, mysqld.sock was created.$ ls ../usr/tmp mysqld.sock $

Resetting root Password:

According to the wiki, the mariadb installation initializes the database with 2 all-privilege accounts, root and my Termux local user. With this local user, I can reset the root password. (But is there a point of resetting the root password at this point since my local user also has all privileges?)$ mysql -u $(whoami) Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.4.6-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use mysql; MariaDB [(mysql)]> set password for 'root'@'localhost' = password('YOUR_ROOT_PASSWORD_HERE'); MariaDB [(mysql)]> flush privileges; MariaDB [(mysql)]> quit;

Now, I can log in as root.$ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.4.6-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

That's all!
-gibb

Kernel 4.4.172 on Slackware64 and VirtualBox

In my previous post, I mentioned that I had issues with NVIDIA after updating the kernel to 4.4.172 from Security Advisories. It appears that this kernel update is breaking some applications for many people. For me, it broke NVIDIA video driver and now I found that I can't run VirtualBox.

When I execute the virtualbox command, it complained about vboxdrv not running. Then, when I tried to start vboxdrv, it said vboxdrv not found! # /etc/rc.d/rc.vboxdrv start bash: /etc/rc.d/rc.vboxdrv: No such file or directory

After looking for a solution in linuxquestions.org and other sites, I ended up following the instruction from SlackBlogs.

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.

Download the virtualbox binary:

Download the source binary from VirtualBox site. Choose for All distributions, then execute it as root. The installation will fail but don't worry about it.# sh VirtualBox-6.0.4-128413-Linux_amd64.run ...

Update the source code:

Open the source code for /usr/src/vboxhost-6.0.4/vboxdrv/r0drv/linux/memobj-r0drv-linux.c with your favorite editor, look for below lines and update it with new KERNEL_VERSION(4, 4, 168). There are three locations you'd need to update.# nvim /usr/src/vboxhost-6.0.4/vboxdrv/r0drv/linux/memobj-r0drv-linux.c ... if GET_USER_PAGES_API >= KERNEL_VERSION(4, 9, 0) <-- Change the kernel version to KERNEL_VERSION(4, 4, 168) fWrite ? FOLL_WRITE | /* Write to memory. */ FOLL_FORCE /* force write access. */ : 0, /* Write to memory. */

Restart the setup process:

Now, execute the /sbin/vboxconfig as root to re-start the setup process:# /sbin/vboxconfig vboxdrv.sh: Stopping VirtualBox services. vboxdrv.sh: Starting VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. vboxdrv.sh: Starting VirtualBox services. ... #

Run vboxdrv:

So far so good. It's now the moment of the truth. If I can get vboxdrv running, it's all set:# /etc/rc.d/rc.vboxdrv start Starting VirtualBox kernel modules ...done. #

Hooray! it's working. In fact, I can bring up VirtualBox. All I need to do is to update their Guest Addition images to the latest.

That's all!
-gibb