Tagged: my_thoughts

Exploring with Gentoo Linux (Part 1)

Part 1 - Base System

In my previous post, I mentioned that my 10-year-old PC went haywire and upgraded some components to fix them. One of them was the main hard disk that had Slackware installed. I replaced it with a new SSD disk, hoping to get some speed in processing (my PC was so old that I'm not expecting much of speed boost). Since my primary drive needed a replacement, I had to install new OS on it. I was thinking of putting Slackware as usual but it got me thinking a bit. Its last release was 4 years ago. I love its simplicity and stable build but didn't feel like installing a 4-year-old OS.

Gentoo Linux

I've tried Debian, Arch, and Manjaro Linux before, but I always came back to Slackware before I knew it. While debating whether to put Slackware 14.2 again, I came across with Gentoo Linux. I knew the existance of Gentoo Linux and you'd need to compile every package, like Ports in FreeBSD. Well, I wanted to start a new so I decided to give it a try to see how I'd like it.

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:

I wanted the set up of my work environment be the same as what I had before (See Building My Work Environment (Part 1)), so most of applications that'll be installed will be the same. At any rate, the installation of Gentoo was a bit of trial and error, and it took quite a while to get it installed. I'll leave the steps to its Handbook, but its installation procedure is not a menu driven, like other distos. It involes a lot of typings. It reminded me of the Arch Linux installation.

Even Slackware installation is a console menu based, so that makes a big difference between these two distros. I would think the installation procedure for Gentoo or Arch is more flexible.

Partition/filesystem Schemes:

I have this 256GB SSD as a primary disk and 1TB SATA disk for /home. The SSD disk was brand new so I partitioned it as follows with parted;

PartitionSizeFSDescription
/dev/sda12MiB-BIOS boot partition
/dev/sda2128MiBext2Boot partition
/dev/sda34295MiBSWAPSwap Partition
/dev/sda4239970MiBext4/ Partition
Updated: Updated article about Partition Schemes

For the secondary disk, I converted its partition table to gpt and created one partition for /home.

PartitionSizeFSDescription
/dev/sdb1953868MiBext4/home partition

This below is my /etc/fstab. I have /var/tmp and /var/tmp/portage as tmpfs. I took an advice from Portage TMPDIR on tmpfs in Gentoo wiki.

/dev/sda2/bootext2defaults,noatime0 2
/dev/sda3noneswapsw0 0
/dev/sda4/ext4noatime,errors=remount-ro0 1
/dev/sdb1/homeext4defaults1 2
tmpfs/tmptmpfsnoatime,nodev,nosuid,size=10G0 0
tmpfs/var/tmptmpfsrw,nosuid,noatime,nodev, size=15G,mode=17770 0
tmpfs/var/tmp/portage tmpfsrw,nosuid,noatime,nodev,size=15G, mode=775,uid=portage,gid=portage, x-mount.mkdir=7750 0
Updated: Updated article about /etc/fstab

SSD Optimization:

Some of websites mention the use of discard mount option in fstab, but as SSD from Gentoo wiki and Solid State Drive from Archwiki stated, using the discard mount option is called continuous TRIM and it's not recommended. Instead, it suggests to run fstrim periodically. So, that's what I did using cron.# crontab -e =================================== # Global variables SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # For details see man 5 crontab # Example of job definition: # .---------------- minute (0 - 59) # |  .------------- hour (0 - 23) # |  |  .---------- day of month (1 - 31) # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # |  |  |  |  | # * * * * * user-name command to be executed 15 04 * * 6 /sbin/fstrim /

XDG cache on tmpfs:

Many X Window System programs, such as Chromium, Firefox, etc..., make frequent disk I/O every few seconds to cache. To reduce strains to SSD, the default cache location can be changed to tmpfs. The default cache location is ~/.cache and this is HDD for my case but I sent it to tmpfs anyway.# nvim /etc/profile.d/xdg_cache_home.sh ============================================ if [ $USER ]; then export XDG_CACHE_HOME="/tmp/${USER}/.cache" fi

make.conf:

/etc/portage/make.conf is used to customize the Portage environment for the entire system (not per package or user). The settings defined in this file will be applied to all packages that are being installed (or emerged). So far, these are my custom settings: # cat /etc/portage/make.conf ================== CFLAGS="-march=native -O2 -pipe" ... # The number of parallel make jobs that can be used MAKEOPTS="-j7" # USE flags USE="-emacs -kde -gnome -bluetooth alsa" # Language codes for US English and Japanese L10N="en en-US ja"

X11:

If startx can't be found, it most likely X11 didn't get installed. # emerge --ask x11-base/xorg-server

System Logger:

During the installation, I chose to install system logger (app-admin/sysklogd) and this may display the following messages in console:

sysklogd: /dev/xconsole: No such file or directory

When the message starts to appear, updating its configuration file should solve it. # nvim /etc/syslog.conf ============ ... #daemon.*;mail.*;\ # news.err;\ # *.=debug;*.=info;\ # *.=notice;*.=warn |/dev/xconsole

ALSA Issues:

I have another post with more details about issues with ALSA sound, but to sum it up,I need to enable SND_HDA_CODEC_CONEXANT in the kernel options. The HD-audio component apparently consists of two parts, the driver and codec, and correct options need to be enabled.

eix:

eix is a set of utilities for searching and diffing local ebuild repositories using a binary cache. This is used to audit installed packages for maintenance. Use eix Gentoo wiki for how to set it up. # emerge --ask app-portage/eix

New: Some system utilities are added below.

smartmontools:

smartmontools is a utility to read and monitor the S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) information of ATA/SATA and SCSI/SAS drives. Use Gentoo wiki: smartmontools for how to set it up. # emerge --ask sys-apps/smartmontools

lshw:

lshw is a hardware detection utility to report various hardware components. # emerge --ask sys-apps/lshw

To display connected storage devices, run below command: # lshw -class disk -class storage ========================= ... *-scsi:0 physical id: 1 logical name: scsi0 capabilities: emulated *-disk description: ATA Disk product: Samsung SSD 860 physical id: 0.0.0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: 1B6Q serial: S5GANE0MB00832Y size: 238GiB (256GB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=2d257117-5180-48d2-be63-3222d90a37e9 logicalsectorsize=512 sectorsize=512 ... *-scsi:2 physical id: 3 logical name: scsi2 capabilities: emulated *-disk description: ATA Disk product: WDC WD10EZEX-75W vendor: Western Digital physical id: 0.0.0 bus info: scsi@2:0.0.0 logical name: /dev/sdb version: 7113 serial: WD-WCC6Y4PE55J2 size: 931GiB (1TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=189d3b93-af3e-47e2-8ed2-975eb9ed4ec0 logicalsectorsize=512 sectorsize=4096

Things To Be Installed:

Fonts:
  • font-awesome
  • Kochi (Japanese)
  • Inconsolata

Icons:
  • Faenza

File Manager:
  • pcmanfm
  • ranger

Music:
  • cmus - Console based music player

Terminal:
  • rxvt-unicode

Text Editor:
  • Neovim

Themes:
  • lxappearance - Change GTK based themes
  • nitrogen - Set wallpapers
  • My customized Morning Glory theme

Version Control:
  • git

Virtualization:
  • virtualbox

Web Browser:
  • chromium

Window Manager:
  • i3
  • i3pystatus - Replacement for i3status
  • rofi - Replacement for dmenu

Others:
  • scrot - Command line screen capture
  • neofetch - ASCII art to show logo and system info

That's all!
-gibb

HPE-360z Became Unstable…

Sometime toward the end of 2019, my 10-year-old pc (HP Pavilion Elite HPE-360z), started acting up. Its fan noise went really high time to time, and the system randomly froze up or rebooted automatically. First thing I suspected was the health of hard disks because I noticed that I started seeing a bunch of what looks like kernel messages or kernel panic.

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.

Checking the Hard Disks

First, I ran e2fsck on the suspected device:# e2fsck -p -y -f -v /dev/sda1

It returned with no errors. I also ran the command to check bad blocks on a device:# badblocks -v /dev/sda1 > badsectors.txt

This passed with no bad blocks... Then, I learned about S.M.A.R.T.(Self-Monitoring, Analysis and Reporting Technology). It helps to detect, report and possibly log their health status and works better than the badblocks command on SATA and SCSI devices.

When the smarctrl command was run to view its log, there were errors reported.# smartctl -l error /dev/sda smartctl 7.0 2018-12-30 r4883 [x86_64-linux-4.19.97-gentoo] (local build) Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === SMART Error Log Version: 1 Warning: ATA error count 1800 inconsistent with error log pointer 1 ATA Error Count: 1800 (device log contains only the most recent five errors) CR = Command Register [HEX] FR = Features Register [HEX] SC = Sector Count Register [HEX] SN = Sector Number Register [HEX] CL = Cylinder Low Register [HEX] CH = Cylinder High Register [HEX] DH = Device/Head Register [HEX] DC = Device Command Register [HEX] ER = Error register [HEX] ST = Status register [HEX] Powered_Up_Time is measured from power on, and printed as DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes, SS=sec, and sss=millisec. It "wraps" after 49.710 days. Error 1800 occurred at disk power-on lifetime: 56133 hours (2338 days + 21 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 51 fd 81 f4 2c a0 Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- b0 d4 fd 81 4f c2 a0 00 00:04:40.097 SMART EXECUTE OFF-LINE IMMEDIATE b0 d0 fe 00 4f c2 a0 00 00:04:39.810 SMART READ DATA b0 d8 fe 00 4f c2 a0 00 00:04:39.497 SMART ENABLE OPERATIONS b0 d0 ff 00 4f c2 a0 00 00:04:38.150 SMART READ DATA b0 d8 ff 00 4f c2 a0 00 00:04:37.834 SMART ENABLE OPERATIONS

So, I replaced the bad disk with another one that was laying around, thinking this would solve the issue for the time being. I was wrong...

Issues Not Resolved...

While I was installing Debian 10 on this new disk, the installation still froze up. Uh, oh. That disk certainly had issues but that didn't seem to be the only problem.

Next, I suspected memory modules. I reseated all 4 modules but that didn't help. I then installed memtest86+ and ran it. While it was being executed, I yet noticed that the cpu temperature was sky rocketing. It went as high as over 100F degrees!!! I should have known that the CPU fan was complaining for a while with loud noise.

Really, Really Dusty CPU fan

In the past, I opened HPE-360z time to time and blew dust with compressed air bottle, but I never cleaned the CPU heatsink/fan. Oh boy, I was so surprised to see chunks of dust stuck in the fan and between plates. I couldn't believe how much dust it has collected over the years (the fan on GPU was as dusty as CPU fan as well). I also noticed that CPU was stuck onto its heatsink and I was unable to separate them. During its process, I damaged some pins from CPU... so I decided to upgrade its CPU.

It's Time To Upgrade

Yeah, upgrading 10-year-old PC wasn't that easy to find parts for it. You might think that it's better to buy a new, better system but I felt that I've been with this one for 10 years and maxed out the memory size and all. I couldn't really bring myself to toss it out, just like that.

The highest kind of CPU that my MOBO can take was AMD Phenom II X6 1090T Black Edition according to the HP website and others. Since the old CPU was stuck on its heatsink and couldn't boot it up anymore, I wasn't sure if getting this CPU was an upgrade. Nevertheless, I decided to get this one and another heatsink and fan.

After Upgrading the CPU

I was a bit worried that it wouldn't boot up due to needing the BIOS update, but the system booted up successfully with new CPU and heatsink/fan. Maybe the old CPU was AMD Phenom II 1090T after all.

Now, my PC is working and better than before. No complaining from CPU fan anymore. I still have that bad hard disk and need to do something about it, but that's something to deal with later.

That's all!
-gibb

Welcome 2019, Good-bye 2018!

Happy New Year, everyone!

The year 2018 was misfortune for me. From the beginning of the year, a lot of hardship happened and I just couldn't wait for this year to end as quickly as possible.

Now, the new year has started and I just hope 2019 will be all right.

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