Tagged: my_notes

Creating an ISO image from CD/DVD

I don't make ISO imges from CD or DVD that often but once in a while, I need to do this. So, to remind myself, here is the steps.

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) Use isoinfo to find block/volume sizes

Gentoo Linux does not come with isoinfo, so it needs to be installed.# emerge --ask app-cdr/cdrtools # isoinfo -d -i /dev/sr0 | grep -i -E 'block size|volume size' Logical block size is: 2048 Volume size is: 1327235

isoinfo
  • -d: Print information from the primary volume descriptor (PVD) of the iso9660 image.
  • -i: Specifies the path of the iso9660 image to examine (/dev/sr0).
grep
  • -i: Ignore cases.
  • -E: Interpret 'block size|volume size' as extended regular expressions.

2) Use dd to create an ISO image

# dd if=/dev/sr0 of=<name_of_image>.iso bs=<block_size_from_above> count=<volume_size_from_above> status=progress

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 4)

Part 4 - Virtualization with VirtualBox

Virtualization is one of my must haves when it comes to setting up my main workstation. This is partly because I'd like to test software in guest OS environment before I put it on my main PC, and partly because I'd like to try out different Linux distributions. But the main reason is because I need Window$ OS to access to my company's network. I wish I could use WireGuard or something available for Linux but no...

In the past, many many years ago when VMWare still offered VMWare workstation for free, I used it but this is no longer available. Then, I started using VirtualBox. VirtualBox is one of well known virtualization products for x86 and AMD64 architectures from Oracle (I think it was owned by Sun Microsystems before). It is a free to use and of charges. It's available for Linux, Mac, Solaris, and Window$.

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:

During Gentoo Linux installation, kernel configuration options should have been enabled. For details, take a look at Gentoo Wiki on VirtualBox. # emerge --ask app-emulation/virtualbox

Window$ Guest:

To get the Guest Additions ISO image that contains all necessary Windows guest drivers, install app-emulation/virtualbox-additions. # emerge --ask app-emulation/virtualbox-additions

Gentoo Linux Guest:

As mentioned before,I always try to test software that I need to install on my main PC on the guest OS environment. For that reason, I have Gentoo Linux installed as a guest OS. There may be kernel configuration requied on the Gentoo guest OS. Refer to Gentoo Wiki on Gentoo guests for more details.

Now, guest additions need to be installed on the Gentoo guest OS.# emerge --ask app-emulation/virtualbox-guest-addition

To make it persistently start across reboots, set it as default, as well as the D-bus service.# rc-update add virtualbox-guest-additions default # rc-update add dbus default

User and Group:

A user who runs VirtualBox needs to be a member of vboxusers# gpasswd -a USER_NAME vboxusers

That's all!
-gibb

Exploring with Gentoo Linux (Part 3)

Part 3 - Setting up i3 Window Manager

It's been a couple of years since I started using Tiling Window Manager. I first started with Awesome because it's said that this window manager was somewhat between floating and tiling window manager. It uses Lua to configure the system. It's not the easiest language to learn, but not the most difficult one, either. I liked it but I found a bit cumbersome to arrange windows the way I wanted. So, I migrated over to i3.

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.

I love i3 for its simplicity and text based configuration file. It's fast, powerful and supports multi-monitors well. I don't think I can go back to any other Window Managers anymore.

X11:

Updated: Updated article about X11

To use i3 Window Manager, X Window System needs to be installed. # emerge --ask x11-base/xorg-drivers # emerge --ask x11-base/xorg-server

When the installation is finished, some environment variables will need to re-initialized before continuing. Source the profile with this command:# env-update # source /etc/profile

NVIDIA Driver:

Updated: Updated article about NVIDIA Driver

I have a rather old NVIDIA GeForce GTS 450. For some reasons, the latest drivers from the nvidia website always doesn't work even though it says its compatible with my graphic card. So, I use the one I know it works from before.# sh NVIDIA-Linux-x86_64-390.116.run

i3 Window Manager:

The installation of i3wm is straight forward.# emerge --ask x11-wm/i3

After i3wm is successfully installed, we need a way to execute it and get into i3 window environment. To do this, ~/.xinitrc needs to be created. This is the file when startx and xinit are run and execute it. If this file is not present, startx run the default from /etc/X11/xinit/xinitrc.$ nvim ~/.xinitrc ========== exec i3

Then, we need to update ~/.xinitrc to load ~/.Xresources automatically each time startx is executed so the config is loaded into urxvt.$ nvim ~/.xinitrc ========== [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources exec i3

Rofi:

Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that I've been using since the day I switched to i3 Window Manager.# emerge x11-misc/rofi

i3pystatus:

Installation of i3pystatus is straightforward. To display icons, I'd need Font Awesome installed.# emerge --ask media-fonts/fontawesome

Then, install pip, Python's package management system.# emerge --ask dev-python/pip

Using pip, i3pystatus can be installed. The --user option is needed because I'm installing it as a regular user. This will install it user's $HOME directory ($HOME/.local/): $ pip install --user i3pystatus

As mentioned before, i3pystatus was installed under $HOME/.local/bin/, this needs to be added to $PATH.

Finally, install some modules to display volume, memory usage, disk usage, network status, etc.

Updated: Updated article about Python Modules
$ pip install --user colour \ netifaces \ psutil

New: Pop-up Calendar Applet

gsimplecal:

I wanted a simple calendar applet to pop up when the date/time field in i3pystatus is clicked. What I was looking for is something simple, small, and lightweight calendar app, and narrowed down to Orage and gsimplecal. Orage is from XFCE, known its lightweight desktop environment, and gsimplecal is written in C++ using GTK for OpenBox. Both are simple and lightweight, but I decided to use gsimplecal because I can control its behavior from a config file.$ cd /tmp $ git clone git://github.com/dmedvinsky/gsimplecal.git $ cd gsimplecal $ ./autogen.sh $ ./configure $ make ... Unique.cpp:7:10: fatal error: sys/sysctl.h: No such file or directory 7 | #include <sys/sysctl.h> |

At this point, it failed on my system because sysctl.h is under /usr/include/linux/ directory. To fix this issue, simply edit the affected Unique.cpp under gsimplecal/src/ directory.

After correcting the path for the header file, re-run the make command and continue installing the app$ make $ make install

Then create a config file under ~/.config/gsimplecal/ and enter the following config values:$ mkdir ~/.config/gsimplecal $ cd ~/.config/gsimplecal/ $ nvim config ================== show_calendar = 1 show_timezones = 1 mark_today = 1 show_week_numbers = 1 close_on_unfocus = 0 external_viewer = sunbird \-showdate "%Y\-%m\-%d" clock_format = %a %d %b %H:%M force_lang = en_US.utf8 mainwindow_decorated = 0 mainwindow_keep_above = 1 mainwindow_sticky = 0 mainwindow_skip_taskbar = 1 mainwindow_resizable = 0 mainwindow_position = none mainwindow_xoffset = 1690 mainwindow_yoffset = 845 clock_label = Local clock_tz = clock_label = Tokyo clock_tz = :Asia/Tokyo clock_label = Taiwan clock_tz = :Asia/Taipei

The last step is to integrate gsimplecal to i3pystatus.$ nvim ~/.config/i3/pystatusconfig.py ================== ... status.register("clock", format="%b %e (%a) %H:%M %p ", color="#fffff3", interval=1, on_rightclick="gsimplecal", on_leftclick="gsimplecal", ) ...

That's all!
-gibb