Wednesday, July 25, 2018

[Ubuntu] Ubuntu backports


$ apt-cache madison ninja-build
ninja-build | 1.7.1-1~ubuntu16.04.1 | http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
ninja-build | 1.5.1-0.1ubuntu1 | http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
ninja-build | 1.3.4-1.1 | http://ua.archive.ubuntu.com/ubuntu trusty/universe Sources



ninja-build package has 2 version

xenial : 1.5.1-0.1ubuntu1
xenial-backports : 1.7.1-1~ubuntu16.04.1


$ apt install ninja-build ==> install xenial : 1.5.1-0.1ubuntu1

$ apt install ninja-build/xenial-backports ==> install 1.7.1-1~ubuntu16.04.1



xenial-backports : ubuntu xenial official backports

=> every package does not have backports version.

=> https://packages.ubuntu.com/xenial-backports/allpackages



$ apt install ninja-build/xenial-backports

Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '1.7.1-1~ubuntu16.04.1' (Ubuntu:16.04/xenial-backports [amd64]) for 'ninja-build'
The following NEW packages will be installed:
ninja-build
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 91.4 kB of archives.
After this operation, 293 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 ninja-build amd64 1.7.1-1~ubuntu16.04.1 [91.4 kB]
Fetched 91.4 kB in 1s (76.8 kB/s)
Selecting previously unselected package ninja-build.
(Reading database ... 276265 files and directories currently installed.)
Preparing to unpack .../ninja-build_1.7.1-1~ubuntu16.04.1_amd64.deb ...
Unpacking ninja-build (1.7.1-1~ubuntu16.04.1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Processing triggers for man-db (2.7.5-1) ...
Setting up ninja-build (1.7.1-1~ubuntu16.04.1) ...


Tuesday, July 24, 2018

[Tip] Create dummy files


fallocate & truncate & dd

create time : fallocate < truncate < dd

========================================================
$ time fallocate -l 10G 10gig

real 0m0.041s
user 0m0.000s
sys 0m0.001s
========================================================

========================================================
$ time truncate -s 10G tengig

real 0m0.001s
user 0m0.001s
sys 0m0.000s
========================================================

========================================================
$ time dd if=/dev/zero of=10gigfile bs=10G count=1
0+1 records in
0+1 records out
2147479552 bytes (2.1 GB, 2.0 GiB) copied, 17.3439 s, 124 MB/s

real 0m17.507s
user 0m0.000s
sys 0m1.825s
========================================================

========================================================
create 10 X 1G dummy file

$ for i in {1..10}; do fallocate -l 1G 1G_$i; done
========================================================


Sunday, July 22, 2018

[Bash] Split large files into smaller files


division.sh
================================================================
#!/bin/bash

mFileIn="big_log.txt";
#mFileIn=$1;
mDate=`date '+%Y%m%d%H%M'`;
mCount=1000;
mTotal=`cat -v $mFileIn | wc -l`;
mLoop=$((mTotal / mCount + 1));
echo $mFileIn;
echo $mDate;
echo $mCount;
echo $mTotal;
echo $mLoop;

for (( i=0; i < mLoop; i++ ))
do
        mFileOut=`printf "small_log_""$mDate""_%0.5i.txt" $i`;
        mStart=$((mCount * i + 1));
        mEnd=$((mStart + mCount - 1));
        #echo $mFileOut;
        echo $mStart " ~ " $mEnd;
        echo $mCmd;
        eval $mCmd;

        mCmd=`printf "sed -n -e '$mStart,$mEnd p' $mFileIn > $mFileOut"`;
        echo $mCmd;
        eval $mCmd;
done
================================================================

OR just

$ split -l 1000000 big_log.txt



Thursday, July 19, 2018

[Tip] Install private root certificate on Ubuntu


sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt
sudo cp foo.crt /etc/ssl/certs/foo.crt
sudo update-ca-certificates


Wednesday, July 18, 2018

[LXC] ssh connect to lxc container (centos): Connection refused


ON centos lxc (lxc == centos)

$ yum install openssh-server
$ systemctl start sshd.service
$ adduser centos
$ passwd centos


ON remote

$ ssh centos@lxc_centos_ip


[LXC] ssh connect to lxc container (ubuntu): Permission denied (publickey)


ON ubuntu lxc (lxc == ubuntu)

$ sudo vi /etc/ssh/sshd_config
=> PasswordAuthentication no
=> PasswordAuthentication yes
$ sudo service ssh restart
$ sudo passwd ubuntu
=> change ubuntu user password


ON remote

$ ssh ubuntu@lxc_ubuntu_ip


[Eclipse] Uninstall / Remove Eclipse Completely


remove eclipse
rm -fr ~/.eclipse
rm -fr ~/eclipse-workspace


[MariaDB] Failed to start MariaDB : When Switch From MySQL To MariaDB


$ sudo aa-disable /usr/sbin/mysqld
And reboot system

OR

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

OR

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo service apparmor reload

==> need to reboot


* /var/log/syslog
....
....
Jul 18 09:07:34 ubuntu systemd[1]: Starting MariaDB 10.2.16 database server...
Jul 18 09:07:34 ubuntu kernel: [46906.765575] audit: type=1400 audit(1531872454.473:174): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/1228/status" pid=1228 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=120 ouid=120
Jul 18 09:07:34 ubuntu kernel: [46906.765581] audit: type=1400 audit(1531872454.473:175): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=1228 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=120 ouid=0
Jul 18 09:07:34 ubuntu kernel: [46906.765665] audit: type=1400 audit(1531872454.473:176): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/1228/status" pid=1228 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=120 ouid=120
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] /usr/sbin/mysqld (mysqld 10.2.16-MariaDB-10.2.16+maria~xenial-log) starting as process 1228 ...
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Uses event mutexes
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Compressed tables use zlib 1.2.8
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Using Linux native AIO
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Number of pools: 1
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Using SSE2 crc32 instructions
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Completed initialization of buffer pool
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139822703924992 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Highest supported file format is Barracuda.
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: 128 out of 128 rollback segments are active.
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Creating shared tablespace for temporary tables
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: Waiting for purge to start
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] InnoDB: 5.7.22 started; log sequence number 2477609
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139822391883520 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] Plugin 'FEEDBACK' is disabled.
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] Server socket created on IP: '127.0.0.1'.
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] Reading of all Master_info entries succeded
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] Added new Master_info '' to hash table
Jul 18 09:07:34 ubuntu mysqld[1228]: 2018-07-18  9:07:34 139823637936320 [Note] /usr/sbin/mysqld: ready for connections.
Jul 18 09:07:34 ubuntu mysqld[1228]: Version: '10.2.16-MariaDB-10.2.16+maria~xenial-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Jul 18 09:07:34 ubuntu kernel: [46907.185353] audit: type=1400 audit(1531872454.893:177): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:07:35 ubuntu mysqld[1228]: 2018-07-18  9:07:35 139822391883520 [Note] InnoDB: Buffer pool(s) load completed at 180718  9:07:35
Jul 18 09:09:04 ubuntu systemd[1]: mariadb.service: Start operation timed out. Terminating.
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139823134938880 [Note] /usr/sbin/mysqld (initiated by: unknown): Normal shutdown
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139823134938880 [Note] Event Scheduler: Purging the queue. 0 events
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139822576424704 [Note] InnoDB: FTS optimize thread exiting.
Jul 18 09:09:04 ubuntu kernel: [46996.735275] audit: type=1400 audit(1531872544.442:178): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139823134938880 [Note] InnoDB: Starting shutdown...
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139822391883520 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
Jul 18 09:09:04 ubuntu mysqld[1228]: 2018-07-18  9:09:04 139822391883520 [Note] InnoDB: Buffer pool(s) dump completed at 180718  9:09:04
Jul 18 09:09:04 ubuntu kernel: [46996.765629] audit: type=1400 audit(1531872544.473:179): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46996.865465] audit: type=1400 audit(1531872544.573:180): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46996.965630] audit: type=1400 audit(1531872544.673:181): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46997.065785] audit: type=1400 audit(1531872544.773:182): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46997.165939] audit: type=1400 audit(1531872544.873:183): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46997.165945] audit: type=1400 audit(1531872544.873:184): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:04 ubuntu kernel: [46997.166594] audit: type=1400 audit(1531872544.874:185): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:05 ubuntu mysqld[1228]: 2018-07-18  9:09:05 139823134938880 [Note] InnoDB: Shutdown completed; log sequence number 2477637
Jul 18 09:09:05 ubuntu mysqld[1228]: 2018-07-18  9:09:05 139823134938880 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
Jul 18 09:09:05 ubuntu mysqld[1228]: 2018-07-18  9:09:05 139823134938880 [Note] /usr/sbin/mysqld: Shutdown complete
Jul 18 09:09:05 ubuntu kernel: [46997.694033] audit: type=1400 audit(1531872545.401:186): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:05 ubuntu kernel: [46997.694287] audit: type=1400 audit(1531872545.401:187): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=1228 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=120 ouid=0
Jul 18 09:09:05 ubuntu systemd[1]: Failed to start MariaDB 10.2.16 database server.
Jul 18 09:09:05 ubuntu systemd[1]: mariadb.service: Unit entered failed state.
Jul 18 09:09:05 ubuntu systemd[1]: mariadb.service: Failed with result 'timeout'.

....
....

Thursday, July 12, 2018

[Ubuntu] Run GUI application on remote server


==========================================
If normal applications (like xclock, firefox)
==========================================
$ ssh -XY myaccount@remote_x11.server
$ xclock
$ firefox
==========================================


==========================================
If SNAP applications (like /snap/bin/notepad-plus-plus )
==========================================
$ ssh -XY myaccount@remote_x11.server
$ cp ~/.Xauthority ~/snap/notepad-plus-plus/current/
$ /snap/bin/notepad-plus-plus
==========================================


[Ubuntu] Hangul settings for Ubuntu 18.04 LTS


** Hangul
 - System Settings -> Region & Language -> Manage Installed Languages
   - Install English, Korean
 - logout and login (or reboot)
 - System Settings -> Region & Language -> Input Sources :
   - Add Korean(Hangul)
   - Remove English
 - System Settings -> Region & Language -> Formats : United States

[Vim] Turn off autoindent or vice-versa : paste, nopaste


In command mode

:set paste
:set nopaste


[Bash] Hello World!


#!/bin/bash

echo "Hello World!"

exit 0


[Android] Uninstall Android Studio completely


** MacOS
rm -fr    /Applications/Android\ Studio.app
rm -fr ~/Documents/Android
rm -fr ~/Library/Preferences/AndroidStudio*
rm -fr ~/Library/Preferences/com.google.android.studio.plist
rm -fr ~/Library/Application\ Support/AndroidStudio*
rm -fr ~/Library/Logs/AndroidStudio*
rm -fr ~/Library/Caches/AndroidStudio*
rm -fr ~//Library/Preferences/AndroidStudio*
rm -fr ~/Library/Android*
rm -fr ~/.gradle
rm -fr ~/.android
rm -fr ~/.AndroidStudio*
rm -fr ~/AndroidStudioProjects



** Linux
remove android studio
rm -fr ~/.gradle
rm -fr ~/.android
rm -fr ~/.AndroidStudio*
rm -fr ~/AndroidStudioProjects
rm -fr ~/Android
rm -fr ~/.local/share/applications/jetbrains-studio.desktop


remove /home/airplanez/Storage/MyProgram/android-studio****


** Windows
remove android studio
C:/Users/myaccount/.android
C:/Users/myaccount/.AndroidStudio*
C:/Users/myaccount/.gradle
C:/Users/myaccount/AndroidStudioProjects
C:/Users/myaccount/AppData/Local/Android/Sdk


[PHP] Hello World!


<?php

echo "Hello World!";

?>