xuv's notebook

Side notes, howtos and random bits of information related to Julien Deswaef's activities

User Tools

Site Tools


os:arch:arch_on_the_pi

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
os:arch:arch_on_the_pi [2026/09/22 14:41] – Julien Deswaefos:arch:arch_on_the_pi [2026/09/22 14:46] (current) – [Python UnicodeEncodeError horror] Julien Deswaef
Line 98: Line 98:
 Following https://www.linode.com/docs/websites/wikis/ikiwiki-on-arch-linux/ Following https://www.linode.com/docs/websites/wikis/ikiwiki-on-arch-linux/
  
-## Resizing a partition +## Resizing a partition 
-//Copied from  http://raspberrypi.stackexchange.com/a/501 //+*Copied from  [[http://raspberrypi.stackexchange.com/a/501]]*
  
-  * ''sudo fdisk /dev/mmcblk0'' + * `sudo fdisk /dev/mmcblk0` 
-  * Type ''p'' to list the partition table+ * Type `p` to list the partition table
  
-<code> +   <code> 
-Device         Boot  Start      End  Sectors  Size Id Type +   Device         Boot  Start      End  Sectors  Size Id Type 
-/dev/mmcblk0p1        2048   206847   204800  100M  c W95 FAT32 (LBA) +   /dev/mmcblk0p1        2048   206847   204800  100M  c W95 FAT32 (LBA) 
-/dev/mmcblk0p2      206848 60588031 60381184 28.8G 83 Linux +   /dev/mmcblk0p2      206848 60588031 60381184 28.8G 83 Linux 
-</code>+   </code>
  
-  * Take note of the start number for partition 2 (if that's the one you want to resize) + * Take note of the start number for partition 2 (if that's the one you want to resize) 
-  * Type ''d'' to delete a partition. \\ You will then be prompted for the number of the partition you want to delete. In the case above you want to delete partition 2. + * Type `d` to delete a partition. \\ You will then be prompted for the number of the partition you want to delete. In the case above you want to delete partition 2. 
-  * Type ''n'' to create a new partition. + * Type `n` to create a new partition. 
-  * This new partition needs to be a primary partition so type ''p''. + * This new partition needs to be a primary partition so type `p`. 
-  * Next enter ''2'' when prompted for a partition number. + * Next enter `2` when prompted for a partition number. 
-  * You will now be prompted for the first sector for the new partition. Enter the start number from the partition 2 you deleted before. + * You will now be prompted for the first sector for the new partition. Enter the start number from the partition 2 you deleted before. 
-  * Next you will be prompted for the last sector you can just hit enter to accept the default which will utilize the remaining disk space. + * Next you will be prompted for the last sector you can just hit enter to accept the default which will utilize the remaining disk space. 
-  * Type ''w'' to save the changes you have made. (There will be some error showing saying: "Re-reading the partition table failed.: Device or resource busy", but no worries). + * Type `w` to save the changes you have made. (There will be some error showing saying: "Re-reading the partition table failed.: Device or resource busy", but no worries). 
-  * Reboot the Pi: '' sudo reboot'' + * Reboot the Pi: `sudo reboot` 
-  * Once the system has reboot and you are back at the commandline enter: ''sudo resize2fs /dev/mmcblk0p2'' Note: this can take a long time (epending on the card size and speed) be patient and let it finish. + * Once the system has reboot and you are back at the commandline enter: ''sudo resize2fs /dev/mmcblk0p2'' Note: this can take a long time (epending on the card size and speed) be patient and let it finish. 
-  * Reboot one more time. + * Reboot one more time. 
-  * You can now verify that the system is using the full capacity of the SD Card by entering the following command: ''df -h''+ * You can now verify that the system is using the full capacity of the SD Card by entering the following command: `df -h`
  
 #### Why This Works #### Why This Works
Line 132: Line 132:
 So your Python script works on your machine. But when you port it to a freshly installed Arch Linux Arm on a Pi, all hell breaks loose as soon as a weird character pops up. Something like this shows up:  So your Python script works on your machine. But when you port it to a freshly installed Arch Linux Arm on a Pi, all hell breaks loose as soon as a weird character pops up. Something like this shows up: 
 <code>UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 227: ordinal not in range(128)</code> <code>UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 227: ordinal not in range(128)</code>
-Well, don't start modifying your Python code (as you said, it does not have that problem on your machine).  It's because the default locale of Arch Linux is ''LANG-C'' and what you want is UTF-8 support. There is many ways to solve this, including forcing Python to use a locale different from the system. But I like to have my systems with similar settings. So just follow tutorials [[https://wiki.archlinux.org/index.php/Locale|here]].+Well, don't start modifying your Python code (as you said, it does not have that problem on your machine).  It's because the default locale of Arch Linux is `LANG-C` and what you want is UTF-8 support. There is many ways to solve this, including forcing Python to use a locale different from the system. But I like to have my systems with similar settings. So just follow tutorials [[https://wiki.archlinux.org/index.php/Locale|here]].
  
os/arch/arch_on_the_pi.1790080916.txt.gz · Last modified: by Julien Deswaef