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
rpi_common [2019/04/21 16:04] – [Configure wireless connection] JΓΊne Parkrpi_common [2024/04/18 08:52] (current) – 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_nimbus|ππ’πŒππ”π’ π••π•–π”Ήπ•π•’π•Ÿπ•”]]Β 
-    * [[:rpi_epigen|Private Cellarium ─ EPiGEN Crystal]]Β +    * [[debian_common|β–  General info on Debian Linux]]Β 
-    * [[:rpi_nimbus|Webius Officium ─ NiMBUS deBlanc]]Β +    * [[deb_cicada|𝐂𝐒𝐂𝐀𝐃𝐀 π•Šπ•’π•©π• π•₯π•¦π•ž]]Β 
-    * [[:debian_common|General info on Debian Linux]]Β +    * [[deb_mutism|πŒπ”π“π’π’πŒ π•„π•’π•˜π•Ÿπ•¦π•ž]] Β 
-    * [[:deb_mutism|Opus Imperium ─ MUTiSM Magnum]]+    * [[deb_gilead|𝐆𝐒𝐋𝐄𝐀𝐃 π”Έπ•£π•˜π•–π•Ÿπ•₯𝕒]] Β 
 +    * [[deb_symbio|π’π˜πŒππ’πŽ β„‚π• π•Ÿπ•’π•₯𝕦𝕀]]Β 
 +    * [[deb_tardis|𝐓𝐀𝐑𝐃𝐒𝐒 π•Šπ•‘π•’π•₯π•šπ•¦π•ž]] Β 
 +    * [[deb_debris|𝐃𝐄𝐁𝐑𝐒𝐒 β„‚π•™π•£π• π•žπ•–]] 
   * {{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|πŒπ„π’πŽππ’π’πŒ]] Β 
-    * [[:pc_mesonium|Manibus Tablet ─ MESONiUM]]Β +    * [[PC_MESONiST|πŒπ„π’πŽππ’π’π“]]
-    * [[:pc_mesonist|Domumus Workstage ─ MESONiST]]Β +
-    * [[: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_EPiCON|π„ππ’π‚πŽπ π”½πŸ™]] Β 
-    * [[:cell_epihex|JΓΊne's Extentus ─ EPiHEX 6]]Β +    * [[CELL_EPiMER|π„ππ’πŒπ„π‘ 𝟑]] Β 
-    * [[:cell_epinex|JΓΊne's Secondus ─ EPiNEX 5]]Β +    * [[CELL_EPiLUX|𝐄𝐏𝐒𝐋𝐔𝐗 𝟟]]   Β 
-    * [[:cell_epitab|JΓΊne's Laminus - EPiTAB 7]]Β +    * [[CELL_EPiTAP|𝐄𝐏𝐒𝐓𝐀𝐏 πŸ™πŸ™]] Β 
-    * [[:cell_epixus|JΓΊne's Tertius ─ EPiXUS 4]]+    * [[CELL_EPiETA|𝐄𝐏𝐒𝐄𝐓𝐀 𝟜]] 
 </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 115:
  
 <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. 
Line 138: Line 226:
   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 262:
 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 342:
  
 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. +==== Upgrade Raspbian from Jessie to Stretch ==== 
  
-[[https://www.raspbian.org/RaspbianMirrors|Raspbian Mirrors]] Β +[[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]] 
-Β +
-This is a kind of temporary problem due to network condition. Β +
-Β +
----- Β +
-==== 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 359:
  
 <code bash> <code bash>
-  sudo dpkg -C+sudo dpkg -C
 </code> </code>
  
Line 254: Line 365:
  
 <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 379:
  
 <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.1555862651
  • Last modified: 2019/04/21 16:04
  • by JΓΊne Park