Tagged: my_thoughts

Updated: X11

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.

X11:

After installing x11-base/xorg-drivers and x11-base/xorg-server, X11 may exit with errors complaining, missing twm, xterm, xclock. When that happens, installing these components will fix the issue and hopefully X11 will start.# emerge --ask twm xterm xclock

That's all!
-gibb

Getting HP Laser Jet Pro 200 color MFP working with Gentoo

Configuring a printer was never successful for me in the past. At one point, I was able to set it up on Slackware but when I did a test print, it came out either skewed or enlarged for some reasons. I couldn't figure out why it behaved that way, so I gave up.

Now, due to the COVID-19 pandemic, my kids are home-schooling and it had become unavoidable that I need to set up a printer on my Gentoo system. After struggling for close to a week, I finally found a way to configure it correctly and was able to print documents. For my future note, I've describe how to set it up on Gentoo.

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.

User and lp Group:

User need to be part of lp group to be able to print. If User needs to edit via cups web interface, he needs to be part of lpadmin. # gpasswd -a [USER] lp # gpasswd -a [USER] lpadmin

Configure cups:

cups need to be re-configed with zeroconf USE flag. # echo "net-print/cups zeroconf" > /etc/portage/package.use/cups # emerge --ask net-print/cups

Install hplip:

There is a Gentoo Wiki in HPLIP. To sum up, net-print/hplip needs to be installed with the snmp, static-ppds, hpijs and scanner USE flags.# echo "net-print/hplip snmp static-ppds hpijs scanner" > /etc/portage/package.use/hplip # emerge --ask net-print/hplip

Copy PPD:

PPD (PostScript Printer Description)is a file that describes the features and capabilities of the target printer. All PPD files are located in /usr/share/HP/ by default. They are gunzip'ed, so it needs to be decompressed and copied to /etc/cups/ppd/.

My printer is HP LaserJet Pro 200 color MFP M276nw. The closest PPD file I can file is hp-laserjet_200_colormfp_m276-ps.ppd.gz and that's the one I'm going to use. # cd /usr/share/ppd/HP/ # gunzip -d /usr/share/ppd/HP/hp-laserjet_200_colormfp_m276-ps.ppd.gz # cp -d hp-laserjet_200_colormfp_m276-ps.ppd /etc/cups/ppd/

Keyserver for gpg keys:

My printer needs a binary plugin for it to work according to HP's site. To install it, hp-plugin needs to be executed as a regular user with the -i option for the interactive mode.

However, it fails with error: Unable to recieve key from keyserver. This issue stumped me for a few days and I was almost about to give up installing the printer. Then I found a solution in a forum where it suggests to update one of python files with hard-coded keyserver name. Once the keyserver name was changed to something working, the installation of binary plugin went successfully.# nvim /usr/share/hplip/base/validation.py ========== ... class GPG_Verification(DigiSign_Verification): def __init__(self, pgp_site = 'pgp.mit.edu', key = 0x...) Change above where it says "pgp.mit.edu" to something working. For me, changing it to "ha.pool.sks-keyservers.net" worked. def __init__(self, pgp_site = 'ha.pool.sks-keyservers.net', key = 0x...) ... $ hp-plugin -i ... Done.

CUPS and HTTP Interface:

I tried many ways to install my printer from hp-setup with GUI and command line options but they all failed at the end, saying something like "No device found that support this feature." or "No installed printers found (or) Invalid printer device selected".

I stumbled again...

Then, I remembered that CUPS has HTTP Interface where you can add and manage printers. I was a bit skeptical about this but tried anyway.

  1. Start CUPS daemon and make it persistent after each reboot:# rc-service cupsd start # rc-update add cupsd default
  2. Go to http://localhost:631/ in a browser
  3. Go to "Administration" and click on "Add Printer"
  4. Choose "HP LaserJet 200 colorMFP M276nw (HP LaserJet 200 colorMFP M276nw)" and continue
  5. Make sure the connection is set to socket://[ip_address]|HP LaserJet 200 colorMFP M276nw and continue again
  6. Choose the correct model and also click on "Choose File" for PPD File
  7. Select the PPD file copied to /etc/cups/ppd/ and click on "Add printer"
  8. Click on "Set Default Options"
  9. Choose "Print Test Page" option from the "Maintenance" menu

If everything goes well, it starts printing a test page. If it fails for some reasons, I'd delete the printer at the step 4 and choose something else and repeat until it works.

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

New: Article about Pulseaudio

Follow the above link to get the sound working from VirtualBox clients.

That's all!
-gibb

Exploring with Gentoo Linux (Part 5)

Part 5 - Let's type in Japanese

To be able to type and read in Japanese, input methods and input method editor (IME) need to be installed. For IME, I choose IBM since I'm used to using it. As for input methods, I tried both ibus-anthy and ibus-mozc and I couldn't get the property dialogue for ibus-mozc up and running, so I decide to continue using ibus-anthy.

Disclaimer:
The information in this site is the result of my researches on 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. # emerge --ask app-i18n/ibus app-i18n/ibus-anthy

Configurations:

Update ~/.xinitrc and include environment variables to set for ibus.

FILE ~/.xinitrc
export XMODIFIERS=@im=ibus export GTK_IM_MODULE=ibus export QT_IM_MODULE=ibus # Use `xim` in case some apps (like Chromium) refuse to work with IBus export GTK_IM_MODULE=xim export QT_IM_MODULE=xim ibus-daemon -drx

Then, 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.

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

Exploring with Gentoo Linux (Part 2)

Part 2 - Configuring Other Applications

Git:

Git is distributed revision control and source code management software. I need to install git first because I have dotfiles and config files for the applications I need. # emerge --ask dev-vcs/git

After the installation, following config settings need to be done at least.$ git config --global user.name "my_username" $ git config --global user.email "my_email"

Then, download the dotfiles from Github.$ cd ~/ $ git clone https://github.com/ubyt3m3/dotfiles.git ... $ ls dotfiles

st:

st is a simpke terminal for X. I use this terminal until I finish setting up urxvt. savedconfig USE flag lets you save a customized configuration file to /etc/portage/savedconfig/x11-terms/st.# echo "x11-terms/st savedconfig" > /etc/portage/package.use/st # emerge --ask x11-terms/st

Rxvt-unicode:

Rxvt-unicode (urxvt) is THE terminal emulator that I must have in my work environment since OpenBox days. It's fast, lean, highly customizable and can display different fonts. I have another post regarding how I customize it.

Gentoo Linux allows you to choose what options to enable or disable using the USE flags. The options I wanted to enable were the followings:

  • 256-color: Enable 256 color support
  • unicode3: Use 21 instead of 16 bits to represent unicode characters
  • xft: Build with support for XFT font renderer (x11-libs/libXft)
  • gdk-pixbuf: Build with support for image loading and manipulation. Need this for image previewing in ranger

There are a few ways to do this in Gentoo. Since I wanted to do per package base, I set it in the /etc/portage/package.use/ directory:# echo "x11-terms/rxvt-unicode 256-color unicode3 xft gdk-pixbuf" > /etc/portage/package.use/rxvt-unicode # emerge --ask x11-terms/rxvt-unicode or set it during the installation:# USE="256-color unicode3 xft gdk-pixbuf" emerge --ask x11-terms/rxvt-unicode

Its config file is ~/.Xresources.

Updated: Updated article about Xresources

Neovim:

Neovim is a fork of Vim that promised to fix issues with Vim and provide a better out-of-the-box experience for Vim users. It also includs a built in terminal emulator.

Installation is simple.# emerge --ask app-editors/neovim

Its configuration file is in ~/.config/nvim/init.vim and I use vim-plug plug-in to handle installation of other plug-ins. Once my init.vim is copied to its config directory, run nvim. It should install defined plug-ins automatically. If it doesn't, go into the Normal/Command mode by hitting Esc. Then type :PlugInstall. This should trigger installation of plug-ins.

PCManFM:

PCManFM is a GUI file manager. It's light weight and has features like displaying mounted drives and dual panes. I don't usually use it but it's good to have as a backup.# emerge --ask x11-misc/pcmanfm

Faenza Icons and gtk2 theme:

Faenza is an icon theme for Gnome. I've looked around and liked it the most. It can be installed from Portage. # emerge --ask x11-themes/faenza-icon-theme

Icons and GTK2 theme can be applied from lxappearance, but it needs to be installed first. # emerge --ask lxde-base/lxappearance

My customized Morning Glory needs to be extracted to ~/.themes/.$ tar -xzvf MorningGlory.tar.gz -C ~/.themes/

Once the icons and theme have been prep'ed, run lxappearance to apply them.

For the theme, click on the Widget tab. Morning Glory should be listed in the left pane.

Icons

For the icon theme, click on the Icon Theme tab, and choose Faenza from the list in the left pane.

Ranger:

Ranger is a text-based file manager. The best feature for me is the vi-style keybinding. # emerge --ask app-misc/ranger

The default directory is ~/.config/ranger/ and you can copy the default configuration files to this directory.$ ranger --copy-config=all

Copied files are the followings:

  • rc.conf - startup commands and key bindings
  • commands.py - commands which are launched with :
  • rifle.conf - applications used when a given type of file is launched.

For image preview, w3m needs to be installed.# emerge --ask www-client/w3m

Then, enable image preview in ranger's config file, ~/.config/ranger/rc.conf.$ nvim ~/.config/ranger/rc.conf ================================== ... set preview_image true ... set preview_images_method urxvt

Cmus:

Cmus is a small, fast and powerful console music player. # emerge --ask media-sound/cmus

TO DOs: set ups

Scrot:

Scrot is a command line screen capture utility.# emerge --ask media-gfx/scrot

Neofetch:

Neofetch is a bash script that displays the system information such as installed OS, kernel version, CPU, memory, etc... next to an ASCII operating system logo.# emerge --ask app-misc/neofetch

Chromium

Chromium is a free and open-source web browser from Google. It features a minimal user interface, powerful web development tools, and a built in task manager. There is a proprietary version of browser called Google Chrome

with more features than Chromium.# emerge --ask www-client/chromium

Be warned: Compiling Chromium can take a significant amount of CPU time and system memory, and it took nearly 7 hours to complete compiling.

Fonts:

I use following fonts for urxvt and i3.

  • Inconsolata
  • Kochi (for Japanese)
  • Font Awesome (for font icons)
  • Deja Vu
# emerge --ask media-fonts/inconsolata # emerge --ask media-fonts/kochi-substitute # emerge --ask media-fonts/fontawesome # emerge --ask media-fonts/dejavu

That's all!
-gibb