0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Lubuntu 18.04 つまずき

Last updated at Posted at 2022-06-15

前提

参考サイト

要素

言語設定

sudo timedatectl set-timezone Asia/Tokyo && \
sudo localedef -f UTF-8 -i en_US en_US && sudo localedef -f UTF-8 -i ja_JP ja_JP && \
sudo localectl set-locale LANG=en_US.utf8 

Wi-Fi設定

IPアドレスの確認
ifconfigコマンドがデフォルトでインストールされなくなったので、ipコマンドで確認。

ip addr
#(2020-05-28 自分用にメモ追記)
# ネットワークの状態を詳細に確認するなら、下記コマンドが便利。
networkctl status -a

参考:Ubuntu 20.04 LTSで固定IPアドレスの設定

/etc/netplan/99-custom.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      optional: true
      addresses: [192.168.0.70/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.1, 8.8.8.8, 8.8.4.4]
  wifis:
    wlan0:
      dhcp4: no
      dhcp6: no
      optional: true
      addresses: [192.168.0.20/24]
      nameservers:
        addresses: [192.168.0.1, 8.8.8.8]
      access-points:
        "<SSID1>":
          password: "********"
        "<SSID2>":
          password: "********"
      routes:
        - to: default
          via: 192.168.0.1
        
  # ここの行を追加しないと,うまく繋がらなかったりする
  version: 2
  renderer: NetworkManager
99-custom.yaml
network:
  version: 2
  wifis:
    wlan0:
      dhcp4: true
      optional: true
      access-points:
        "<SSID>":
          password: "********"

IPアドレス設定変更の反映
netplan applyを実行して反映します。再起動不要です。

sudo netplan apply

# Warning: ~~~~が出た時,
systemctl daemon-reload

期待値&何が起きているのか

  • Wi-Fiにすんなり接続して欲しいがほとんど繋がらない
  • 再起動時にubuntu a start job is running for wait for network to be configuredというエラーで起動が遅い現象が起きた

解決

Wi-Fiにすんなり接続して欲しいがほとんど繋がらない

下の行の renderer: NetworkManagerを追記すると安定した。
NetPlanはnetworkdNetworkManagerをサポートしていますが、WiFiを使用するときはNetworkManagerを使わないといけないようです。

再起動時にubuntu a start job is running for wait for network to be configuredというエラーで起動が遅い現象が起きた

/etc/netplan/*.yamloptional: trueを追記することで明示的に接続を待つ必要が無い事をOS側に設定できる

ssh設定

公開鍵の登録

ssh-import-id gh:*******

hostname変更

hostnamectl set-hostname *******

apt update && upgarde がflash-kernelエラー1で完走できない

期待値&何が起きているのか

sudo apt update && sudo apt upgradeで全てのパッケージを最新にして欲しい。
以下のようなエラーが出て更新が中断される

sudo apt upgrade
dpkg: パッケージ flash-kernel の処理中にエラーが発生しました (--configure):
 サブプロセス インストール済みの post-installation スクリプト はエラー終了ステータス 1 を返しました

解決策

  • パッケージ管理システムのデータベースをチェック
    • "--audit"オプションで、パッケージDBの健全性・整合性をチェック。
  • 未設定のパッケージを再設定
    • 上記、メッセージに従い"--configure"オプションを使って、設定作業を再試行。
  • エラースクリプトの削除
    • 壊れたアップグレードスクリプトを削除。
  • 適用
    • 再度、"--configure"オプションを使って設定すると正常終了

Rustが起動のたびに読み込まないと動かない

期待値&何が起きているのか

有効化を継続したい
有効化しバージョンが確認できることを確認したが再起動後、無効化される

source $HOME/.cargo/env
# コマンド確認
rustc --version
cargo --version

解決

~/.zshrcへ追記

# Rust
export PATH=$HOME/.cargo/bin:$PATH

# こっちでもいいかも(未確認)
[ -f ~/.cargo ] && source $HOME/.cargo/env

busybox (initramfs)が出て起動できなくなった

記録媒体にダメージがあったことが原因のよう

# 表示されているデバイスを入力
(initramfs)fsck -y /dev/sda1
# 修復が終わったら再起動
(initramfs)reboot

おまけ

シェルとプロンプト設定

.dot(ドット)ファイル

~/.zshrc (ubuntu-RasPi4)
eval "$(starship init zsh)"
# aliases
alias g=git
alias vim=nvim
# Go
export GOPATH=/home/ubuntu/go
export PATH=/bin:/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh


setopt autocd              # change directory just by typing its name
#setopt correct            # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst     # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch           # hide error message if there is no match for the pattern
setopt notify              # report the status of background jobs immediately
setopt numericglobsort     # sort filenames numerically when it makes sense
setopt promptsubst         # enable command substitution in prompt

WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word

# hide EOL sign ('%')
PROMPT_EOL_MARK=""

# configure key keybindings
bindkey -e                                        # emacs key bindings
bindkey ' ' magic-space                           # do history expansion on space
bindkey '^[[3;5~' kill-word                       # ctrl + Supr
bindkey '^[[3~' delete-char                       # delete
bindkey '^[[1;5C' forward-word                    # ctrl + ->
bindkey '^[[1;5D' backward-word                   # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history    # page up
bindkey '^[[6~' end-of-buffer-or-history          # page down
bindkey '^[[H' beginning-of-line                  # home
bindkey '^[[F' end-of-line                        # end
bindkey '^[[Z' undo                               # shift + tab undo last action

# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups       # ignore duplicated commands history list
setopt hist_ignore_space      # ignore commands that start with space
setopt hist_verify            # show command with history expansion to user before running it
#setopt share_history         # share command history data

# force zsh to show the complete history
alias history="history 0"

# enable color support of ls, less and man, and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
    alias diff='diff --color=auto'
    #alias ip='ip --color=auto'

    export LESS_TERMCAP_mb=$'\E[1;31m'     # begin blink
    export LESS_TERMCAP_md=$'\E[1;36m'     # begin bold
    export LESS_TERMCAP_me=$'\E[0m'        # reset bold/blink
    export LESS_TERMCAP_so=$'\E[01;33m'    # begin reverse video
    export LESS_TERMCAP_se=$'\E[0m'        # reset reverse video
    export LESS_TERMCAP_us=$'\E[1;32m'     # begin underline
    export LESS_TERMCAP_ue=$'\E[0m'        # reset underline

    # Take advantage of $LS_COLORS for completion as well
    zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
    zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
fi


# exaがインストールされている場合のみ有効化
if [[ $(command -v exa) ]]; then
  # ls
  alias e='exa --icons --git'
  alias l=e
  alias ls=e
  # ls -a
  alias ea='exa -a --icons --git'
  alias la=ea
  # ls -la
  alias ee='exa -aahl --icons --git'
  alias ll=ee
  # ls & Tree
  alias et='exa -T -L 3 -a -I "node_modules|.git|.cache" --icons'
  alias lt=et
  # 謎
  #alias eta='exa -T -a -I "node_modules|.git|.cache" --color=always --icons | less -r'
  #alias lta=eta
  # clear
  alias l='clear && ls'
else
  # some more ls aliases
  alias ll='ls -l'
  alias la='ls -A'
  alias l='ls -CF'
fi

# 関数 1 GHQ fzf
function ghq-fzf_change_directory() {
    # 選択したリポジトリへ移動 かつ
    # 右にリポジトリのディレクトリ詳細を表示
  local src=$(ghq list | fzf --preview "exa -l -g -a --icons $(ghq root)/{} | tail -n+4 | awk '{print \$6\"/\"\$8\" \"\$9 \" \" \$10}'")
  if [ -n "$src" ]; then
    BUFFER="cd $(ghq root)/$src"
    zle accept-line
  fi
  zle -R -c
}

zle -N ghq-fzf_change_directory
bindkey '^f' ghq-fzf_change_directory

# 関数 2 cd & ls
function chpwd() {
  if [[ $(pwd) != $HOME ]]; then;
    ls
  fi
}

# enable auto-suggestions based on the history
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
    . /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    # change suggestion color
    ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi

# enable command-not-found if installed
if [ -f /etc/zsh_command_not_found ]; then
    . /etc/zsh_command_not_found
fi

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?