rpi_common

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
rpi_common [2019/04/21 16:02] – [General Things on Raspbian] Júne Parkrpi_common [2020/07/28 11:28] – [Modify login message] Júne Park
Line 1: Line 1:
 <nav>  <nav> 
   * {{fa>server?color=#8B0000}} Linux   * {{fa>server?color=#8B0000}} Linux
-    * [[:rpi_common|General Things on Raspbian]]+    * [[:rpi_common|■ General Things on Raspbian]]
     * [[:rpi_autism|Media Ditorium ─ AUTiSM Rainbow]]     * [[:rpi_autism|Media Ditorium ─ AUTiSM Rainbow]]
     * [[:rpi_epigen|Private Cellarium ─ EPiGEN Crystal]]     * [[:rpi_epigen|Private Cellarium ─ EPiGEN Crystal]]
     * [[:rpi_nimbus|Webius Officium ─ NiMBUS deBlanc]]     * [[:rpi_nimbus|Webius Officium ─ NiMBUS deBlanc]]
-    * [[:debian_common|General info on Debian Linux]]+    * [[:debian_common|■ General info on Debian Linux]]
     * [[:deb_mutism|Opus Imperium ─ MUTiSM Magnum]]     * [[:deb_mutism|Opus Imperium ─ MUTiSM Magnum]]
 +    * [[:deb_gilead|Actu Periculum ─ GiLEAD Argenta]]
 +    * [[:deb_debris|Finca LaDichium ─ DEBRiS Chrome]]
   * {{fa>windows?color=#0000A0}} Windows   * {{fa>windows?color=#0000A0}} Windows
-    * [[:pc_common|Common Works on Windows]]+    * [[:pc_common|■ Common Works on Windows]]
     * [[:pc_mesonism|Primus Workstation ─ MESONiSM]]     * [[:pc_mesonism|Primus Workstation ─ MESONiSM]]
     * [[:pc_mesonium|Manibus Tablet ─ MESONiUM]]     * [[:pc_mesonium|Manibus Tablet ─ MESONiUM]]
Line 14: Line 16:
     * [[:pc_mesonity|Praevus Station ─ MESONiTY]]     * [[:pc_mesonity|Praevus Station ─ MESONiTY]]
   * {{fa>android?color=#006400}} Android   * {{fa>android?color=#006400}} Android
-    * [[:cell_common|Common Stuffs on Androids]]+    * [[:cell_common|■ Common Stuffs on Androids]]
     * [[:cell_epiaux|Júne's Primus ─ EPiAUX 5X]]     * [[:cell_epiaux|Júne's Primus ─ EPiAUX 5X]]
     * [[:cell_epihex|Júne's Extentus ─ EPiHEX 6]]     * [[:cell_epihex|Júne's Extentus ─ EPiHEX 6]]
Line 22: Line 24:
 </nav> </nav>
  
-===== General Things on Raspbian ===== +====== General Things on Raspbian ====== 
  
-{{:playground:boo_the_bunny_13.png?nolink&250|}}+{{:playground:boo_the_bunny_13.png?nolink&200|}}
  
 ---- ----
  
-==== Initial steps for Raspbian ====  +===== First step for Raspberry OS =====
-  * Write [[https://www.raspberrypi.org/downloads/raspbian/|Raspbian Image]] on microSD memory.  +
-  * Boot with fresh Raspbian  +
-  * Login with ''**pi**'' / ''raspberry'' (default ID/password)  +
-  * Run ''**sudo raspi-config**'' to setup initial configuration. +
  
-{{:manual:raspbi-config.png?650|}}+{{mdi>mini-sd?color=#c7053d}} Flash Raspberry Pi OS ((previous called Raspbian)) --- ingredients[[https://www.raspberrypi.org/downloads/|Raspberry Pi OS]] & [[https://www.balena.io/etcher/|BalenaEtcher]]  
 +  
 +{{mdi>monitor?color=#c7053d}} Booting with flashed OS & login with ''**pi**'' / ''raspberry'' (default ID/password) 
  
-Set configuration with following menu.  +{{mdi>powershell?color=#c7053d}} Execute ''**sudo raspi-config**'' to setup initial configuration
-  * 1. Change User Password - Change password for user ''pi''.  +
-  2. Hostname - Default value is ''raspberrypi'', name what you want.  +
-  3. Boot Options Select console mode (command line) or Graphic mode (desktop)  +
-  4. Localisation Options  +
-    **T1 Change Locale** - Default value is ''en_GB.UTF-8 UTF-8'', recommendation is setting both ''en_US.UTF-8 UTF-8'' and ''ko_KR.UTF-8 UTF-8''.  +
-    * **T2 Change Timezone** - Where Raspberry Pi lives.  +
-    * **T3 Change Wi-fi Country** - What you want. Frequency ranges are different depending on country.  +
-  * 5. Interfacing Options  +
-    * **P2 SSH** - **MUST CHECK with ENABLE**  +
-    * Others - Check ENABLE/DISABLE for your purposes.  +
-  * 7. Advanced Options +
-    * **A1 Expand Filesystem** - **MUST DO** to extend your memory capacity to utilize  +
-    * **A3 Memory Split** - Memory size for GPU. If you are console user, ''32''is rather optimal value+
  
-  * Change ''root'' password - ''sudo passwd root''  +{{:manual:raspbi-config.png|}} 
-  * Add user for yourself - ''sudo adduser //userid//''  + 
-  * Add ''sudoer'' privilege for ''//userid//'' +==== Setup raspbi-config ====  
 + 
 +1. ''Change User Password'' --- Change password for user ''pi''  
 +2. ''Network Options''  
 +  **''N1 Hostname''** --- Change hostname for server  
 +  * **''N2 Wireless LAN''** --- Setup wireless region, SSID and passphrase for wireless network  
 +  * **''N3 Network interface names''** --- predictable network interface name such as ''enx78e7d1ea46da'' vs. traditional name such as ''wlan0''  
 +  * ''N4 Network proxy settings'' --- if necessary  
 + 
 +3. ''Boot Options'' 
 +  * **''B1 Desktop / CLI''** --- Desktop GUI or Command Line Interface for operation **''CLI''** 
 +  * ''B2 Wait for Network at Boot'' --- Booting sequences are not completed without network connection if yes 
 +  * ''B3 Splash Screen'' --- Choose your taste  
 + 
 +4. Localisation Options  
 +  * **''I1 Change Locale''** --- Default value is ''en_GB.UTF-8 UTF-8'' , Set both **''en_US.UTF-8 UTF-8''** & **''ko_KR.UTF-8 UTF-8''** 
 +  * **''I2 Change Time Zone''** --- Asia/Seoul or your place 
 +  * ''I3 Change Keyboard Layout'' --- if necessary but usually pass 
 +  * ''I4 Change WLAN Country'' --- if necessary  
 + 
 +5. Interfacing Options  
 +  * Disable: ''P1 Camera'', ''P3 VNC'' (if use CLI) , ''P4 SPI'' , ''P5 I2C'' , ''P6 Serial'' , ''P7 1-Wire'' , ''P8 Remote GPIO''  
 +  * Enable: **''P2 SSH''** 
 + 
 +6. <del>Overclock</del> --- Simply pass over  
 + 
 +7. Advance Options  
 +  * **''A1 Expand Filesystem''**  
 +  * **''A3 Memory Split''** --- ''**32**'' for console user. less than 32 can cause problem  
 + 
 +==== Manage accounts ====  
 + 
 +=== Change password for root ===  
 + 
 +<code bash> 
 +sudo passwd root  
 +</code>   
 + 
 +=== Create active userid ===  
 + 
 +''pi'' user is build-in account, which means weak point of security. Therefore creating personal ''userid'' is recommended.  
 + 
 +<code bash>  
 +sudo adduser //userid//  
 +</code> 
 + 
 +Append ''sudoer'' privilege for ''userid''  
 + 
 +Edit ''/etc/sudoers'' 
  
 <code autoconf> <code autoconf>
-  # User privilege specification +# User privilege specification 
-  root    ALL=(ALL:ALL) ALL +root    ALL=(ALL:ALL) ALL 
-  userid   ALL=(ALL) NOPASSWD: ALL+userid   ALL=(ALL) NOPASSWD: ALL
 </code> </code>
  
-  * copy all files from ''/home/pi/'' to ''/home/userid'' (e.g.: ''.profile'' ''.bashrc''+Copy all files from ''/home/pi'' to ''/home/userid'' if necessary (e.g.: ''.profile'' ''.bashrc'')  
-  * Logout ''pi'' user and login with ''userid''  + 
-  Delete ''pi'' user without regret ''sudo deluser pi'' and delete user directory ''sudo rm -rf /home/pi''  +Reboot system and login with ''userid''  
-  Update & upgrade + 
 +Delete ''pi'' user  
 + 
 +<code bash>  
 +sudo deluser pi  
 +sudo rm -rf /home/pi  
 +</code>  
 + 
 +=== Update and Upgrade === 
  
 <code bash> <code bash>
-  sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoremove+sudo apt update && sudo apt dist-upgrade -y && sudo apt autoremove
 </code>  </code> 
  
Line 73: Line 116:
  
 <code bash> <code bash>
-  sudo apt-get update       +sudo apt update       
-  sudo apt-get dist-upgrade -y  +sudo apt dist-upgrade -y  
-  sudo apt-get autoremove +sudo apt autoremove 
 </code>  </code> 
  
-Update ''firmware updater'' +Update kernel and VideoCore **''firmware''**  
 + 
 <code bash>  <code bash> 
-  sudo rpi-update +sudo rpi-update 
 </code>  </code> 
 +
 +----
 +
 +==== Mount external disk(s) ==== 
 +
 +Check attached or plugin devices using 
 +
 +<code bash> 
 +sudo blkid
 +</code> 
 +
 +=== Format the disk with ext4 ===
 +
 +<code bash> 
 +sudo mkfs.ext4 /dev/sdXY 
 +</code>
 +
 +=== Mount NTFS formatted disk ===
 +
 +NTFS format has little advantage under Linux system but could mount it as well  
 +
 +<code bash> 
 +sudo apt-get install ntfs-3g
 +</code>
 +
 +Formatting disk with NTFS 
 +
 +<code bash> 
 +mkfs.ntfs -Q -L diskLabel /dev/sdXY
 +</code> 
 +
 +=== Disk mount at booting ===
 +
 +Edit ''/etc/fstab'' 
 +
 +Append line(s) with device's UUID or location path ''/dev/sdXY''. strongly prefer UUID  with mount pointing 
 +
 +<code ini>
 +  UUID="dd7c1879-68c5-e9b9-bad6-789d3b8db984"     /(path)/Storage    ext4     defaults          0       0
 +</code> 
 +
 +Reboot the system and check the disk mounted. 
  
 ---- ----
 ==== Configure wireless connection ====  ==== Configure wireless connection ==== 
 +
 +<accordion>
 +<panel title="Under review"> 
  
   * Check wireless & configuration ''sudo iwconfig'' to find wireless is available.    * Check wireless & configuration ''sudo iwconfig'' to find wireless is available. 
   * Change proper configuration with editing ''/etc/network/interfaces''    * Change proper configuration with editing ''/etc/network/interfaces'' 
  
-{{fa>warning?color=#000000}} Since ''Stretch'', ''/etc/network/interfaces'' is not useless unless stop ''dhcpcd'' service. Use ''/etc/dhcpcd.conf'' instead. +{{fa>warning?size=16&color=#b84592}} Since ''Stretch'', ''/etc/network/interfaces'' is not useless unless stop ''dhcpcd'' service. Use ''/etc/dhcpcd.conf'' instead. 
  
 <code ini> <code ini>
Line 138: Line 227:
   sudo ip link set wlan0 up   sudo ip link set wlan0 up
 </code>  </code> 
 +
 +</panel>
 +</accordion>
  
 ----  ---- 
- 
-==== Mount USB attached drive(s) ====  
- 
-''Check'' attached devices using ''sudo blkid''  
- 
-=== format with ext4 === 
-<code bash>  
-  sudo mkfs.ext4 /dev/sdXY  
-</code> 
- 
-=== mount ntfs === 
- 
-Even thought ''NTFS'' has little advantage in format, it has great advantage on compatibility.  
- 
-<code bash>  
-  sudo apt-get install ntfs-3g 
-</code> 
- 
-formatting with NTFS  
- 
-<code bash>  
-  mkfs.ntfs -Q -L diskLabel /dev/sdXY 
-</code>  
- 
-=== mount and booting option === 
- 
-<code bash>  
- sudo vi /etc/fstab 
-</code>  
- 
-Add line with device's UUID, which prevents failing mount due to point of devices.  
- 
-  UUID="dd7c1879-68c5-e9b9-bad6-789d3b8db984"  /(path)/Storage   ext4    defaults          0       0 
- 
----- 
  
 ==== Set Google Public NTP ====  ==== Set Google Public NTP ==== 
 +
 +<accordion>
 +<panel title="Under review"> 
  
 Use either ''systemd-timesyncd'' or ''ntp'' service. If you wish to use ''ntp'' Use either ''systemd-timesyncd'' or ''ntp'' service. If you wish to use ''ntp''
Line 203: Line 263:
 sudo service ntp reload sudo service ntp reload
 </code>  </code> 
 +
 +</panel>
 +</accordion>
  
 ---- ----
 +
 +===== Maintenance & Operation ===== 
 +
 +==== Useful packages ==== 
 +
 +Initially install the following packages for convenience. 
 +
 +  * ''tree'' --- The tree is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format.
 +
 +  * ''vim'' --- vim is a text editor. It can be used for editing any kind of text and is especially suited for editing computer programs.
 +
 +  * ''iftop'' --- iftop is a real time console-based Linux network bandwidth monitoring
 +
 +----
 +
 +==== Time stamp prompt ==== 
 +
 +Edit ''~/.bashrc'' and change ''PS1'' line 
 +
 +<code bash> 
 +if [ "$color_prompt" = yes ]; then
 +    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;33m\]\D{%T}\[\033[00m\] \[\033[01;37m\]\w\$\[\033[00m\] '
 +else
 +    PS1='${debian_chroot:+($debian_chroot)}\u@\h: \D{%T} \w\$ '
 +fi
 +</code> 
 +
 +Save and load ''.bashrc'' 
 +
 +<code bash> 
 +source ~/.bashrc 
 +</code> 
 +
 +----
 +
 +==== Modify login message ==== 
 +
 +Edit ''/etc/motd'' 
 +
 +<button type="danger" size="sm" icon="mdi mdi-message-text">[[https://wiki.meson.one/doku.php?id=secured:motd_raspbian|Live Configuration]]</button>
 +
 +Create ''20-disks'' (arbitrary name) and edit in ''/etc/update-motd.d/'' 
 +
 +<code bash> 
 +#!/bin/sh
 +printf "\n"
 +df -h /dev/sd* --out=target,fstype --output=size,used,avail,pcent --type=ext4
 +printf "\n"
 +</code> 
 +
 +Script shows the information of the attached disks, which also reminds whether disk is mounted or not. 
 +
 +<code ini> 
 +Mounted on             Type  Size  Used Avail Use%
 +/home/userid/disk1     ext4  917G  338G  533G  39%
 +/home/userid/disk2     ext4  458G  307G  128G  71% 
 +</code> 
 +
 +----   
 ==== Move directories & files using rsync ====  ==== Move directories & files using rsync ==== 
 +
 +<accordion>
 +<panel title="Under review">
 ''rsync'' is useful command to transfer data from source to destination.  ''rsync'' is useful command to transfer data from source to destination. 
  
Line 218: Line 343:
  
 After running ''rsync'' command, ''find'' command runs to find and delete empty directories.  After running ''rsync'' command, ''find'' command runs to find and delete empty directories. 
 +</panel>
 +</accordion> 
  
 ---- ----
-==== hash sum mismatch during apt-get update ====  
- 
-This problem has something to do with ''slow connection'' or ''connection failure'' due to bad network situation.  
- 
-<code bash>  
-sudo vi /etc/apt/source.lists  
-</code>  
- 
-Change mirror address seemingly to be fast.  
  
-[[https://www.raspbian.org/RaspbianMirrors|Raspbian Mirrors]] +==== Upgrade Raspbian from Jessie to Stretch ==== 
  
-This is a kind of temporary problem due to network condition.  +[[https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=184830|Upgrade video guide]]  [[https://www.52pi.com/blog/7-upgrade-raspbian-jessie-to-raspbian-stretch|Upgrade Guide]] 
- +
-----  +
-==== Upgrade Raspbian from Jessie to Stretch ====  +
-[[https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=184830|Upgrade video guide]]  +
-[[https://www.52pi.com/blog/7-upgrade-raspbian-jessie-to-raspbian-stretch|Upgrade Guide]] +
  
 <code bash> <code bash>
-  sudo apt-get update  +sudo apt update  
-  sudo apt-get upgrade  +sudo apt dist-upgrade 
-  sudo apt-get dist-upgrade +
 </code> </code>
  
Line 248: Line 360:
  
 <code bash> <code bash>
-  sudo dpkg -C+sudo dpkg -C
 </code> </code>
  
Line 254: Line 366:
  
 <code bash> <code bash>
-  sudo apt-mark showhold+sudo apt-mark showhold
 </code> </code>
  
-Packages showing ''On Hold'' will not upgrade\\ +Packages showing ''On Hold'' **will not be upgraded** 
 + 
 Replace ''Jessie'' to ''Stretch'' in distribution sources.  Replace ''Jessie'' to ''Stretch'' in distribution sources. 
  
 <code bash> <code bash>
-  sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list+sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list
 </code> </code>
  
Line 267: Line 380:
  
 <code bash> <code bash>
-  lsb_release -a+lsb_release -a
 </code> </code>
  
 ---- ----
-==== Customize login messages ====  
  
-edit or append ''/etc/update-motd.d/xx-command'', where xx is arbitrary number to set priorities. +==== Upgrade Raspbian from Stretch to Buster ==== 
  
-For example touch ''/etc/update-motd.d/20-disk'' with the following, +Preparing upgrade with keeping up latest 
  
 <code bash>  <code bash> 
-#!/bin/sh +sudo apt update  
-printf "\n" +sudo apt dist-upgrade -
-df -h /dev/sd* --out=target,fstype --output=size,used,avail,pcent --type=ext4 +
-printf "\n"+
 </code>  </code> 
  
-shows size of diskused and available capacities of ''ext4'' format disk(es). +Update Raspberry Pi's firmware
  
-<code ini>  +<code bash>  
-Mounted on             Type  Size  Used Avail Use% +sudo rpi-update 
-/home/userid/disk1     ext4  917G  338G  533G  39% +
-/home/userid/disk2     ext4  458G  307G  128G  71% +
 </code>  </code> 
 +
 +After rebooting, modify source list with ''buster'' Edit ''/etc/apt/source.list'' 
 +
 +<code>
 +deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
 +</code> 
 +
 +Edit ''/etc/apt/sources.list.d/raspi.list'' 
 +
 +<code>
 +deb http://archive.raspberrypi.org/debian/ buster main
 +</code> 
 +
 +To optimize upgrading process, remove ''apt-listchanges'' package 
 +
 +<code bash> 
 +sudo apt-get remove apt-listchanges
 +</code> 
 +
 +Run update and upgrade for ''buster'' and it takes a long time. 
 +
 +<code bash>
 +sudo apt update
 +sudo apt dist-upgrade
 +</code> 
 +
 +Optional remove (or possible these are supposed to be removed) the followings 
 +
 +<code bash>
 +sudo apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol
 +</code> 
 +
 +Clean and purge repository for update and reboot finally.
 +
 +<code bash> 
 +sudo apt autoremove -y
 +sudo apt autoclean
 +sudo reboot 
 +</code> 
 +
  
 ---- ----
 +
 +
  • rpi_common
  • Last modified: 2020/09/20 15:22
  • by Júne Park