顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2018年7月23日 星期一

[How To] [LXDE] Fix lxrandr not working

[How To] [LXDE] Fix lxrandr not working

in case you switch from traditional harddisk to SSD and your computer boot very fast that makes xrandr run too fast and makes it not work every time. you should

1. Edit the autostart file
    vim ~/.config/autostart/lxrandr-autostart.desktop

2. Add some sleep before xrandr
[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'sleep 2 && xrandr --output VGA1 --mode 1920x1080 --same-as LVDS1 --output LVDS1 --off'
OnlyShowIn=LXDE


3. restart X and done

2015年12月20日 星期日

[How to] Setup Samba in Linux

Let see my setup environment:

Server:
- Arch Linux  4.2.5-1-ARCH
- samba Version 4.3.3

Client:
Same as server

Network Setup:
Internet - Server(192.168.1) - Router(192.168.2) - Clients

= = =
Setup procedure:
1. Installation: (For both server and client)

#pacman -Syu samba

2. Setup config

I have made a config file to share the server /tmp folder and allow only me and home subnet only.

= = =
[global]
   workgroup = WORKGROUP
   server string = Samba Server
   hosts allow = 192.168.1. 127.
   printcap name = /etc/printcap
   load printers = yes
   log file = /var/log/samba/%m.log
   max log size = 50
   security = user
   dns proxy = no
   invalid users = nobody root
   map to guest = Bad User
   max connections = 10
[homes]
   comment = Home Directories
   browseable = no
   writable = yes
[tmp]
   comment = Temporary file space
   path = /tmp
   valid users = your_user
   public = no
   writable = yes

= = =

Configure your user to samba, and enter the user password.
#pdbedit -a -u your_user

3. Run

In server:
#systemctl enable smbd.service

If you also need netbios support:
#systemctl enable nmbd.service 

Server side should be more or less ready and change to Client

Client:

Just test the samba connection to the server

user@localhost:~$ smbclient -L 192.168.1.1 -U your_user
smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it
Enter your_user's password:
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.3]

        Sharename       Type      Comment
        ---------       ----      -------
        tmp             Disk      Temporary file space
        IPC$            IPC       IPC Service (Samba Server)
        your_user       Disk      Home Directories
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.3]

        Server               Comment
        ---------            -------
        LOCALHOST            Samba Server

        Workgroup            Master
        ---------            -------
        WORKGROUP            LOCALHOST



If you see similar output, the connection should be ready and you can mount remote samba drive

#mount -t cifs //LOCALHOST/tmp /mnt -o user=your_user,workgroup=WORKGROUP,ip=192.168.1.1
password:


Nice and Done!!

2015年12月15日 星期二

rsync - a simple backup command

If you want to backup something just use the following command

$rsync -au /source/path/* /dest/path/folder 

In case after some days your source path have new files or some changes, just recall the command and it can simply update the destination folder to sync everything.

2015年10月1日 星期四

How To Create Windows Bootable USB on Linux

You know when working on Linux, there is still some constraint that is not easy to overcome. This time I would like to upgrade BIOS for my old Thinkpad. It seems the best choice with less risk is installing a Windows on another harddrive and upgrade it. But my laptop do not come with a DVD-ROM and also I don't have any external one. So I go for USB solution.

For all Linux bootable iso can be made through command "dd" but it doesn't work for Windows Disc as the MBR is different. So what I do is make use of a tools called "ms-sys"

Software Tools needed
Windows ISO (You should know how to get it)
gparted (partition the usb)
ms-sys

Steps:
1. use gparted to clear all partition on usb drive
2. use gparted to create NTFS partition on USB, set the partition as bootable
3. mount Windows ISO, copy all files from mount point to USB. "sync"
4. Call the magic "sudo ms-sys -7 /dev/sdX" to write the MBR to USB. I used Windows 7 as the example or you may read the help of ms-sys
5. unmount everything
6. Nice and Done and you got a bootable USB

Go Go Flash Bios!!

2015年7月1日 星期三

[How To] identify a ssh bash session in linux

Very simple just edit .bash_profile

= = =
#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc
skip_x="0"

if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
    echo "THIS IS AN SSH SESSION"
    skip_x="1"
fi


#check if x started


ps aux | grep tty |grep startx 2>&1 > /dev/null
if [ "$?" == "0" ]; then
    skip_x="1"
fi

if [ "$skip_x" == "0" ]; then
    exec startx
fi

= = =

2015年6月7日 星期日

[How To] Lenovo Thinkpad run in full speed with battery removed in linux

After using for nearly 9 years (since 2006) of my thinkpad X60 battery. It cannot be charged in a Saturday. As lenovo will limit the CPU speed when the notebook removed the battery. It decrease the performance a lot when battery removed. So for this case, I have searched for a solution.

Let's see my setup:
Lenovo Thinkpad X61 T8300 2.4GHz

How to override it:

When the battery was removed, Lenovo limit the CPU speed in bios, for this case, setting the  scaling_max_freq will not work.

#To see which frequency of the CPU you can set, you may:
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2401000 2400000 2000000 1600000 1200000 800000


#So To override the BIOS limit:
echo 1 > /sys/module/processor/parameters/ignore_ppc

#replace the 2400000 for your max CPU speed
for x in /sys/devices/system/cpu/cpu[0-1]/cpufreq/;do
  echo 2400000 > $x/scaling_max_freq
done



Very nice and done.

Just a reminder that when override the bios limit may harm the mainboard. For this case, it is highly recommand to use i7z or phc-intel to lower the voltage of the processors (I have set it before that). It may have less chance for overloading the mainboard.

Cheers.

= = =
reference:
http://blog.patshead.com/2013/04/my-bios-is-limiting-my-cpu-clock-speed.html

2015年5月19日 星期二

[How to] Block ssh brute-force attack using sshguard in linux


In case your Linux box have provided a ssh function and connect to a public internet IP directly, in most case you will face a lot of brute-force attack. For this case, sshguard can help to lower the rate of the attack.

How it works
For simply, sshguard read logs from sshd and block suspicious attack by iptables.

In order to view if you are being attacked:
$journalctl -axe
...
 5▒▒▒ 19 12:28:10 localhost sshd[22109]: Connection closed by 70.60.248.30 [preauth] <==== Port Scan
 5▒▒▒ 19 12:28:34 localhost sshd[22111]: Did not receive identification string from 195.154.55.58
 5▒▒▒ 19 12:28:35 localhost sshd[22112]: Invalid user ubnt from 195.154.55.58
 5▒▒▒ 19 12:28:35 localhost sshd[22112]: input_userauth_request: invalid user ubnt [preauth]
 5▒▒▒ 19 12:28:36 localhost sshd[22112]: pam_tally(sshd:auth): pam_get_uid; no such user
 5▒▒▒ 19 12:28:36 localhost sshd[22112]: pam_unix(sshd:auth): check pass; user unknown
 5▒▒▒ 19 12:28:36 localhost sshd[22112]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhos
 5▒▒▒ 19 12:28:38 localhost sshd[22112]: Failed password for invalid user ubnt from 195.154.55.58 port 54126 ssh2
 5▒▒▒ 19 12:28:38 localhost sshd[22112]: error: Received disconnect from 195.154.55.58: 3: com.jcraft.jsch.JSchException: Auth
 5▒▒▒ 19 12:28:38 localhost sshd[22112]: Disconnected from 195.154.55.58 [preauth]
 5▒▒▒ 19 12:28:39 localhost sshd[22115]: Invalid user admin from 195.154.55.58
 5▒▒▒ 19 12:28:39 localhost sshd[22115]: input_userauth_request: invalid user admin [preauth]
 5▒▒▒ 19 12:28:40 localhost sshd[22115]: pam_tally(sshd:auth): pam_get_uid; no such user <=== Attack
 5▒▒▒ 19 12:28:40 localhost sshd[22115]: pam_unix(sshd:auth): check pass; user unknown
 5▒▒▒ 19 12:28:40 localhost sshd[22115]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhos
 5▒▒▒ 19 12:28:42 localhost sshd[22115]: Failed password for invalid user admin from 195.154.55.58 port 51840 ssh2
 5▒▒▒ 19 12:28:43 localhost sshd[22115]: error: Received disconnect from 195.154.55.58: 3: com.jcraft.jsch.JSchException: Auth
 5▒▒▒ 19 12:28:43 localhost sshd[22115]: Disconnected from 195.154.55.58 [preauth]
 5▒▒▒ 19 12:28:44 localhost sshd[22117]: pam_tally(sshd:auth): Tally overflowed for user root <=== Attack
 5▒▒▒ 19 12:28:44 localhost sshd[22117]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhos
 5▒▒▒ 19 12:28:46 localhost sshd[22117]: Failed password for root from 195.154.55.58 port 54190 ssh2 <=== Attack

... 

Installation

Very simple
# pacman -S sshguard
# iptables -N sshguard
# iptables -A INPUT -p tcp --dport 22 -j sshguard
# iptables-save > /etc/iptables/iptables.rules

# systemctl start sshguard.service
# systemctl enable sshguard.service


And you may find from the log
$journalctl -axe 
 5▒▒▒ 19 12:28:46 localhost sshguard[26588]: Blocking 195.154.55.58:4 for >630secs: 40 danger in 4 attacks over 12 seconds (all 

Nice and done 

2015年5月2日 星期六

[How to] Fix the kernel module issues for VirtualBox

As some of the linux users may face issues related to kernel modules, just would like to document how I fix the issue

I was face the issue on the log

VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp


To fix it, just load all kernel modules at boot up

# cat /etc/modules-load.d/virtualbox.conf
vboxnetadp
vboxnetflt
vboxpci
vboxdrv





= = =
Nice and Done

2015年4月9日 星期四

[How To] Dump Certificates of ssl servers using OpenSSL

Need not explain much but read the command output.

The chain of certs can be shown on the list that server pass to clients. It can help to troubleshoot the issues related to ssl connection.

Just a note that this is not work for SSH as they are not sharing a similar protocol

= = =

$ openssl s_client -connect www.google.com:443 -showcerts
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
-----BEGIN CERTIFICATE-----
MIIEdjCCA16gAwIBAgIIOPbIrrvyFtIwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
cm5ldCBBdXRob3JpdHkgRzIwHhcNMTUwMzI1MTUyNTE0WhcNMTUwNjIzMDAwMDAw
WjBoMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN
TW91bnRh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1/3/s9+rFfX3AV1BS7ickw3QzNHqzW
d8xvLuSdkCGui0/q+UXX2sGkJET9ZTT9fuy6UGA7zOOCMaAuGtXQaiZMCwo5IRmO
godUOFa70CaggZm9s4Cci0+JzwIBl7T7459NgtZaIvoRj/DVByboBaBFNkfcJmzb
cIDZKTG45MHEWZJNzacNjUg+KPCqf1bTMYKjTxSs1bkYy4cTYrg1NvHv
-----END CERTIFICATE-----
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
-----BEGIN CERTIFICATE-----
MIID8DCCAtigAwIBAgIDAjp2MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTMwNDA1MTUxNTU1WhcNMTYxMjMxMjM1OTU5WjBJMQswCQYDVQQG
EwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzElMCMGA1UEAxMcR29vZ2xlIEludGVy
bmV0IEF1dGhvcml0eSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AJwqBHdc2FCROgajguDYUEi8iT/xGXAaiEZ+4I/F8YnOIe5a/mENtzJEiaB0C1NP
VaTOgmKV7utZX8bhBYASxF6UP7xbSDj0U/ck5vuR6RXEz/RTDfRK/J9U3n2+oGtv
h8DQUB8oMANA2ghzUWx//zo8pzcGjr1LEQTrfSTe5vn8MXH7lNVg8y5Kr0LSy+rE
ahqyzFPdFUuLH8gZYR/Nnag+YyuENWllhMgZxUYi+FOVvuOAShDGKuy6lyARxzmZ
EASg8GF6lSWMTlJ14rbtCMoU/M4iarNOz0YDl5cDfsCx3nuvRTPPuj5xt970JSXC
DTWJnZ37DhF5iR43xa+OcmkCAwEAAaOB5zCB5DAfBgNVHSMEGDAWgBTAephojYn7
qwVkDBF9qn1luMrMTjAdBgNVHQ4EFgQUSt0GFh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IIB
CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9m
OSm9BXiLnTjoBbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIu
T8rxh0PBFpVXLVDviS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6c
JmTM386DGXHKTubU1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmR
Cw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5asz
PeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo4HwMIHtMB8GA1UdIwQYMBaAFEjm
aPkr0rKV10fYIyAQTzOYkJ/UMB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrM
TjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjA6BgNVHR8EMzAxMC+g
LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDBO
BgNVHSAERzBFMEMGBFUdIAAwOzA5BggrBgEFBQcCARYtaHR0cHM6Ly93d3cuZ2Vv
dHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5MA0GCSqGSIb3DQEBBQUAA4GB
AHbhEm5OSxYShjAGsoEIz/AIx8dxfmbuwu3UOx//8PDITtZDOLC5MH0Y0FWDomrL
NhGc6Ehmo21/uBPUR/6LWlxz/K7ZGzIZOKuXNBSqltLroxwUCEm2u+WR74M26x1W
b8ravHNjkOR/ez4iyz0H7V84dJzjA1BOoa+Y7mHyhD8S
-----END CERTIFICATE-----
---
Server certificate
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
issuer=/C=US/O=Google Inc/CN=Google Internet Authority G2
---
No client certificate CA names sent
---
SSL handshake has read 3719 bytes and written 643 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
    Session-ID: 8098FDAE0A745395D661B7F5F23BBFB4E49A6CAE82F85905660C426B5795B4F0
    Session-ID-ctx:
    Master-Key: 4C2D4FADFD3388D40CC20F71C4AB59D27646FB38DB877AFBEB4E5B46F65E167B                                             C222CC7E45CB7E6423F48DA13E156E78
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 100800 (seconds)
    TLS session ticket:
    0000 - 79 21 bf 55 8b b8 bc 78-3f ba ab ce 71 34 8e 4f   y!.U...x?...q4.O
    0010 - a8 13 0d 13 3c cb 66 8b-81 93 9a 46 2f 91 a9 06   ....<.f....F/...
    0020 - d3 6b fa 30 81 2a 5c 08-8a 47 72 1f e1 4f f6 3a   .k.0.*\..Gr..O.:
    0030 - e1 b2 f4 09 8c 7a 80 35-90 e8 6c ee 14 f6 cc 38   .....z.5..l....8
    0040 - ec 31 c8 fe b6 00 13 31-4b a8 d8 0d 96 fc ff 9d   .1.....1K.......
    0050 - 2c 26 13 e1 a2 11 d1 b2-ca 11 16 d0 9c 40 fb a3   ,&...........@..
    0060 - 64 ab b0 9c ab c1 6e be-e1 cd 16 69 8f 12 89 b0   d.....n....i....
    0070 - a9 88 2c dd d6 ab 57 0a-64 b8 e9 98 0b 4a 0f e3   ..,...W.d....J..
    0080 - d3 64 fc 0e 42 2c c7 7d-00 bc 26 c0 18 42 de 15   .d..B,.}..&..B..
    0090 - ec e6 e6 4b 3f e6 f5 bf-a9 d9 05 70 bf 2c ad 4a   ...K?......p.,.J
    00a0 - 7a b1 95 28                                       z..(

    Start Time: 1428543793
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---
read:errno=0


2015年3月27日 星期五

ppsspp - Best linux psp emulator

Just have a test on ppsspp. By setting the frame skip and the controller, I can play psp games on my old Thinkpad X61. Nearly no other configuration is needed. I can play with the rom smoothly on my linux computer.

Spec:
T8300 with X3100 onboard

There is less games on linux machines but I am sure ppsspp can give some fun to those who work alot on linux.

2015年3月21日 星期六

[How to] Setup Chinese Input Method on Linux - SCIM

SCIM is a very good Chinese input program for Linux, exspecially for 速成 (Chinese Quick) Method. Setup is very simple in arch linux

1. Install Package
# pacman -S scim scim-table

2. To enable it in startup
$ vim ~/.xinitrc
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
scim -d


exec startlxde

Sometimes it is not work for reload setting on the tray icon. But reboot computer can help.

2015年3月15日 星期日

[How To] Bridge network interfaces using netctl

There are some ways to bridge network interfaces. The most popular one is "brctl". Other than brctl and we can use netctl to preform this task. relativly easy with easier settings.

1. Create a configuration file
# cat /etc/netctl/bridge
Description="Example Bridge connection" 
Interface=br0 
Connection=bridge 
BindsToInterfaces=(enp3s0 snp3s1) 
IP=static 
Address='192.168.1.1/24' 
#Gateway='192.168.10.200' 
## Ignore (R)STP and immediately activate the bridge SkipForwardingDelay=yes 

2. Just start it
# netctl start bridge

3. If it works fine, just enable it during boot
# netctl enable bridge

Nice and done.

a good reminder that the interfaces in the bridge should be disable the DHCP settings. 

2015年3月11日 星期三

nbench - a simple computer benchmark tools for linux

nbench is a very small program that can benchmark a device base on the computation power of AMD K6-2 233 MHz (ha~ very slow CPU). It can also be use to compare the performance on ARM base devices.

http://www.tux.org/~mayer/linux/bmark.html

The results of my computer. Not that fast
= = =

$ nbench
BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          1323.9  :      33.95  :      11.15
STRING SORT         :          222.57  :      99.45  :      15.39
BITFIELD            :      4.4029e+08  :      75.53  :      15.78
FP EMULATION        :          236.86  :     113.66  :      26.23
FOURIER             :           25906  :      29.46  :      16.55
ASSIGNMENT          :          33.154  :     126.16  :      32.72
IDEA                :            7018  :     107.34  :      31.87
HUFFMAN             :          2775.9  :      76.98  :      24.58
NEURAL NET          :          46.583  :      74.83  :      31.48
LU DECOMPOSITION    :          1589.2  :      82.33  :      59.45
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 84.283
FLOATING-POINT INDEX: 56.617
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : Dual AuthenticAMD AMD Athlon(tm) II X2 240e Processor 1600MHz
L2 Cache            : 1024 KB
OS                  : Linux 3.18.6-1-ARCH
C compiler          : gcc version 4.9.2 20150304 (prerelease) (GCC)
libc                :
MEMORY INDEX        : 19.955
INTEGER INDEX       : 21.878
FLOATING-POINT INDEX: 31.402
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.

2015年3月7日 星期六

[How to] bind volume keys on Thinkpad X61 on arch linux

[How to] bind volume keys on Thinkpad X61 on arch linux

Org:
http://mizupc8.bio.mie-u.ac.jp/pukiwiki/index.php?ArchLinux%2FThinkPad%20X61

I don't know japanese but it works as expected. Cool
= = = Quote = = =

ThinkPad X61 での ArchLinux の設定に関するページです。

Volume キー

画面の照度調整などは標準インストールで使えるようになったが、Awesome WM ではボリュームの調整ボタンが使えなかった。xbindkeys パッケージをインストールして、設定ファイルに volume キーに関する記述をすればよい。
% sudo pacman -S xbindkeys
依存関係を解決しています...
相互衝突をチェックしています...

パッケージ (1): xbindkeys-1.8.6-1

Total Download Size:    0.02 MiB
Total Installed Size:   0.05 MiB

:: インストールを行いますか? [Y/n] y
:: パッケージを取得します ...
 xbindkeys-1.8.6-1-x...    20.5 KiB   133K/s 00:00 [######################] 100%
(1/1) キーリングのキーを確認                       [######################] 100%
(1/1) パッケージの整合性をチェック                 [######################] 100%
(1/1) パッケージファイルのロード                   [######################] 100%
(1/1) ファイルの衝突をチェック                     [######################] 100%
(1/1) 空き容量を確認                               [######################] 100%
(1/1) インストール xbindkeys                       [######################] 100%
xbindkeys の提案パッケージ
    tk: xbindkeys_show
% xbindkeys -d > ~/.xbindkeysrc
以下の内容を ~/.xbindkeysrc に追加。
# Increase volume
#"amixer  set Master 2dB+" ←dBで指定すると、Invalid command で不可だった。
"amixer  set 'Master' 5%+"
  XF86AudioRaiseVolume

# Decrease volume
#"amixer set Master 2dB-"
"amixer  set 'Master' 5%-"
  XF86AudioLowerVolume

# Toggle mute
"amixer set Master toggle"
  XF86AudioMute
.xinitrc に awesome を起動する前に xbindkeys を実行するよう記述する。
xbindkeys ←追加
exec awesome