2015年11月30日月曜日

★ manjaro で uefi かつ btrfs ; fcitx も 大丈夫だ


 legasy (non UEFI) + btrfs




まず wifiを認識させます


これでインストール開始


日本語でインストールします


時刻です


日本語キーボード



ここからが むずい



/dev/sdaが USBハードディスクです。
容量でわかります

 ブートローダーも /dev/sdaにいれなければなりません。
/dev/sda1は btrfs
/dev/sda2は   swap
です。
試行錯誤してたどりついてください





このあとは簡単です。




UEFI + btrfs です。

1) boot画面です

2)ただし 右下隅で wifi を接続したのち 以下のをクリックして インスト始めます。

3)USB ハードディスクにインストするので /dev/sdb を選びます

4)まず UEFIです
fat32
/boot/efi
esp
に注意



5)以下なふうにしました。 
swap は 2G位 とってください。

7)以下は再起動後の画面です
  まず wifi の設定です

8)pacman -S fcitx-im fcitx-configtool fcitx-mozc

nano /home/arch/.xprofile を
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

のあと 右下のキーボードを右クリックしたらでます


再起動だけで いくようで
以下はまず不必要です

9)で まず右端のをクリックして



FluxBB bbcode test



10)それから 左の+をクリックして MOZCを選びます
FluxBB bbcode test


以上で 日本語入力までできました。

さて UEFI +BTRFS なmanjaroは 一体どうなってるのでしょう。


A) fdisk -l /dev/sdb
Disk /dev/sdb: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 176D0FC1-E4B7-4F75-AF7E-8CA5689B7BEC

Device       Start       End   Sectors   Size Type
/dev/sdb1  1050624   1067007     16384     8M Linux swap
/dev/sdb2  1067008 312576671 311509664 148.6G Linux filesystem
/dev/sdb3     2048   1050623   1048576   512M EFI System


B)/boot/grub/grub.cfg
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi
function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
set menu_color_normal=light-gray/black
set menu_color_highlight=green/black
if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod btrfs
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  866103fe-6597-4fbf-9e85-b1b5065c120b
else
  search --no-floppy --fs-uuid --set=root 866103fe-6597-4fbf-9e85-b1b5065c120b
fi
    font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod btrfs
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  866103fe-6597-4fbf-9e85-b1b5065c120b
else
  search --no-floppy --fs-uuid --set=root 866103fe-6597-4fbf-9e85-b1b5065c120b
fi
insmod png
background_image -m stretch /usr/share/grub/background.png
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
else
  set timeout=5
fi
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-866103fe-6597-4fbf-9e85-b1b5065c120b' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod btrfs
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  866103fe-6597-4fbf-9e85-b1b5065c120b
else
 search --no-floppy --fs-uuid --set=root 866103fe-6597-4fbf-9e85-b1b5065c120b
fi
echo 'Loading Linux 4.4.28-2-MANJARO x64 ...'
linux /boot/vmlinuz-4.4-x86_64 root=UUID=866103fe-6597-4fbf-9e85-b1b5065c120b rw  quiet splash resume=UUID=e029ea6e-971a-4ae1-a54e-1bed4f658057
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.4-x86_64.img
}





        mkdir /mb3
[BtrUefi fuji]# mount /dev/sdb3 /mb3
[BtrUefi fuji]# ls /mb3

EFI
[BtrUefi fuji]# ls -l /mb3/EFI/
total 8
drwxr-xr-x 2 root root 4096 11月  7  2016 boot
drwxr-xr-x 2 root root 4096 11月  7  2016 Manjaro
[BtrUefi fuji]# ls -l /mb3/EFI/Manjaro/
total 152
-rwxr-xr-x 1 root root 154624 11月  7  2016 grubx64.efi
[BtrUefi fuji]# ls -l /mb3/EFI/boot/
total 152

-rwxr-xr-x 1 root root 154624 11月  7  2016 bootx64.efi


[BtrUefi fuji]# mkdir /mb2
[BtrUefi fuji]# mount /dev/sdb2 /mb2
[BtrUefi fuji]# ls /mb2
bin   etc   lib64  mb2  opt   root-image-pkgs.txt  srv  usr
boot  home  ma6    mb3  proc  run                  sys  var
dev   lib   mb1    mnt  root  sbin                 tmp  xfce-image-pkgs.txt

となってます。

[BtrUefi fuji]# btrfs filesystem show
Label: none  uuid: 866103fe-6597-4fbf-9e85-b1b5065c120b
Total devices 1 FS bytes used 4.80GiB
devid    1 size 148.54GiB used 7.02GiB path /dev/sdb2



/etc/fstab 
UUID=635c5859-fff2-4b57-b578-47af4361ad80 swap           swap    defaults,noatime 0       0
UUID=ECBC-CE0A                            /boot/efi      vfat    defaults,noatime 0       2
UUID=e029ea6e-971a-4ae1-a54e-1bed4f658057 swap           swap    defaults,noatime 0       0
UUID=866103fe-6597-4fbf-9e85-b1b5065c120b /              btrfs   defaults,noatime,space_cache,autodefrag 0       1

arch そのものではありません。
./comment-out.bat /etc/pacman.d/mirrorlist | grep jp
Server = http://ftp.tsukuba.wide.ad.jp/Linux/manjaro/stable/$repo/$arch
Server = http://ftp.riken.jp/Linux/manjaro/stable/$repo/$arch

だからです。

ともかくとして manjaroで uefiでbtrfsのはできました。









以下はだいぶ前の記事です。
KVMでmanjaro動かしてみました。
qemu-system-x86_64 -enable-kvm -m $1 -hda $2 -net nic,macaddr=52:54:00:12:11:11 -net tap,ifname=tap0,script=/etc/qemu-ifup -smp cores=2



 1) /etc/pacman.d/mirrorlistの頭に
Server = http://manjaro.mirror.garr.it/mirrors/manjaro/stable/$repo/$arch
Server = http://mirror.nexcess.net/manjaro/stable/$repo/$arch

##
## Manjaro Linux repository mirrorlist
## Generated on 27 September 2015 08:38
##
## Use pacman-mirrors to modify
##


## Location  : Africa
## Time      :99.99
## Last Sync : 99:99
Server = http://mirror.is.co.za/mirrors/manjaro.org/stable/$repo/$arch

 かかないとアフリカにいってとんでもなく遅くなります



2) archと同じく topで2CPUを表示してくれます。
Tasks: 125 total,   1 running, 124 sleeping,   0 stopped,   0 zombie
%Cpu0  :   2.7/1.3     4[||                                                   ]
%Cpu1  :   0.7/0.7     1[                                                     ]
GiB Mem : 59.9/0.974    [                                                     ]
GiB Swap:  0.0/2.200    [                                                     ]

uname -ar
Linux man-pc 4.1.8-1-MANJARO #1 SMP PREEMPT Tue Sep 22 16:29:17 UTC 2015 x86_64 GNU/Linux
とカーネルがあたらしいせいでしょうか?



3)grub  でが ちょっと変わってます。
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bca56cba-b301-4f85-92b0-f88beb6bc7a7' {
    savedefault
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  bca56cba-b301-4f85-92b0-f88beb6bc7a7
    else
      search --no-floppy --fs-uuid --set=root bca56cba-b301-4f85-92b0-f88beb6bc7a7
    fi
    echo    'Loading Linux 4.1.8-1-MANJARO x64 ...'
    linux    /boot/vmlinuz-4.1-x86_64 root=UUID=bca56cba-b301-4f85-92b0-f88beb6bc7a7 rw  quiet splash resume=UUID=79802035-9697-4a08-ae39-dda2efbb626e
    echo    'Loading initial ramdisk ...'
    initrd    /boot/intel-ucode.img /boot/initramfs-4.1-x86_64.img
}


ここで 
bca56cba-b301-4f85-92b0-f88beb6bc7a7 は  root の blkid

79802035-9697-4a08-ae39-dda2efbb626e は   swapの blkid
です




4)日本語化も簡単ですので 初心者はarchは manjaroからはいったほうがいいでしょう。



にがて 

別のパソコンへ クローンして起動 ( tar  で インストール )



以下のを繰り返すと 
インストールは必要なくなります。
tar での コピーでいいことになります。
ねc

確かに clonezillaをつかってもいいのですが、
DESKTOP lenovoを NOTE necに 物理的にくっつけるのは
無理なので usb HDD (いつものバックアップ先)を仲介させてます。

もちろん clonezillaで ローカルHDD ー> リモートHDDとネットを軽油することも
ありえますが、 遅いのではないかと考えました。


LENOVOのsda2にarch があってこれを NECのPCの sda6 に写します。
つまり クローンです。


 LENOVOのsda2  ー>USB HDDのsdb2  ー>NECのPCの sda6
 で 
 USB HDDのsdb2
 を仲介させてます。


1)まず  LENOVO USB HDDをつけます

 そしてarchでないLINUXを起動します。
(自分はdebiandogを起動)

 /mnt/sda2は  LENOVOの  /dev/sda2
 /mnt/sdb2は USB HDDの /dev/sdb2
です。

ここで

 ./comment-out.bat /Arch-backup.bat 
ーーーーーーーーーーーーーーーーーーーー
y='/mnt/sda2'
z='/mnt/sdb2/Arch-LENOBO-Backup'
mkdir -p $z
df
echo $y  '--->'   $z
echo ' push some key '

read $X
echo $X
cd $y
for x in bin boot  dev etc home  lib lib64 media opt proc root run sbin srv sys tmp usr var
do
(cd $y ; tar cvpf - $x)|( cd $z ; tar xpf -)
done



して、lenovo のarch を  usb HDD に写します。


実はこの灰色の部分は日頃してますので 新たな手間はかかってません。
だから ほんとは
 z='/mnt/sdb2/Arch-NEC-Backup-'`date +%m%d%H`
なのですが 
説明のため
z='/mnt/sdb2/Arch-LENOBO-Backup'
にしてます。 




2)lenovoから usb HDDを外し
これを nec にくっつけます。

 /mnt/sda6は NECの     /dev/sda6 
 /mnt/sdb2は USB HDDの /dev/sdb2 
となってます


(cd /mnt/sdb2/Arch-LENOBO-Backup ; tar cvpf - .)|(cd /mnt/sda6 ; tar - )
で ファイルが NECの/dev/sda6に 写ります。





3)/mnt/sda6/boot/grub/grub.cfg 
の書き換え

if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi
function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  6c44812a-1341-4be3-ba69-704ff6ad1fae
else
  search --no-floppy --fs-uuid --set=root 6c44812a-1341-4be3-ba69-704ff6ad1fae
fi
    font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=10
  else
    set timeout=10
  fi
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
function gfxmode {
        set gfxpayload="${1}"
        if [ "${1}" = "keep" ]; then
                set vt_handoff=vt.handoff=7
        else
                set vt_handoff=
        fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu-Bohdi' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-6c44812a-1341-4be3-ba69-704ff6ad1fae' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  6c44812a-1341-4be3-ba69-704ff6ad1fae
        else
          search --no-floppy --fs-uuid --set=root 6c44812a-1341-4be3-ba69-704ff6ad1fae
        fi
        linux   /boot/vmlinuz-3.16.0-45-generic root=UUID=6c44812a-1341-4be3-ba69-704ff6ad1fae ro  quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.16.0-45-generic
}
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-EAFCC37CFCC34195' {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  EAFCC37CFCC34195
        else
          search --no-floppy --fs-uuid --set=root EAFCC37CFCC34195
        fi
        parttool ${root} hidden-
        chainloader +1
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
menuentry ' DebianDog Jessie ' {
set root='hd0,msdos4'
linux  /live/vmlinuz1 root=/dev/sda4 noauto from=/ changes=/live/
initrd /live/initrd1.xz
}


menuentry 'Arch 64'   {
set root='hd0,msdos6'
linux   /boot/vmlinuz-linux root=/dev/sda6 rw quiet
initrd  /boot/initramfs-linux.img
}


if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi








4)/mnt/sda6/etc/fstabの書き換え 

/dev/sda6       /        ext4      rw,relatime,data=ordered        0 1
/dev/sda5  none         swap    sw                0      0



5)qemu のために
/mnt/sda6/etc/netctl/bridge の書き換え



                                                                            
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(enp0s25 tap0)
IP=dhcp
 


これで lenovo のが NECにクローンされました。
楽です。