lost and found ( for me ? )

Showing posts with label ubuntu server. Show all posts
Showing posts with label ubuntu server. Show all posts

Ubuntu server apt-get error : post-removal スクリプト はエラー終了ステータス 127 を返しました

This error happens

1. installed ubuntu server with only CLI mode
2. installed ubuntu desktop via tasksel
3. iinstalled x2goserver-home , x2gognomebindings via apt-get
4. removeed ubuntu desktop via tasksel

after that ( 1-4) , see an error when I do “apt-get update”
root@ubuntu-1:~# apt-get upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
1 個のパッケージが完全にインストールまたは削除されていません。
9,942B 中 0B のアーカイブを取得する必要があります。
この操作後に追加で 0B のディスク容量が消費されます。
続行しますか [Y/n]? y
警告: 以下のパッケージは認証されていません!
 x2gognomebindings
検証なしにこれらのパッケージをインストールしますか [y/N]? y
未選択パッケージ x2gognomebindings を選択しています。
(データベースを読み込んでいます ... 現在 114112 個のファイルとディレクトリがインストールされています。)
x2gognomebindings 2.0.1-1 を (.../x2gognomebindings_2.0.1-1_amd64.deb で) 置換するための準備をしています ...
x2gognomebindings を展開し、置換しています...
/var/lib/dpkg/info/x2gognomebindings.postrm: 33: update-desktop-database: not found
dpkg: 警告: サブプロセス 古い post-removal スクリプト はエラー終了ステータス 127 を返しました
dpkg - 代わりに新規パッケージからスクリプトを実行してみます ...
/var/lib/dpkg/tmp.ci/postrm: 33: update-desktop-database: not found
dpkg: /var/cache/apt/archives/x2gognomebindings_2.0.1-1_amd64.deb の処理中にエラーが発生しました (--unpack):
サブプロセス 新 post-removal スクリプト はエラー終了ステータス 127 を返しました
/var/lib/dpkg/tmp.ci/postrm: 33: update-desktop-database: not found
dpkg: クリーンアップ中にエラーが発生しました:
サブプロセス 新 post-removal スクリプト はエラー終了ステータス 127 を返しました
shared-mime-info のトリガを処理しています ...
以下のパッケージの処理中にエラーが発生しました:
/var/cache/apt/archives/x2gognomebindings_2.0.1-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ubuntu-1:~#


un,,, this message seems to be the cause of this problem..
/var/lib/dpkg/info/x2gognomebindings.postrm: 33: update-desktop-database: not found
dpkg: 警告: サブプロセス 古い post-removal スクリプト はエラー終了ステータス 127 を返しました


check the status of x2gognomebindings .. half-installed ,,,
root@ubuntu-1:~# dpkg -s x2gognomebindings | egrep -i status
Status: install reinstreq half-installed


this means ..
# man dpkg
      half-installed
             The installation of the package has been started, but  not  com‐
             pleted for some reason.

      reinst-required
             A  package  marked  reinst-required is broken and requires rein‐
             stallation. These packages cannot be removed, unless forced with
             option --force-remove-reinstreq.


Let’s remove x2gognomebindings w/  dpkg -P --force-remove-reinstreq.

see same error
root@ubuntu-1:~# dpkg -P --force-remove-reinstreq x2gognomebindings
dpkg: 警告: overriding problem because --force enabled:
パッケージが非常に矛盾した状態に陥りました。
削除を行う前にこのパッケージを再インストールすべきです。
(データベースを読み込んでいます ... 現在 114110 個のファイルとディレクトリがインストールされています。)
x2gognomebindings を削除しています ...
/var/lib/dpkg/info/x2gognomebindings.postrm: 33: update-desktop-database: not found
dpkg: x2gognomebindings の処理中にエラーが発生しました (--purge):
サブプロセス installed post-removal script はエラー終了ステータス 127 を返しま した
以下のパッケージの処理中にエラーが発生しました:
x2gognomebindings


try this one. see same error
root@ubuntu-1:~# dpkg -P --force-all x2gognomebindings
dpkg: 警告: overriding problem because --force enabled:
パッケージが非常に矛盾した状態に陥りました。
削除を行う前にこのパッケージを再インストールすべきです。
(データベースを読み込んでいます ... 現在 114110 個のファイルとディレクトリがインストールされています。)
x2gognomebindings を削除しています ...
/var/lib/dpkg/info/x2gognomebindings.postrm: 33: update-desktop-database: not found
dpkg: x2gognomebindings の処理中にエラーが発生しました (--purge):
サブプロセス installed post-removal script はエラー終了ステータス 127 を返しま した
以下のパッケージの処理中にエラーが発生しました:
x2gognomebindings


The problem is that this ubuntu machine has no “update-desktop-database” , because I removed ubuntu desktop environment w/ tasksel.. 
Ouch, ouch. :(

create a dummy shell script. This script always retrun 0.
root@ubuntu-1:~# sh -c "echo 'exit 0' > /usr/sbin/update-desktop-database"

root@ubuntu-1:~# cat /usr/sbin/update-desktop-database
exit 0

root@ubuntu-1:~# chmod u+x /usr/sbin/update-desktop-database


try again!
root@ubuntu-1:~# dpkg -P --force-all x2gognomebindings
dpkg: 警告: overriding problem because --force enabled:
パッケージが非常に矛盾した状態に陥りました。
削除を行う前にこのパッケージを再インストールすべきです。
(データベースを読み込んでいます ... 現在 114110 個のファイルとディレクトリがインストールされています。)
x2gognomebindings を削除しています ...
x2gognomebindings の設定ファイルを削除しています ...
dpkg: 警告: while removing x2gognomebindings, directory '/usr/lib/nautilus' not empty so not removed.
root@ubuntu-1:~# echo $?
0


get it done ! I could remove :)
root@ubuntu-1:~# dpkg -s x2gognomebindings | egrep -i status
Status: unknown ok not-installed


remove dummy shell
root@ubuntu-1:~# rm /usr/sbin/update-desktop-database


apt-get upgrade succeeded :)
root@ubuntu-1:~# apt-get update;apt-get upgrade
root@ubuntu-1:~# echo $?
0
root@ubuntu-1:~#

ubuntu server : change keyboard map



# apt-get install console-data

change keyboard map




select “pc / qwerty / Japanese / Standard / Standard”

If you’d like to reconfigure this  , enter “dpkg-reconfigure console-data”

Ubuntu server: AppArmor

Ubuntu server : AppArmor

root@arizona:~# cat /etc/lsb-release | grep -i desc
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"

デフォルトで AppArmor が動いているみたい。

http://www.ubuntu.com/products/whatisubuntu/serveredition/features/apparmor

AppArmor とは ?

http://ja.opensuse.org/AppArmor

named.conf の directory を /var/named ( ubuntu の bind パッケージだと /var/cache/bind ) に変えたら、
下記のエラーがでて起動しなかったので、なんだろうと思ったら、AppArmor が原因だったみたい。

May 22 15:40:41 arizona kernel: [ 8077.028917] type=1503 audit(1274510441.827:20):  operation="open" pid=5520 parent=5517 profile="/usr/sbin/named" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/etc/named.conf"

対処としては2つ。

1. AppArmor を止める

root@arizona:~# /etc/init.d/apparmor stop
 * Unloading AppArmor profiles                                           [ OK ]

AppArmor が起動しないようにするには:

root@arizona:~# sysv-rc-conf apparomor off
root@arizona:~#

2. AppArmor の ルールを変更する

アプリごとのルールは /etc/apparmor.d/ にある。

root@arizona:/etc/apparmor.d# ls
abstractions       libvirt          usr.lib.libvirt.virt-aa-helper
cache              sbin.dhclient3   usr.sbin.cupsd
disable            tunables         usr.sbin.libvirtd
force-complain     usr.bin.evince   usr.sbin.named
gdm-guest-session  usr.bin.firefox  usr.sbin.tcpdump

下記追加。

root@arizona:/etc/apparmor.d# egrep "/var/named" usr.sbin.named
  /var/named/** rw,
  /var/named/ rw,


root@arizona:/etc/apparmor.d# /etc/init.d/apparmor restart

Ubuntu server : tasksel コマンド

root@arizona:~# cat /etc/lsb-release | grep -i desc

DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"

tasksel でパッケージ( LAMP , KVM , メールサーバ , デスクトップ環境 etc ) をまとめてインストールできる。

root@arizona:~# tasksel --help
Unknown option: help
使い方:
tasksel install <タスク>
tasksel remove <タスク>
tasksel [オプション]
-t, --test          テストモード: 実際には何も行わない
   --new-install   自動的にいくつかのタスクをインストールする
   --list-tasks    表示可能なタスクを一覧で表示して終了する
   --task-packages タスクで利用可能なパッケージを一覧表示する
   --task-desc     タスクの説明を返す

root@arizona:~# tasksel --list-tasks ( tasksel --list でも OK )
i server Basic Ubuntu server
u eucalyptus-walrus Cloud computing: Walrus storage service
u eucalyptus-simple-cluster Cloud computing: all-in-one cluster
u eucalyptus-cluster Cloud computing: cluster controller
u eucalyptus-node Cloud computing: node controller
u eucalyptus-storage Cloud computing: storage controller
u eucalyptus-cloud Cloud computing: top-level cloud controller
u dns-server DNS server
u edubuntu-server Edubuntu server
u lamp-server LAMP server
u mail-server Mail server
i openssh-server OpenSSH server
u postgresql-server PostgreSQL database
i print-server Print server
u samba-server Samba file server
u tomcat-server Tomcat Java server
u uec Ubuntu Enterprise Cloud (instance)
u virt-host Virtual Machine host
u ubuntustudio-graphics 2D/3D creation and editing suite
u ubuntustudio-audio Audio creation and editing suite
u edubuntu-desktop-kde Edubuntu KDE desktop
u edubuntu-desktop-gnome Edubuntu desktop
u kubuntu-desktop Kubuntu desktop
u kubuntu-netbook Kubuntu netbook
u ubuntustudio-audio-plugins LADSPA and DSSI audio plugins
u ubuntustudio-font-meta Large selection of font packages
u mythbuntu-desktop Mythbuntu additional roles
u mythbuntu-frontend Mythbuntu frontend
u mythbuntu-backend-master Mythbuntu master backend
u mythbuntu-backend-slave Mythbuntu slave backend
u ubuntu-netbook Ubuntu Netbook
i ubuntu-desktop Ubuntu desktop
u ubuntustudio-video Video creation and editing suite
u xubuntu-desktop Xubuntu desktop
u edubuntu-dvd-live Edubuntu live DVD
u kubuntu-netbook-live Kubuntu Netbook Remix live CD
u kubuntu-live Kubuntu live CD
u kubuntu-dvd-live Kubuntu live DVD
u netbook-live Ubuntu Netbook live environment
u ubuntu-live Ubuntu live CD
u ubuntu-dvd-live Ubuntu live DVD
u xubuntu-live Xubuntu live CD
u manual Manual package selection

仮想化環境のインストール

root@arizona:~# tasksel install  virt-host

でも、GUI ( virt-manager ) とかはいってなかったりする。
当たり前だけど、Fedora で yum groupinstall でKVMをインストールしたときと入るパッケージは異なる。

GUIを使う場合、virt-manager ,virt-viewer , python-virtinst が必要

root@arizona:~# apt-cache search virt-mana
virt-manager - 仮想マシン管理用デスクトップアプリケーション

root@arizona:~# apt-cache search virt-viewer
mozilla-virt-viewer - A virt-viewer widget for GTK+ (mozilla plugin)
virt-viewer - Displaying the graphical console of a virtual machine

root@arizona:~# apt-cache search python-virtinst
python-virtinst - Programs to create and clone virtual machines (transitional package)

Ubuntu server 9.10

GUI 設定、日本語入力 ( iBUS から SCIM へ変更 )

- GUI環境のインストール

# tasksel  -> Ubuntu desktop をインストール

パッケージの設定

  ┌──────────────────────────┤ ソフトウェアの選択 ├──────────────────────────┐
  │ 以下の定義済みソフトウェアコレクションからインストールするものを 1 つ以  │
  │ 上選択できます。                                                         │
  │                                                                          │
  │ インストールするソフトウェアの選択:                                      │
  │                                                                          │
  │    [ ] Large selection of font packages                              ↑   │
  │    [ ] Mythbuntu additional roles                                    ▒   │
  │    [ ] Mythbuntu frontend                                            ▒   │
  │    [ ] Mythbuntu master backend                                      ▒   │
  │    [ ] Mythbuntu slave backend                                       ▮   │
  │    [ ] Ubuntu MID edition                                            ▒   │
  │    [ ] Ubuntu Netbook Remix                                          ▒   │
  │    [*] Ubuntu desktop                 


- iBUS から SCIM へ

root@arizona:~# apt-get install scim scim-bridge-agent scim-bridge-client-gtk scim-anthy

システム -> システム管理 -> 言語サポート

キーボード入力に使うIMシステム を scim-bridge へ。

ログアウト ( or リブート )

Done!

Ubuntu 10.04 がリリースされてたんだ。。。
Fedora 11 から Ubuntu にしたばっかなのに、、うーん、インストールする前に
Ubuntu のページをチェックすればよかった。

Ubuntu Server : KVM

root@ubuntu-server:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"

root@ubuntu-server:~# uname -r
2.6.31-14-server

- KVMをインストール

tasksel -> Virtual Machine host を選択


ユーザ libvertd を追加

root@ubuntu-server:~# adduser `id -un` libvirtd

テスト

root@ubuntu-server:~# virsh -c qemu:///system list
Connecting to uri: qemu:///system
 Id Name                 State
----------------------------------

root@ubuntu-server:~#

- ネットワーク

デフォルトは NAT される。
ブリッジさせる場合は別途設定が必要。

- VMs 作成

root@ubuntu-server:~# apt-get install python-virtinst
root@ubuntu-server:~# apt-get install virt-viewer
root@ubuntu-server:~# apt-get install virt-manager

root@ubuntu-server:~# ls ISOs/*
ISOs/centos5.4-32bit.iso  ISOs/ubuntu-server9.10-64bit.iso  ISOs/winxp_pro.iso

Applications -> System Tools -> Virtual Machine Manager

VM をインストール


インストール完了


 Virtual machine manger の Shut down から Windows をシャットダウンできる。

Ubuntu Server: how to install VNC server

root@alaska:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"

root@alaska:~# uname -r
2.6.31-14-server

root@alaska:~# apt-cache search vnc
vnc4-common - 仮想ネットワークコンピューティングサーバソフトウェア
vnc4server - 仮想ネットワークコンピューティングサーバソフトウェア
vncsnapshot - VNC サーバから JPEG スナップショットを取得するユーティリティ
vtgrab - VNC ライクなコンソール監視プログラム

root@alaska:~# apt-get install vnc4server

vncserver を起動。
vnc viewer でアクセスするときに聞かれるパスワードを設定

root@alaska:~# vncserver

You will require a password to access your desktops.

Password:
Verify:

New 'alaska:1 (root)' desktop is alaska:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/alaska:1.log


root@alaska:~# lsof -i:5901
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
Xvnc    11935 root    4u  IPv4  39491      0t0  TCP *:5901 (LISTEN)

VNC client ( Windows の Ultra VNC Viewer ) から接続。

画面がしょぼい。。

VNC の xstartup コンフィグは ~/.vnc/xstartup にある。
シンボリックリンクにする。/etc/X11/Xsession ( startx したときに読み込むコンフィグ) を .vnc/xstartup へシンボリックリンク。

root@alaska:~/.vnc# pwd
/root/.vnc

root@alaska:~/.vnc# cp xstartup xstartup.org

root@alaska:~/.vnc# ls
alaska:1.log  alaska:1.pid  passwd  xstartup  xstartup.org

root@alaska:~/.vnc# rm -f xstartup
root@alaska:~/.vnc# ln -s /etc/X11/Xsession xstartup

vncserver を再起動

root@alaska:~/.vnc# kill vncserverのPID
root@alaska:~/.vnc# vncserver

再度接続。GUIがいつもの見慣れたやつになった。


接続できない場合は iptables ではじかれていないかチェック。

リストの表示

root@alaska:~/.vnc# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:53
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:67
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:67

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24    state RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

フラッシュ

root@alaska:~/.vnc# iptables -F

root@alaska:~/.vnc# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Ubuntu server 9.10 GUI のインストール方法

root@alaska:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"
root@alaska:~#

tasksel -> Ubuntu Desktop を選択。
セットアップに 20 - 30 分程度かかる。

root@alaska:~# tasksel


インストール後、startx を実行して完了。

見た目が ubuntu desktop と変わらないなー。しばらく server edition を使ってみるかな。。