firmware = "efi"
# GRUB_GFXMODE を書き換える。 sudo nano /etc/default/grub #GRUB_GFXMODE=1280x768 #GRUB_GFXPAYLOAD_LINUX=keep # grub.cfg を更新する。 sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo pacman -Syu # ロング オプションで書くとこうなります。 # sudo pacman --sync --refresh --sysupgrade # AUR のアップデートは yaourt で行います。 yaourt は sudo しません。 yaourt -Su --aur
sudo pacman -S bash-completion
sudo pacman -S fcitx-mozc fcitx-gtk2 fcitx-gtk3 fcitx-qt5 kcm-fcitx
export GTK_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx export QT_IM_MODULE=fcitx
export LANG="ja_JP.UTF-8" export XMODIFIERS="@im=fcitx" export XMODIFIER="@im=fcitx" export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export DefaultIMModule=fcitx
# Mate のファイル マネージャー、テキスト エディター、ターミナル。 sudo pacman -S caja pluma mate-terminal
sudo pacman -S mingw-w64 # mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads がインストールされる。 # ヘッダとランタイムの git を使用する場合は yaourt で AUR を入れる。 #yaourt -S mingw-w64-headers-git mingw-w64-crt-git
sudo pacman -S --needed git sudo pacman -S --needed automake autoconf libtool sudo pacman -S --needed cmake sudo pacman -S --needed docbook-xml docbook-xsl libxslt #sudo pacman -S --needed gtk-doc sudo pacman -S --needed intltool sudo pacman -S --needed gtk2 sudo pacman -S --needed gtk3 sudo pacman -S --needed libffi sudo pacman -S --needed xorg-util-macros sudo pacman -S --needed dos2unix # Gimp のビルドに GEGL コマンドが必要です。 sudo pacman -S --needed gegl # xmingw32 スクリプトは 7zip コマンドを使用します。 sudo pacman -S --needed p7zip # bsdtar
# AUR (en) - mingw-w64-gcc <https://aur.archlinux.org/packages/mingw-w64-gcc/> yaourt -S mingw-w64-binutils --noconfirm yaourt -S mingw-w64-headers --noconfirm yaourt -S mingw-w64-headers-bootstrap --noconfirm yaourt -S mingw-w64-gcc-base --noconfirm yaourt -S mingw-w64-crt --noconfirm sudo pacman -Rdd --noconfirm mingw-w64-headers-bootstrap yaourt -S mingw-w64-winpthreads --noconfirm sudo pacman -Rdd --noconfirm mingw-w64-gcc-base # 一時ファイルを保存するフォルダーをカレント フォルダー($PWD)にしている。 yaourt -S mingw-w64-gcc --noconfirm --tmp $PWD
# AUR (en) - mingw-w64-gcc-bin <https://aur.archlinux.org/packages/mingw-w64-gcc-bin/> yaourt -S mingw-w64-binutils-bin --noconfirm yaourt -S mingw-w64-headers-bin --noconfirm yaourt -S mingw-w64-crt-bin --noconfirm yaourt -S mingw-w64-winpthreads-bin --noconfirm yaourt -S mingw-w64-gcc-bin --noconfirm
echo 'void main(){printf("hello world!\n");}' > hello.c i686-w64-mingw32-gcc hello.c -o hello_win32.exe x86_64-w64-mingw32-gcc hello.c -o hello_win64.exe ls hello* -lh file hello_win32.exe # hello_win32.exe: PE32 executable (console) Intel 80386, for MS Windows file hello_win64.exe # hello_win64.exe: PE32+ executable (console) x86-64, for MS Windows # wine をインストールしているのであれば wine で実行できます。 wine hello_win32.exe wine hello_win64.exe
pacman -Ql mingw-w64-gcc | grep 'dll$' pacman -Ql mingw-w64-winpthreads | grep 'dll$' # win32: /usr/i686-w64-mingw32/bin/*.dll # win64: /usr/x86_64-w64-mingw32/bin/*.dll
TARGET=i686-w64-mingw32 # or x86_64-w64-mingw32 configure --cache-file="cross-config.cache" --target=${TARGET} --host=${TARGET} --build=${MACHTYPE} rm cross-config.cache
(configure && make) 2>&1 | tee build.log
sudo mkdir -p /media/userdata
LABEL=userdata /media/userdata auto defaults 0 0
sudo mount /media/userdata mount | grep /media # アンマウントは umount コマンドで行う。 sudo umount /media/userdata
lsblk -f
LABEL=swap none swap sw 0 0
sudo swapon -a # スワップが有効になったか確認する。 free -h # スワップを無効にするには swapoff する。 sudo swapoff -a
df -h free -h
# ext 4 など。 sudo fsck /dev/sda1 sudo fsck LABEL=userdata # btrfs sudo btrfs check /dev/sda1
sudo bacman htop sudo pacman -R htop htop sudo pacman -U htop-*.pkg.tar.xz # q で終了。 htop
pacman -Sg linux414-extramodules
grep /var/log/pacman.log -ne \.pacnew
diff -u /etc/pacman-mirrors.conf /etc/pacman-mirrors.conf.pacnew
# バックアップする。 sudo mv /etc/pacman-mirrors.conf /etc/pacman-mirrors.conf.bak # ファイルを置き換える。 sudo mv /etc/pacman-mirrors.conf.pacnew /etc/pacman-mirrors.conf
journalctl --disk-usage
journalctl -b -p err
# 容量で切り詰める。 512MB で切り詰める。 journalctl --vacuum-size=512M # 時間で切り詰める。過去2か月のログを残し切り詰める。 journalctl --vacuum-time=2month
[Journal] #Storage=persistent SystemMaxUse=512M SystemMaxFileSize=32M RuntimeMaxUse=256M RuntimeMaxFileSize=32M
pacman -Ql `LANG=c pacman -Qo \`which コマンド名\` | cut -d' ' -f5`
pacman -Ql $(LANG=c pacman -Qo $(which コマンド名) | cut -d' ' -f5)
pacman -Ql bash | grep -ie html\$
/dev/sda1:Windows 7:Windows:chain
/dev/sda2:Windows 7:Windows1:chain
/dev/sda4:Windows Recovery Environment:Windows2:chain
# インストールパーティションのパスを確認する。 mount | grep " / " # PBR をファイルに保存する。 sudo dd if=/dev/sda5 of=manjaro.pbr bs=512 count=1
# マウントするフォルダーを作成する。 mkdir -p win # マウントする。 sudo mount /dev/sda2 $PWD/win # パーティションのトップレベルのファイル一覧を確認する。 ls win
# ファイルに保存した PBR をコピーする。 cp manjaro.pbr win/. # アンマウントする。 sudo umount win
cd /d %SystemDrive% bcdedit /create /d "Manjaro" /application BOOTSECTOR REM 波括弧({})で括られた ID が表示されます。これをメモしておきます。 REM 以下、ここで表示された ID を {ID} で表します。 REM コマンドを実行する際は {ID} を実際の ID に置き換えてください。 bcdedit /set {ID} device partition=%SystemDrive% bcdedit /set {ID} path \manjaro.pbr bcdedit /displayorder {ID} /addlast
SUBSYSTEM=="usb" ENV{UDISKS_AUTO}="0"
sfdisk -d /dev/sda > sda.bkp cp sda.bkp sda.new # テキストエディターで編集する。 kwrite sda.new # 編集内容を書き戻す。とても危険です! sudo sfdisk --no-reread -f /dev/sda < sda.new
# パーティション一覧を表示する。 ls # パーティションの内容を表示する。 # /dev/sda5 に Manjaro がインストールされていると想定している。 ls (hd0,msdos5) # 合っていれば次へ進む。 set prefix=(hd0,msdos5)/boot/grub set root=(hd0,msdos5) insmod gzio insmod part_msdos # パーティションが btrfs なら insmod btrfs する。 insmod btrfs insmod linux # /boot のファイルを確認する。 ls (hd0,msdos5)/boot # vmlinuz-* と initramfs-* を下記コマンドで指定する。 # 下記では x86_64 の 4.9.x カーネルを指定している。 linux /boot/vmlinuz-4.9-x86_64 root=/dev/sda5 initrd /boot/intel-ucode.img /boot/initramfs-4.9-x86_64.img # ブートする。 boot
# /dev/sda5 に Manjaro がインストールされていると想定している。 sudo grub-install --target=i386-pc --force /dev/sda5 sudo update-grub
Presence of the word GRUB at the top left of the monitor with no blinking cursor indicates that GRUB 2 can not even find the Master Boot Record (or equivalent) information. Thus, the core.img file, the /boot and /grub folder locations and contents are completely unknown to GRUB 2.
# immutable 属性を外す。これがついていると更新削除名称変更ができない。 sudo chattr -i /boot/grub/i386-pc/core.img # インストールパーティションのパスを確認する。 mount | grep " / " # /dev/sda5 に Manjaro がインストールされていると想定している。 sudo grub-install --target=i386-pc --debug --force /dev/sda5 # immutable 属性を付ける。 sudo chattr +i /boot/grub/i386-pc/core.img sudo update-grub
Warning: /lib/modules/4.9.39-1-MANJARO/modules.devname not found - Ignoring starting version 232 mount: can't find 'UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' sh: can’t access tty: job control turned off [rootfs ]#
# root になります。 su # lsblk コマンドで Manjaro システムのパーティションを確認します。 lsblk -fa # マウントポイント。ファイラー( Konqueror )でマウント済みであれば /run から始まるパス。 mp=/mnt # マウントしていない場合はマウントする。 # sda1 が Manjaro のパーティションと想定している。 mount /dev/sda1 $mp # 正しくマウントされているか確認する。 ls $mp # 現在のシステムが認識しているもろもろを作業対象のシステムが認識できるようにする。 # 以下の処理と chroot は manjaro-chroot コマンドでまとめて行える。 mount -t proc proc $mp/proc mount -t sysfs sys $mp/sys mount -o bind /dev $mp/dev mount -t devpts pts $mp/dev/pts/ # (U)EFI/GPT では $mp/boot/efi に ESP パーティションをマウントする。 # chroot する。現在のシステムと対象のシステムのアーキテクチャが同じでなければならない。 chroot $mp /bin/bash # 最新の状態にアップデートする。 pacman -Syyu # カーネルがアップデートされなかった場合はカーネルを再インストールする。 # カーネルのバージョンは 4.9 系を想定している。 pacman -S linux49 # キャッシュのパッケージから再インストールする場合。 # 4.9.39-1 x86_64 を想定している。 pacman -U /var/cache/pacman/pkg/linux49-4.9.39-1-x86_64.pkg.tar.xz # エラーなく終了したことを確認し、 chroot を抜ける。 exit
ディストリ | コマンド |
Manjaro (Arch) | pacman |
Msys2 | pacman |
Ubuntu | apt-get |
Debian | apt-get |
Fedora | dnf |
openSUSE | zypper |
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync --refresh pacman -Sy pacman --sync --sysupgrade pacman -Su # Manjaro, Arch などで AUR の更新を行う。 pacman -Syu したあと実行する。下はショート。 yaourt --sync --sysupgrade --aur yaourt -Sua # Ubuntu, Debian など。 apt-get update apt-get upgrade # or dist-upgrade # openSUSE。 zypper refresh zypper update --no-recommends
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync --refresh pacman -Sy pacman --sync --sysupgrade --downloadonly pacman -Suw # Ubuntu, Debian など。 apt-get update apt-get upgrade --download-only # or dist-upgrade # openSUSE。 zypper refresh zypper update --no-recommends --download-only
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync pacman -S # Ubuntu, Debian など。 apt-get install # Fedora, Korora など。 dnf install # openSUSE。 zypper install
# Msys2, Manjaro, Arch など。 pacman --sync --asdeps pacman --sync --asexplicit pacman --database --asdeps pacman --database --asexplicit # Ubuntu, Debian など。 apt-mark auto apt-mark manual # Fedora, Korora など。 dnf mark # openSUSE。
# Msys2, Manjaro, Arch など。下はショート。 pacman --remove --recursive pacman -Rs # Ubuntu, Debian など。 apt-get remove # Fedora, Korora など。 dnf remove # openSUSE。下はショート。 zypper remove --clean-deps zypper rm -u
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync --search pacman -Ss # Ubuntu, Debian など。 apt-cache search # Fedora, Korora など。 dnf search # openSUSE。下はショート。 zypper search zypper se
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync --info pacman -Si pacman --sync -ii pacman -Sii # Ubuntu, Debian など。 apt-cache show # Fedora, Korora など。 # openSUSE。 zypper info
# Msys2, Manjaro, Arch など。下はショート。 pacman --query --search pacman -Qs # Ubuntu, Debian など。 apt list --installed # Fedora, Korora など。 # openSUSE。下はショート。 zypper search --installed-only zypper se -i
# Msys2, Manjaro, Arch など。下はショート。 pacman --query --list pacman -Ql pacman --files --list pacman -Fl pacman --sync --list pacman -Sl # Ubuntu, Debian など。 dpkg --listfiles # Fedora, Korora など。 # openSUSE。下はショート。 rpm --query --list rpm -ql
# Msys2, Manjaro, Arch など。下はショート。 # Ubuntu, Debian など。 apt-get autoremove # Fedora, Korora など。 dnf autoremove # openSUSE。
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync -cc pacman -Scc # Ubuntu, Debian など。 apt-get clean # Fedora, Korora など。 dnf clean # openSUSE。 # openSUSE はダウンロードしたパッケージを自動で削除する。
# Msys2, Manjaro, Arch など。下はショート。 pacman --sync --clean pacman -Sc # Ubuntu, Debian など。 apt-get autoclean # Fedora, Korora など。 # openSUSE。
# Msys2, Manjaro, Arch など。下はショート。 pacman --query --owns pacman -Qo pacman --files --owns pacman -Fo # Ubuntu, Debian など。 # Fedora, Korora など。 # openSUSE。下はショート。 rpm --query --file rpm -qf
# Msys2, Manjaro, Arch など。下はショート。 # Ubuntu, Debian など。 apt-cache depends # Fedora, Korora など。 # openSUSE。
su - root passwd exit