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 [2020/02/02 04:00] โ€“ [hash sum mismatch during apt-get update] 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 139: Line 227:
 </code>  </code> 
  
----- +</panel>ย 
 +</accordion>
  
-==== Mount USB attached drive(s) ==== +---- 
  
-''Check'' attached devices using ''sudo blkid'' +==== Set Google Public NTP ==== 
  
-=== format with ext4 ===ย +<accordion>ย 
-<code bashย +<panel title="Under review"
-  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 ==== +
  
 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>
  
 ---- ----
-==== Move directories files using rsync ==== ย +ย 
-''rsync'' is useful command to transfer data from source to destination+===== 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>  <code bash> 
-  rsync -av --ignore-existing --remove-source-files /.. /source_directory/ TARGET.DOMAINS:/.. /destination_direcotry/ && \ย +if [ "$color_prompt" = yes ]; thenย 
-  find /../source_directory/ -depth -type d -empty -delete;+    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>  </code> 
  
-''--remove-source-files''   sender removes synchronized files (non-dirs)+Save and load ''.bashrc'' 
  
-''--ignore-existing''       skip updating files that already exist on receiverย +<code bash> ย 
-ย +source ~/.bashrc ย 
-After running ''rsync'' command, ''find'' command runs to find and delete empty directories+</code> 
  
 ---- ----
-==== hash sum mismatch during apt-get update ====  
  
-This problem has something to do with ''slow connection'' or ''connection failure'' due to bad network situation+==== 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>  <code bash> 
-sudo vi /etc/apt/source.lists +#!/bin/shย 
 +printf "\n"ย 
 +df -h /dev/sd* --out=target,fstype --output=size,used,avail,pcent --type=ext4ย 
 +printf "\n"
 </code>  </code> 
  
-Remove downloaded repository information from the ''/var/lib/apt/lists/'' directory.+Script shows the information of the attached disks, which also reminds whether disk is mounted or not
  
-<code bash>ย +<code ini> ย 
-sudo rm -rf /var/lib/apt/lists/*ย +Mounted on             Type  Size  Used Avail Use%ย 
-</code>+/home/userid/disk1     ext4  917G  338G  533G  39%ย 
 +/home/userid/disk2     ext4  458G  307G  128G  71% ย 
 +</code> 
  
-Change mirror address seemingly to be fast. +----   ย 
 +==== Move directories & files using rsync ==== 
  
-[[https://www.raspbian.org/RaspbianMirrors|Raspbian Mirrors]] +<accordion>ย 
 +<panel title="Under review">ย 
 +''rsync'' is useful command to transfer data from source to destination
  
-This is a kind of temporary problem due to network condition+<code bash> ย 
 +  rsync -av --ignore-existing --remove-source-files /.. /source_directory/ TARGET.DOMAINS:/.. /destination_direcotry/ && \ย 
 +  find /../source_directory/ -depth -type d -empty -delete;ย 
 +</code> ย 
 +ย 
 +''--remove-source-files''   sender removes synchronized files (non-dirs)ย 
 +ย 
 +''--ignore-existing''       skip updating files that already exist on receiverย 
 +ย 
 +After running ''rsync'' command, ''find'' command runs to find and delete empty directoriesย 
 +</panel>ย 
 +</accordion> ย 
 +ย 
 +----
  
-----  
 ==== Upgrade Raspbian from Jessie to Stretch ====  ==== 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]] +[[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 254: Line 359:
  
 <code bash> <code bash>
-  sudo dpkg -C+sudo dpkg -C
 </code> </code>
  
Line 260: 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 273: 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
  • Last modified: 2024/04/18 08:52
  • by Jรบne Park