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

2020年8月27日 星期四

alexa

環境: RP3 (Debian 9)



花了許多時間build,但build過程中出現問題:
[ 95%] Built target DefaultClient
[ 95%] Building CXX object SampleApp/src/CMakeFiles/LibSampleApp.dir/UIManager.cpp.o
[ 95%] Building CXX object SampleApp/src/CMakeFiles/LibSampleApp.dir/InteractionManager.cpp.o
c++: internal compiler error: 已砍掉 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
SampleApp/src/CMakeFiles/LibSampleApp.dir/build.make:206: recipe for target 'SampleApp/src/CMakeFiles/LibSampleApp.dir/InteractionManager.cpp.o' failed
make[3]: *** [SampleApp/src/CMakeFiles/LibSampleApp.dir/InteractionManager.cpp.o] Error 4
make[3]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:13220: recipe for target 'SampleApp/src/CMakeFiles/LibSampleApp.dir/all' failed
make[2]: *** [SampleApp/src/CMakeFiles/LibSampleApp.dir/all] Error 2
CMakeFiles/Makefile2:13317: recipe for target 'SampleApp/src/CMakeFiles/SampleApp.dir/rule' failed
make[1]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/rule] Error 2
Makefile:3254: recipe for target 'SampleApp' failed
make: *** [SampleApp] Error 2
找資料說,把swap提升就行了...
$sudo vim /etc/dphys-swapfile
    CONF_SWAPSIZE=100 -> CONF_SWAPSIZE=1024 (1G)

$ sudo systemctl restart dphys-swapfile

RP3的聲音不能從audio jack出來
後來拿audio dongle + pulseaudio(需root) 解決 (重開機幾次後抓到audio dongle@@)


ref : 

2020年1月19日 星期日

Debian 10 (Buster) for arm64

Install:
sudo apt-get install qemu qemu-user-static debootstrap kpartx
Create a new space image:
sudo dd if=/dev/zero of=rootfs.img  bs=1048576 count=1900
Make a loop device with losetup
sudo losetup -f --show rootfs.img

ex: /dev/loop19  <- pre="" success="">
Partition:
1.sudo fdisk /dev/loop19
2.sudo losetup -d /dev/loop0
Format & mount:
1. sudo kpartx -va rootfs.img
1. sudo mkfs.ext4 /dev/mapper/loop19p1
2. sudo mount /dev/mapper/loop19p1 /mnt
Download:
1. mkdir -p /mnt/usr/bin
2. cp /usr/bin/qemu-aarch64-static /mnt/usr/bin/
               (for arm 64 bit)
3. sudo debootstrap --arch arm64 buster /mnt https://deb.debian.org/debian/
Set up dns
sudo cp /etc/resolv.conf /mnt/etc/
Change root
sudo mount -t proc /proc /mnt/proc
sudo mount -t sysfs /sys /mnt/sys
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /dev/pts /mnt/dev/pts

sudo chroot /mnt
or 
sudo chroot /mnt /bin/bash
follow this page to install the required packages

umount /mnt
sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/sys
sudo umount /mnt/proc

ref:
1. [心] 誌
2. Quick and easy bootstrap of Debian 8 (Jessie) for armhf

2019年12月11日 星期三

Creating service with systemd (autoloading, 自動執行)

Testing on Debian Jessie & Ubuntu 16

$ cd /etc/systemd/system/multi-user.target.wants

ex: 
    ls -alh ufw.service -> /lib/systemd/system/ufw.service

add a file nnn.service
[Unit]
Description=test
After=test.target

[Service]
User=ubuntu
Group=ubuntu
ExecStart=/root/ss.sh
ExecReload=/root/rr.sh
ExecStop=/root/kk.sh

[Install]
WantedBy=multi-user.target

add a file in /etc/init.d/nnn
#!/bin/sh -e

### BEGIN INIT INFO
# Provides:          test
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $network $syslog
# Should-Stop:       $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop test
# Description:       test
#        which translates ip addresses to and from internet names
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# for a chrooted server: "-u bind -t /var/lib/named"
OPTIONS=""
RESOLVCONF=no

test -x /usr/sbin/rndc || exit 0
. /lib/lsb/init-functions


test -f /root/ss.sh


case "$1" in
    start)
        log_daemon_msg "Starting to testing..." "testing"
        /root/ss.sh
        log_end_msg 0 #true, log_end_msg 1 #false
    ;;

    stop)
        log_daemon_msg "Stopping to testing..." "testing"
        /root/kk.sh

        log_end_msg 0 #true, log_end_msg 1 #false
    ;;

    restart)
        $0 stop
        $0 start
        log_end_msg 0 #true, log_end_msg 1 #false
    ;;

    status)
        #to do
        log_end_msg 0 #true, log_end_msg 1 #false
        ;;

    *)
        log_action_msg "Usage: /etc/init.d/nnn {start|stop|restart|status}"
        exit 1
    ;;
esac

exit 0

try to running
# systemctl start nnn

checking status
# systemctl status QtApp.service

checking all of service
$ systemctl --type=service
or
$ systemctl --type=service ==state=running

ref:
1. Creating a Linux service with systemd
2. Superuser
3. How to List All Running Services Under Systemd in Linux
4. stackoverflow

2019年10月21日 星期一

How to create /dev/tty0

Create tty0~tty15
CONFIG_VT=y
Create ttyS0
CONFIG_SERIAL_CONSOLE=y


enable ttyS0 with systemctl (test on Debian Jessie)
# systemctl enable serial-getty@ttyS0.service
It will create the link file in /etc/systemd/system/getty.target.wants
ex: 
# ls /etc/systemd/system/getty.target.wants
  serial-getty@ttyS0.service -> /lib/systemd/system/serial-getty@.service


# systemctl mask serial-getty@ttyS0.service
It will link to /dev/null in /etc/systemd/system/
ex: 
# ls /etc/systemd/system/serial-getty@ttyS0.service -> /dev/null


# systemctl disable serial-getty@ttyS0.service
It will remove the file in /etc/systemd/system/getty.target.wants
ref:
1. Here
2. stackoverflow
3. Pid Eins

2012年4月11日 星期三

Debian 6.0.4 中文字型+無蝦米

裝完中文版後,reboot開完機後,
畫面是呈現一堆方塊火星文,
中文字型不知道是放在哪個iso (我通常只會下載cd-iso-1)
所以裝完後還要裝下列字型才行:
aptitude install ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-ukai ttf-arphic-uming
裝完後,就能看到中文了

接著就是嘸蝦米了
aptitude install scim scim-pinyin scim-chewing scim-tables-zh scim-qtimm im-switch
拉拉渣渣裝這麼多後,(有些可以不用裝才對,但不想花時間確認)
再把 Liu.bin 放到 /usr/share/scim/tables 就行了
(把scim打開,可以關掉用不到的輸入法,但切換輸入法還在研究一下 = =")

ref:
2. Here

============

附加一下 ubuntu 安裝方法:

google了一下, ubuntu 是用 ibus 輸入法,所以用 gcin 的方式是行不通的。
目前比較好的文章有:
  1. 馴狼手冊  (看了覺得麻煩,還沒試過)
  2. 雲淡風清  (配合的方法) maverick build 可以在1204上執行

2012年1月23日 星期一

製作 deb

只是自已製作自已用的話
其實滿簡單的
只要把想要安裝的檔案放到想要的路徑即可

ex: test.sh
#!/bin/sh
echo "Hello Debian"

Step 1.
mkdir -p test_1.0.0
Step2.
mkdir -p test_1.0.0/usr/local/bin/
mkdir -p test_1.0.0/home/ubuntu/
Step3.
cp test.sh test_1.0.0/usr/local/bin
cp test.sh test_1.0.0/home/debian/
Step4. (重要)
mkdir -p test_1.0.0/DEBIAN
vim test_1.0.0/DEBIAN/control 
Step5.
Package: test
Version: 1.0.0
Section: base
Priority: optional
Architecture: i386
Maintainer: Test
Description: iii
 xxx
 yyy
 zzz
Step 6. 封裝
dpkg-deb --build test_1.0.0

原則上樣就能產生一個 test_1.0.0.deb,
真的要發佈,還有要調整的,但目前不需要 ^^"

安裝:
$ sudo dpkg -i test_1.0.0
可以在 /usr/local/bin和/home/debian/下找到 test.sh

移除:
$ sudo dpkg -r test_1.0.0

2011年12月6日 星期二

Glx / Cairo-Dock

環境:Debian 6.0 ( 系統安裝好後馬上就裝 Glx-dock)

現在的dock作得可比以前好看多了,越來越像MAC了,感謝那些開發人員辛勞的付出

官網: Glx / Cairo-Dock
安裝簡介: Here ( 目前 support 的distribution:Debian / Ubuntu, Fedora, Gentoo等等)
  1. 在  /etc/apt/source.list 增加:
    deb http://download.tuxfamily.org/glxdock/repository/debian stable cairo-dock
  2. 加入金鑰:
    wget -q http://repository.glx-dock.org/cairo-dock.gpg -O- | apt-key add -
  3. 然後:
    aptitude update
    
    aptitude install cairo-dock cairo-dock-plug-ins
  4. 試著啟動
    cairo-dock &
ref : Glx-dock官網

    2010年6月28日 星期一

    win and linux 透過 samba 共用檔案

    win and linux 透過 samba 共用檔案

    環境:Debian 5.0 and winXP and VMware

    1. 安裝:
    aptitude install samba

    2. vim /etc/samba/smb.conf 如下:

    [global]
    unix charset = utf8
    display charset = utf8
    dos charset = cp950
    security = user
    [sharefiles]
    comment = Share Files
    path = /home/username
    browseable = yes
    read only = no
    create mask = 0644
    directory mask = 0755
    public = yes

    3. 設定samba帳號密碼:
    smbpasswd -a <帳號>

    4. restart:
    /etc/init.d/samba restart

    這樣應該就能用了,
    在xp下test:
    \\ip-ip-ip-ip-ip-ip

    2009年11月16日 星期一

    Debian 套件管理系統

    第6章 - Debian 套件管理系統

    Debian 套件管理系統

    2009年10月16日 星期五

    S2RAM / S2HD

    S2RAM / S2HD

    環境:debian lenny + kernel 2.6

    1. 先確定kernel有編入 Suspend 和 Hibernate 相關的項目
    2. # cat /sys/power/status 是否有「mem」和「disk」這兩個字樣
    3. # echo -n mem (or disk) > /sys/power/state 看是否成功

    PS:
    1. S2RAM -> S3,會消耗一點電力
    2. S2HD -> S4,完全不會消耗電力,還可以把電池拔掉 (沒試過,ref-1說的)
    3. S4,需要swap,ref-1建議,大小約需Memory*2的空間。(安裝整個系統時就要設定)
    4. 編kernel時,沒有在「Default resume partition」的話,需要【initrd】。
    (Default resume partition 輸入swap的partition)
    5. menu.lst (如果是GRUB的話),可以輸入 resume=XXX 的值給 kernel。 (沒試過)

    ref:
    1. How to suspend and hibernate a laptop under Linux
    2. Suspend to RAM & DISK

    2009年10月13日 星期二

    Read/Write ntfs format at Debian lenny

    Read/Write ntfs format at Debian lenny

    kernel: 2.6

    1. 將 fuse 編入kernel or module (編入module的話,要記得modprobe fuse)
    2. aptitude install ntfs-3g
    這樣應該就OK了
    (編kernel時,可以把ntfs相關一併編入)

    # mount -t ntfs-3g /dev/your-partion /path

    不想每次開機都要mount的話,可以在 fstab 設定。

    2009年8月4日 星期二

    電池容量

    電池容量

    環境: Debian 5.0 + 2.6.28

    #!/bin/bash
    
    now=`/bin/cat /proc/acpi/battery/BAT1/state | awk '/remain/ {print $3}'`
    full=`/bin/cat /proc/acpi/battery/BAT1/info | awk '/last full/ {print $4}'`
     
    declare -i status="$now*100/$full"
     
    echo $status
    
    
    環境: Debian 6.0 + 2.6.32
    
    
    /sys/class/power_supply/BAT0/charge_now
    /sys/class/power_supply/BAT0/charge_full

    2009年6月15日 星期一

    關於 X server 遠端設定

    關於 X server 遠端設定

    目地:
    Display xwindow on remote machine by ssh using Debian 5.0


    簡單的架構圖

    電腦A (server)

    1. 現在的linux安裝好X server後,好像為了安全會把遠端的功能預設上鎖(?!)
    ( Xserver 預設是不會聽監聽 tcp的連線 )
    要開啟監聽(listen)的功能:
    # vim /etc/X11/xinit/xserverrc
    有一行:
    exec /usr/bin/X11/X -nolisten tcp,
    把 -nolisten tcp 拿掉

    但...這一個步驟可以不用作也可遠端@@

    2. xhost
    # xhost + remote(電腦B) IP  or  #xhost +


    電腦B (client / remote)

    3. 用ssh連線:
    # ssh -X server IP
    # echo $DISPLAY
    localhost:10.0 (我的環境)


    4. 測試:
    # xeyes -display localhost:10.0

    xeyes跑起來,表示:
    xserver在電腦B
    xclient在電腦A


    注意:
    連上server後不用作
    export DISPLAY=server ip:0.0
    用ssh連線後,export DISPLAY後,
    用xeyes測試會出現 can't not open display
    (看這字串看了3天3夜)
    因為ssh -X 這個參數會自動幫忙把 Display 設定好
    ex:
    echo $DISPLAY
    localhost:10.0

    大部份的X程序都支持這個參數,
    gtk的程序參數為
    --display


    [轉貼] GTK 编程基本示例

    gtk_init(&argc, &argv)
    是gtk應用程式的初始化部分,它使gtk 應用程式可以接受某些命令行的參數:

    --gtk-module //載入另外的GTK模組
    --g-fatal-warnings //使所有警告是致命錯誤
    --gtk-debug //調試gtk
    --gtk-no-debug //不調試gtk
    --gdk-debug //調試gdk
    --gdk-no-debug //不調試gdk
    --display //指定display
    --sync //使X調用按順序方式
    --no-xshm //不使用X共用記憶體
    --name //指定視窗管理器使用的程式名
    --class //指定視窗管理器使用的程式類型


    [轉貼]xhost 和 DISPLAY

    DISPLAY HostName:0.0 的意思:
    (echo $DISPLAY,如果沒有看到HostName,就代表在本機)

        HostName 是我目前近端這台電腦, 在 HostName 後加一個冒號(:)再加上 0.0。
    gtk程序,要加個空格
        第一個數字 0,代表我現在近端這台電腦的第一張顯示卡,
    如果有多張顯示卡,則按照順序加上去。
        第二個數字 0,代表我現在近端這台電腦的這張顯示卡的第一個螢幕;
    同理,如果同張顯示卡可以接多個螢幕,其數字依序往上加。

    ref:
    1. 解决本地linux 作為x server的問题
    2. xhost 和 DISPLAY
    3. GTK 编程基本示例

    2009年3月19日 星期四

    不必輸入username & password 自動登入

    不必輸入username & password 自動登入

    Distribution:
    Debian 8.0 (Jessie)
    自動登入:
    1. # vim /etc/systemd/system/getty.target.wants/getty@tty1.service
    2. 修改 ExecStart=-/sbin/agetty --autologin user_name --noclear %I $TERM
    如此,會透過 tty1 來自登入
    如果有用uar tttySx之類的,還是要輸入帳密

    Distribution:
    ubuntu 12.04

    Distribution:
    Debian 5.0

    方法一:(感謝Ryan提供)
    自動登入common_line:
    1. # apt-get install mingetty
    2. # vim /etc/inittab
    (看想要修改哪一個tty)
    1:2345:once:/sbin/mingetty --autologin username tty1

    自動啟動startx
    承上
    3. # vim /etc/rc.local
    加上 /usr/bin/startx

    ref:
    Linux中autologin自動啟動XWindow的設定方法

    方法二:
    1. # vim autologin.c
    int main()
    {
    execlp( "login", "login", "-f", "username", 0);
    }

    2. # gcc -o autologin autologin.c
    3. # cp autologin /usr/sbin
    4. # vim /etc/inittab
    (看想要修改哪一個tty)
    1:2345:respawn:/sbin/getty -n -l /usr/sbin/autologin 38400 tty1

    自動啟動startx
    承上
    5. $ vim .bash_profile (用user編輯)
    if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
    startx
    fi

    ref :
    HOWTO: Autologin and Autostart XFCE

    2009年2月22日 星期日

    apt download下來的暫存檔

    apt,download下來的暫存檔

    環境: Debian 5.0

    /var/cache/apt/archives/

    2008年12月14日 星期日

    尋找最佳 sources.list 站台的小工具

    尋找最佳 sources.list 站台的小工具 - netselect-apt

    1. aptitude install netselect-apt

    2. 執行(root) netselect-apt {stable|testing|unstable}
    選其中一個 ex: netselect-apt stable
    執行後,會花點時間跑,跑完後會得到個網址。

    3. 將網址複制下來,貼在 /etc/apt/source.list
    deb http://opensource.nchc.org.tw/debian/ lenny main

    ps : 如果有碰到「NO PUBKEY 」的話:

    gpg --keyserver wwwkeys.eu.pgp.net --recv-keys A70DAF536070D3A1
    gpg --armor --export A70DAF536070D3A1 | apt-key add -
    /*nice*/