Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, November 19, 2021

Conky : Linux System Monitor Desktop Display

Are there times when you feel your system turns sluggish and you want to quickly check what's causing it? I now find it troublesome to launch top and system monitor one by one to check resource usage on my device, so I installed Conky for a desktop display system monitor. Here's what I see now.

Shows CPU, RAM, swap, network usage and top processes! Now I can Identify possible bottlenecks in a glance.

Check out Conky here https://github.com/brndnmtthws/conky/wiki

Config for the setup, below. Save as ~/.conky.rc

--[[
Conky, a system monitor, based on torsmo

Any original torsmo code is licensed under the BSD license

All code written since the fork of torsmo is licensed under the GPL

Please see COPYING for details

Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2021 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

conky.config = {
    alignment = 'top_right',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'gray',
    default_outline_color = 'gray',
    default_shade_color = 'gray',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'sans:size=10',
    gap_x = 20,
    gap_y = 80,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

conky.text = [[
${color grey}$color $sysname $nodename $kernel $machine
$hr
${color grey}Uptime:$color $uptime
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}File systems: $color ${fs_used /}/${fs_size /} ${fs_bar 6 /}
$hr
CPU1 ${cpu cpu1}% ${alignr}CPU7 ${cpu cpu2}%
${cpubar cpu1 5,100}${alignr}${cpubar cpu2 5,100}
CPU2 ${cpu cpu3}% ${alignr}CPU8 ${cpu cpu4}%
${cpubar cpu3 5,100} ${alignr}${cpubar cpu4 5,100}
$hr
${color grey}Networking:
Up:$color ${upspeedf wlp1s0} ${color grey} ${alignr} Down:$color ${downspeedf wlp1s0}
${upspeedgraph wlp1s0 30,200} ${alignr}${downspeedgraph wlp1s0 30,200}
$hr
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
${color grey}Name              PID     CPU%   MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]

Latest tested to work on Fedora 41 Gnome

Wednesday, December 12, 2018

Ubuntu 16 : Certificate Verify Failed

An application, hosted on an Ubuntu 16 box, calling a URL returned "certificate verify failed".

Checking if the URL is accessible, tested calling it via wget. Got "Unable to locally verify the issuer's authority."

To test URL access and response, use openssl...

# openssl s_client -showcerts -connect <host>:<port>






To install the needed certificate...

# cd /usr/local/share/ca-certificates/


# sudo mkdir <source name>
# sudo chmod 755 <source name>


# cp .crt .


# sudo chmod 644 .crt

# sudo dpkg-reconfigure ca-certificates


select new certificate to allow, then click ok

# sudo update-ca-certificates


Retest URL access and response...








OK.

Monday, July 04, 2016

XPS 13 (9350) - Broadcom BCM4350 - Fedora 23 Upgrade - Linux Kernel 4.5 - WiFi Missing

To make your Broadcom BCM4350 work after upgrading your Fedora 22 to Fedora 23, uninstall broadcom-wl, then restart. Short story below.

Fedora 24 was released a month ago, which means Fedora 22 is losing its support. That pushed me to upgrade my box to the next version, which is Fedora 23, which has 1 more year of support. (I tend to use a version previous the latest release for a bit more stability :D) So, yeah, after that os upgrade, which is now easy via dnf, I started to apply fixes to each issue as they came... and continue to come ;)

One of the issues I got was with my Broadcom BCM4350 wireless. My WiFi just went AWOL while I was fixing another issue. HAHA I've always had issues with Broadcom wireliess on Fedora so it's not really a surprise.

Anyway, i tried my previously noted procedure that worked on Fedora 22 (http://linusramos.blogspot.com/2016/03/xps-13-9350-broadcom-bcm4350-fedora-22.html), but it didn't work. The Broadcom card was not detected as a "network controller" So, I tried to refresh the drivers installed. I removed broadcom-wl and restarted my box. To my surprise, my WiFi worked. Yep, just like that.

The following commands now show...

# lspci -nn -d 14e4: 
3a:00.0 Network controller [0280]: Broadcom Corporation BCM4350 802.11ac Wireless Network Adapter [14e4:43a3] (rev 08)

# lshw -C net
WARNING: you should run this program as super-user.
  *-network                 
       description: Wireless interface
       product: BCM4350 802.11ac Wireless Network Adapter
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:3a:00.0
       logical name: wlp58s0
       version: 08
       serial: 30:52:cb:85:xx:xx
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.35.180.119 firmware=01-e791c176 ip=10.0.xx.xx latency=0 multicast=yes wireless=IEEE 802.11abgn

       resources: irq:283 memory:dc400000-dc407fff memory:dc000000-dc3fffff

Tuesday, June 28, 2016

Fedora 22 : F5 VPN : SELinux

Been trying to install F5 VPN client on my Fedora 22 using Firefox, and have always been stuck on "installing...".

 Tonight, i had no choice but to make it work. So, i tried searching on how to make F5 VPN work on Fedora using Firefox, again. Then I saw this blog post https://bluehatrecord.wordpress.com/2015/06/03/using-the-f5-vpn-client-plugin-in-fedora-22 which says it's an SELinux issue. All there was to do was:

sudo setsebool -P unconfined_mozilla_plugin_transition 0


...and that's it! Wow! Thanks a lot, mate!

Wednesday, June 08, 2016

CentOS : SELinux : Web App Can't Connect to Networked Database

when browsing my newly set-up web apps on CentOS, been getting "Can't connect to database server (13)" even though i can get through using CLI.

yep, it's SELinux' security blocking your web app host from connecting to your network DB.
remember to allow this via...

setsebool -P httpd_can_network_connect_db on


... and don't you ever forget!

Friday, March 18, 2016

XPS 13 (9350) - Broadcom BCM4350 - Fedora 22 - Linux Kernel 4.4

I've had my XPS 13 (9350) for a couple of months now and have had issues with its Broadcom wifi chip. Been sharing my mobile phone's wifi via USB while waiting for kernel 4.4's support. Kernel 4.4 released a couple of weeks ago, but still, i haven't had my wifi work.

the following commands gave the following results:

# lspci -nn -d 14e4:
3a:00.0 Network controller [0280]: Broadcom Corporation BCM4350 802.11ac Wireless Network Adapter [14e4:43a3] (rev 08)

# sudo rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no



#  iwconfig

enp0s20f0u2u2  no wireless extensions.
virbr0-nic  no wireless extensions.
virbr0    no wireless extensions.
lo        no wireless extensions.



# lshw -C net

WARNING: you should run this program as super-user.
  *-network UNCLAIMED     
       description: Network controller
       product: BCM4350 802.11ac Wireless Network Adapter
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:3a:00.0
       version: 08
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list
       configuration: latency=0
       resources: memory:dc400000-dc407fff memory:dc000000-dc3fffff

what i know is that the broadcom wireless chip is detected. the driver doesn't get loaded.

i tried a lot of solutions posted online, mostly for ubuntu and some for archlinux. didn't get anywhere. until now. here's what i did to make it work...

1. removed any bcm driver installed (rpm -qa | grep bcm should show nothing associated to broadcom)

2. removed broadcom-wl and reinstalled broadcom-wl

3. ran # sudo modprobe wl

4. ran # sudo modprobe brcmfmac

whew! now, i can use my mobile phone away from my xps ;D

ps. to make sure your wifi works on boot, make sure brcmfmac is not in /usr/lib/modprobe.d/broadcom-wl-blacklist.conf

Wednesday, March 16, 2016

linux : ssh using identity file

1. generate ssh key on your target destination
  log in on your target destination computer and generate ssh keys:
   # ssh-keygen -t rsa

2. authorize generated key on your target destination
   append generated key to authorized keys:
   # cat id_rsa.pub >> authorized_keys

3. test connection using identity file
  copy identity file id_rsa to the computer where you'll connect from, then try connecting using that file
   # ssh -i id_rsa <user>@<destination ip/domain name>

Friday, January 09, 2015

linux grub: change default

ever wanted to change your default boot selection in grub? in grub selection, count from the top of the list to the item you want to set as default, starting with the number zero (zero is the first item in the list) so, count 0, 1, 2, 3 ... then, edit your /etc/default/grub and change the grub_default value to the sequence number of the item you just counted save then reboot

Wednesday, July 09, 2014

linux: disk wipe

i'm used to formatting my disks whenever i decommission them. but doing a format only removes the pointers, right? so, here's how to do a disk wipe...

1. boot your box using a bootable linux. i use linux rescue.

2. run fdisk to identify the the device you need to wipe
# fdisk -l

3. use dd to write zeros to the whole disk and overwrite whatever's on your disks. you can write using a different data other than zero (dd if=<data to write> of=<device to write on>)
# dd if=/dev/zero of=/dev/cciss/c0d0p2 bs=4096

4. when there's no space left on device, you're done.

no more recoverable data! hoorah!

Friday, June 20, 2014

fedora 20: linksys ae3000 usb wifi

i have a dual boot win 7 and fedora 20 desktop that uses a linksys ae3000 usb wifi. usb wifi plug-and-plays on win 7 but doesn't on fedora 20.

so, i found this easy installation howto buy a guy named Balaji Ravindran:
src. http://geekniggle.blogspot.com.au/2012/07/cisco-linksys-ae3000-wifi-usb-dongle.html

his steps include just the ff:

1. download and extract source driver
2. install prerequisites
3. edit device file
4. compile and install driver
5. run depmod and modprobe
6. +1 for him! ;D

Wednesday, May 21, 2014

fedora: scan image to text

so... i had a need to convert hard copy of statements sent by slow mail to flat digital text files. i need them in digital form so i can do comparison with another transmitted digital data. and the procedure below works best for me, so far (you'll need imagemagick and tesseract installed):

1. scan hard copy of statement using the largest resolution
2. save as jpeg image file format
3. convert jpeg file to tif using imagemagick
# convert sample_doc.jpg sample_doc.tif
4. do optical character recognition - ocr using tesseract
# tesseract sample_doc.tif sample_doc
5. manually verify ocr output

here's a sample of the scanned image and its digital text file output. compare rightmost values. (i had to censor some details which were accurately converted by tesseract hahaha)


need met ;)

i remember having a pdf-to-text function before but pdftotext of xpdf didn't work with my scanned image file. also, i had problems using lower resolution scanned images.

conversion of jpeg to tif in step 3 is needed because tesseract works with tif files.

Wednesday, April 23, 2014

ubuntu 14: error loading libstdc++.so.5

trying to run an app on my ubuntu 14, i got:

error while loading shared libraries: libstdc++.so.5: cannot open shared object file: no such file or directory

tried locating if i have libstdc++ installed and found out i have libstdc++.so.6


installing libstdc++.so.5 through apt-get won't return any package

to resolve:

1. download libstdc++.so.5 package
(i used http://packages.ubuntu.com/trusty/i386/libstdc++5/download)

2. extract package
(i extracted by doing a right click > extract hahaha, you can use your command line if you want)

3. then, copy extracted so files to your /usr/lib/ directory
(i did # cp libstdc++5_3.3.6-25ubuntu4_i386/usr/lib/i386-linux-gnu/libstdc++.so.5* /usr/lib/)

try running your app again. those 3 steps did it for me :)

linking my libstdc++.so.6 to libstdc++.so.5 didn't work. a function in .so.5 library doesn't exist in .so.6

(src. http://ubuntuforums.org/showthread.php?t=1282957)

Wednesday, November 13, 2013

linux: image orient via imagemagick

to do image rotation based on orientation, on a linux box, using ImageMagick

auto rotate images based on exif orientation values:
/usr/local/bin/convert -auto-orient <source file> <destination file>

yep, that's it.

Thursday, October 03, 2013

kannel on linux: gw_gethostbyname error

newly installed kannel gets:
2013-09-05 11:37:26 [11994] [0] ERROR: Error while gw_gethostbyname occurs.
2013-09-05 11:37:26 [11994] [0] ERROR: System error 1: Operation not permitted
2013-09-05 11:37:26 [11994] [0] ERROR: Can't find out official hostname for this host, using `<hostname>' instead.


to resolve, add hostname in /etc/hosts file.

Friday, September 13, 2013

linux: apache forbidden access to files in symbolic link directory

i have a directory in /home/user/ which i wanted to expose to the web server for web access

but i got a forbidden message everytime i accessed my files in that folder

i read somewhere that you need to have your actual parent directories with an x mode so i checked my /home/user directory
# ll /home/
then added an x mode to it
# chmod +x /home/user
# ll /home/

after which i did the same to its parent /home directory

issue solved ;)

Tuesday, July 30, 2013

linux: upgrade openssh server and client

download and extract latest openssh source file from http://www.openssh.org/
# ./configure
# make
# make install


if you get a zlib too old error while configuring
download and extract latest zlib from http://www.gzip.org/zlib
# ./configure
# make
# make install

then try installing latest openssh again

you'll have to restart your server to reflect updated openssh server

to test client # ssh -v
to test server # telnet 127.0.0.1 22

Tuesday, June 04, 2013

linux: network usage with iftop

been experiencing network slowdown in our LAN these past months and have been guessing what's eating the bandwidth. found a tool named iftop a couple of weeks ago that displays network bandwidth usage. you can get it from: http://pkgs.repoforge.org/iftop/

to launch, run: # iftop
press h to toggle help

here's a sample of what it can show:



now network hugging users can be identified ;)

Monday, May 13, 2013

linux: ssh without password prompt


from source computer:
go to your user (su -l username to load login vars)
ssh-keygen -t rsa
ls ~/.ssh/

from destination computer:
go to your user (su -l username to load login vars)
ssh to source computer to create .ssh directory

from source computer:
scp ~/.ssh/id_rsa.pub linus@x.x.x.x:/home/linus/.ssh/authorized_keys2

then try
ssh to destination computer

password prompt should not appear

:)

Tuesday, April 30, 2013

linux: ftp service setup

first, install vsftpd service on your box.
i use ports 60000 to 60005 as my ftp passive ports.

my vsftpd.conf file contents:
# vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES

xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES

ascii_upload_enable=YES
ascii_download_enable=YES
ls_recurse_enable=NO
listen=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

pasv_enable=YES
pasv_min_port=60000
pasv_max_port=60005


my entries in iptables for my ftp:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 60000:60005 -j ACCEPT

issues experienced:
i got a "500 OOPS: cannot change directory:" error; disabled selinux to address
i got an "ftp: connect: No route to host" whenever i issued an ls command; rechecked my pasv options in my vsftpd.conf file and iptables entries to address

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...