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

2021年1月16日 星期六

Debian 11 bullseye KVM host installation with public bridge network

Debian 11 bullseye KVM host installation with public bridge network


#install packages

#apt install --no-install-recommends qemu-system qemu-utils libvirt-clients libvirt-daemon-system bridge-utils

#adduser <youruser> libvirt

#create bridge interface 
# ip link add br0 type bridge
## brctl addbr br0 (deprecated, use ip link instead!)
# vi /etc/network/interfaces

#add/modify following

......
# The primary network interface
#allow-hotplug eno1 # eno1 is my interface name ,change to yours
#iface eno1 inet dhcp

## kvm bridge
##
iface eno1 inet manual
auto br0
iface br0 inet dhcp
pre-up ip tuntap add dev tap0 mode tap user root
pre-up ip link set tap0 up
bridge_ports eno1 tap0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
post-down ip link set tap0 down
post-down ip tuntap del dev tap0 mode tap



Now you can connect from remote virt-manager something like this: 

qemu+ssh://root@<kvm host br0 IP >/system





2018年8月2日 星期四

Ubuntu 18.04 suspend problem on Zenbook UX410UQK + Nvidia 940M


在 ASUS Zenbook UX410UQK 筆電上 踩到 Nvidia 940MX ,在Ubuntu18.04上 suspend之後系統會掛掉。  目前的18.04.1依然無解。
只好改用最愛的 Debian Sid, kernel 4.17。 OK。

update:
https://wiki.archlinux.org/index.php/bumblebee#Failed_to_initialize_the_NVIDIA_GPU_at_PCI:1:0:0_.28Bumblebee_daemon_reported:_error:_.5BXORG.5D_.28EE.29_NVIDIA.28GPU-0.29.29
I ended up with this service in /etc/systemd/system/gpu-fix.service:

[Unit]
Description=Fix GPU after waking up from suspension
After=suspend.target
[Service]
User=root
Type=oneshot
# Sleep is because we want to ensure fastest wake up
ExecStart=/usr/bin/bash -c "sleep 2 && echo 1 > /sys/bus/pci/rescan"
TimeoutSec=0
[Install]
WantedBy=suspend.target

2018年2月28日 星期三

debian sid python3-zeitgeist bug dirty fix

又撞上一個熱騰騰的 Debian sid bug ,是在更新  python3-zeitgeist 套件時報掉的。

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891615

看來是開發者沒有留意python2 |  python3  try except raise 的語法差異所造成。

我不會寫 python ,可是照著 error message 丟出來的訊息


Setting up python3-zeitgeist (1.0.1-0.1) ...

File "/usr/lib/python3/dist-packages/zeitgeist/client.py", line 1061

raise TypeError, 'enabled_callback: expected a callable method'

^

SyntaxError: invalid syntax

,再查一下 python3 語法範例,土法煉鋼把報錯的檔案改完,ㄝ,可以了
apt upgrade 就過了。

跟Sid朝夕相處的刺激感覺實在不錯啊。

2015年7月3日 星期五

Debian 8 Jessie的終端機程式選擇

工作機小黑 X61 前幾天升級到 Jessie,最不習慣的是gnome-terminal 升級後,無法更改 tab 標籤了。工作上我需要用到很多terminal,之前寫了個小script一次開啟多個terminal,自動ssh到需要管理的Linux server,自動更改terminal標籤,方便工作。現在不行了,怎辦?

測試了好幾個終端機模擬: guake / lxterminal / terminator / xfce4-terminal ,最後發現只有 xfce4-terminal 還可以從cli自動修改tab標籤名稱。

修改後的script如下:
#!/bin/bash

xfce4-terminal   --title="server1" -e "ssh server1  --tab  -e "ssh server2" --title="server2"  --tab  -e "ssh server3" --title="server3"  

2014年12月30日 星期二

Trackpoint speed and sensitivity tweek

Addd following line to /etc/rc.local

## Trackpoint speed and sensitivity tweek, echo number 0-255 to sysfs
echo -n 120 > /sys/devices/platform/i8042/serio1/speed
echo -n 220 > /sys/devices/platform/i8042/serio1/sensitivity

一晃神,半年多沒更新這裡了。

2014年6月12日 星期四

How to install star on Debian

Star is a very fast tar(1) like tape archiver with improved functionality. Debian official repo did not include this package, thus need some trick to convert it from Redhat RPM.

Star 號稱是比正常的 Linux tar 還要快、支援格式更多、功能更強的打包軟體。碰到需要在 Debian 環境安裝這個東西,筆記如下:

1. apt-get install alien

2.find and down star RPM from http://www.rpmfind.net/linux/rpm2html/search.php?query=star

3. convert alien RPM package into DEB world
alien star-1.5.2-11.fc21.x86_64.rpm

3. install converted deb
 dpkg -i star_1.5.2-12_amd64.deb

安裝完後指令用法參考mam 或底下網頁

star(1) - Linux man page

2014年2月21日 星期五

Access MS SQL server from Debian/Linux console - sqlline


1.Install sqlline and jtds (using apt-get )
apt-get install libjtds-java sqlline

2.ms sql jdbc connection string syntax
jdbc:jtds:sqlserver://ip/

3.drive class syntax
net.sourceforge.jtds.jdbc.Driver


4.command line example :
sqlline -u 'jdbc:jtds:sqlserver://ip/' -n user -p pwd -d net.sourceforge.jtds.jdbc.Driver 

5.using pipe redirect
sqlline -u 'jdbc:jtds:sqlserver://ip/' -n user -p pwd -d net.sourceforge.jtds.jdbc.Driver  < script.sql

2014年2月16日 星期日

Linux NIC VLAN config

以Debian為例,

  1. apt-get install vlan
  2. vconfig add eth0 202                   ### 在 eth0上面設定VLAN 202,執行完後系統會多一個 eth0.202 網路卡
  3. ifconfig eth0.1 192.168.202.100  ### 設定 eth0.202 的IP,從這個網路卡出去的 frame都會帶vlan tag 202
vconfig --help
Usage: add             [interface-name] [vlan_id]

       rem             [vlan-name]
       set_flag        [interface-name] [flag-num]       [0 | 1]
       set_egress_map  [vlan-name]      [skb_priority]   [vlan_qos]
       set_ingress_map [vlan-name]      [skb_priority]   [vlan_qos]
       set_name_type   [name-type]

2013年10月4日 星期五

Fortigate reset trusthost setting 重設信任主機欄位設定


如果不小心把Fortigate的Admin 管理者信任主機欄位設定錯誤,導致無法從網頁管理界面或 ssh / telnet 登入管理,可以透過Fortigate的console埠重設信任主機欄位。以下是從Linux / Debian 電腦上面,透過USB轉序列埠連接上Fortigate。


Fortigate serial port configuration : 9600 8N1 / none HW flow control / none SW flow control

Under Linux terminal :

Option 1 : cu command

:~$ cu -l /dev/ttyUSB0 -s 9600 --parity=none --nostop
Connected.
FGT60C login:
FGT60C login: admin
Password: ******
Welcome !
FGT60C #


FGT60C # config system admin
FGT60C (admin) # edit admin
FGT60C (admin) # unset trusthost1
FGT60C (admin) # unset trusthost2
FGT60C (admin) # unset trusthost3
FGT60C (admin) # unset trusthost4
FGT60C (admin) # end
FGT60C # exit
FGT60C login: ~.

( here the last input "~." is the disconnect string of cu )


Option 2 : minicom command
:~$ minicom -D /dev/ttyUSB0 -b 9600 -8

others the same as above, use ctrl-a then press x to confirm leave minicom.

2013年7月9日 星期二

HOW to install Apache Activemq on Debian 7 Wheezy

##Debian 7 wheezy activemq install

##down apache activemq binary from http://activemq.apache.org/download.html  (current version: apache-activemq-5.8.0-bin.tar.gz)

##extract files to /opt
cd /opt
tar xzvf /root/Downloads/apache-activemq-5.8.0-bin.tar.gz


## make symbolic link
ln -s apache-activemq-5.8.0 activemq
cd /etc/init.d
ln -s /opt/activemq/bin/activemq

## generate activemq configuration file under /etc/default/activemq
/etc/init.d/activemq setup /etc/default/activemq
chown 'root':root '/etc/default/activemq'; chmod 600 '/etc/default/activemq'


##change admin password
vi /opt/activemq/conf/jetty-realm.properties

##update service autostart during boot
update-rc.d activemq defaults

2013年5月28日 星期二

Debian Wheezy 英文版 Libreoffice 中文輸入問題

在Debian Wheezy 中,Libreoffice有個困擾已久的中文輸入問題。

在Debian英文OS環境中,系統預設安裝的Libreoffice無法正常輸入中文。症狀是第一次開啟Libreoffice的任何程式,在視窗焦點沒離開Libreoffice之前還可以正常輸入中文,ibus-酷音的輸入視窗和界面都正常。可是一旦視窗切換到其他軟體,例如gedit,開啟中文輸入法輸入幾個字後,再切換回Libreoffice視窗,ibus-酷音就無法正常動作。

解決方法是補安裝 libreoffice-gnome & libreoffice-gtk 。我是透過synaptic package manager勾選安裝這兩隻之後,Libreoffice的中文輸入就正常了。

已經在 Wheezy正式版的 Libreoffice 4.0.3-3 環境下驗證可行。

2013年1月3日 星期四

在 Debian Wheezy 下啟用 Thinkpad X200 靜音鍵功能

這台X200先前被公司財務長徵用,最近又回到我手上。按照慣例換回 Debain ,用了一下發現之前就有的小問題一直還沒解決。

X200 的靜音鍵(mute)在Wheezy中無動作。稍微找了一下,發現是Linux Kernel 2.6.23之後,kernel回傳 ACPI字串更改所導致。Linux version 2.6.23 kernel passes OSI string "!Linux" to ACPI (instead of "Linux")

解決方案是在 boot parameter中加入acpi_osi="Linux"參數。在Debian Wheezy中修改 
/etc/default/grub
GRUB_CMDLINE_LINUX=""
改成
GRUB_CMDLINE_LINUX=" acpi_osi=Linux"

然後執行
update-grub

重新開機後就靜音鍵就可以用了。
參考網址: ThinkWiki
http://www.thinkwiki.org/wiki/Mute_button


2012年8月19日 星期日

IBM X31 Debian Wheezy Trackpoint 小紅點的中鍵滾輪正確解法

在殺肉組合零件之後,第二部IBM X31也正式服役了。安裝了 Debian Wheezy XFCE + LXDE 桌面。碰到最困擾的問題在於XFCE / LXDE 桌面環境下,小紅點的中鍵滾輪模擬無法正確動作,找了一陣子,正確解法如下:

To enable scrolling with the TrackPoint while holding down the middle mouse button, create a new file /etc/X11/xorg.conf.d/20-thinkpad.conf with the following content:
 Section "InputClass"
     Identifier "Trackpoint Wheel Emulation"
     MatchProduct       "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"
     MatchDevicePath    "/dev/input/event*"
     Option             "EmulateWheel"          "true"
     Option             "EmulateWheelButton"    "2"
     Option             "Emulate3Buttons"       "false"
     Option             "XAxisMapping"          "6 7"
     Option             "YAxisMapping"          "4 5"
 EndSection

2012年6月29日 星期五

Ubuntu server 12.04 手動設定DNS server的正確方式


很多網路文章....都寫要手動更改/etc/resolv.conf
這在12.04 server 是錯的
resolv.conf開頭就有兩行:


# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

手動改完 reslov.conf 之後,下次重開機系統會把手動加入的部份清空。

正確方式請man resolvconf或參考
http://manpages.ubuntu.com/manpages/precise/man8/resolvconf.8.html

手動設定12.04 server  的IP位址時,修改  /etc/network/interface 加入

dns-nameservers  IP1 IP2 ...

系統在執行/etc/init.d/networking 時會讀取這行設定,自動更新 /etc/resolv.conf

底下是我的 /etc/network/interface 檔案,供參考



# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.240
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
dns-nameservers 168.95.1.1 8.8.8.8

2012年5月25日 星期五

在Debian Wheezy 中更改Google Chrome cache dir

更改下面檔案

  1. /usr/share/gnome/applications/google-chrome.desktop
  2. /usr/share/applications/google-chrome.desktop
  3. /usr/share/gnome/applications/google-chrome.desktop

其中1.是最主要的,2,3可改可不改。


找到這行
Exec=/opt/google/chrome/google-chrome  %U

改為這樣
Exec=/opt/google/chrome/google-chrome --disk-cache-dir=/tmp %U

其中/tmp是要更改的 disk cache 目錄。

我的/tmp是記憶體中的tmpfs



2012年4月4日 星期三

Debian Wheezy 3G 行動網路分享(wifi hotspot)



重點提示: ignore IPV6
1.go to System settings --> Network --> Wireless -->Use as hotspot --> Configure (or 'Edit connections' under your connections --> Edit the hotspot connection)
2.Switch to IPv6 Settings tab --> Set Method to 'Ignore' and confirm/save
go to System settings --> Network --> Wireless --> Use as hotspot




這樣就可以讓其他設備透過分享wheezy的 mobile broadband 行動寬頻上網。

詳細步驟.....有人需要嗎?很少遇到用 Debian Wheezy 當作日常使用桌面系統,很懶的花時間寫啊。

2012年4月2日 星期一

ibus-chewing 新酷音輸入法選字數目太少的解決方式



ibus-chewing 新酷音輸入法在GNOME3環境中,基本上是安裝完之後就可以使用,但是一直有個小問題。在新酷音的候選字視窗中,系統預設值是只有四個中文字(8個英文字母)。就算你透過GUI界面更改了新酷音輸入法的設定,將 maximum chinese characters 的值放大到20或30,等到切換輸入法之後一樣恢復為最多四個中文字(8個英文字母),設定值完全無法儲存。

掙扎了一陣子,後來想到GNOME3預設是使用dconf / gsettings 來管理應用程式的設定值,而新酷音好像還是用 GNOME 2.X 的 gconf 方式設定,於是安裝相關套件,

apt-get install gconf-editor gconf-defaults-service

之後,執行 gconf-editor ,找到 /desktop/ibus/engine/Chewing/maxChiSymbolLen  這個設定 key, 手動更改為 30 之後,登出再登入,就可以解決輸入法候選字長度太短的問題了。

2012-08-23
更新一下自己的經驗 Debian Wheezy - LXDE上也是用這個方式解決。

2012年3月30日 星期五

Debian wheezy on Thinkpad X200

是的,這次是X200。我又拿到一台新的小黑,又來玩Debain安裝樂。

基本上跟上一篇X61安裝 Debain wheezy 差不多,上次的筆記照表操課就可以了。這次安裝的dvd image是3/26釋出的weekly build.


補充一點,ibus-chewing 在GNOME3環境中,安裝完之後就可以使用,但是一直有個小問題。在輸入法候選字視窗中,預設值是只有四個中文字(8個英文字母)。就算你更改了新酷音輸入法的設定,將 maximum chinese characters 的值放大到20或30,等到切換輸入法之後一樣變成四個中文字(8個英文字母),設定值完全無法儲存。

掙扎了一陣子,後來想到GNOME3預設是使用dconf / gsettings 來管理應用程式的設定值,而新酷音好像還是用 GNOME 2.X 的 gconf 方式設定,於是安裝相關套件,apt-get install gconf-editor gconf-defaults-service 之後,執行 gconf-editor ,找到 /desktop/ibus/engine/Chewing/maxChiSymbolLen  這個設定 key, 手動更改為 30 之後,登出再登入,就可以解決輸入法候選字長度太短的問題。

2012年3月27日 星期二

在linux console 上用curl上傳檔案到遠端ftp

背景執行指令:

nohup curl --limit-rate 200k -u username:password -T "本機檔案" ftp://ftp.somewhere.com/somefolder  &

前景執行指令:
 curl --limit-rate 200k -u username:password -T "本機檔案" ftp://ftp.somewhere.com/somefolder

2012年2月23日 星期四

FreeTDS 小筆記

Linux console下用來連接  MSSQL 的工具。

Centos 5 安裝: yum install freetds

mandrake 2008 安裝: urpmi libfreetds_mssql

Debian 安裝:apt-get install freetds-bin



網站:
http://www.freetds.org

使用:
tsql : 互動式命令列,sql敘述最後要輸入 go 執行

tsql  { -S servername [-I interface] | -H hostname -p port }
             -U username [-P password] [-o options]


bsqldb:可以批次執行sql script 文字檔案,並將輸出存至 output filename
bsqldb 
        [-U username] [-P password]
        [-S servername] [-D database]
        [-i input filename] [-o output filename] [-e error filename]