Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[130s-rpi2] Re-install OS on 16GB sd card bought around 2016 #327

Closed
130s opened this issue Dec 26, 2018 · 15 comments
Closed

[130s-rpi2] Re-install OS on 16GB sd card bought around 2016 #327

130s opened this issue Dec 26, 2018 · 15 comments
Assignees
Labels
comp_rpi RaspberryPi comp_ubuntu Epic Meta issue that is typically used to list of action items space_smarthome

Comments

@130s
Copy link
Collaborator

130s commented Dec 26, 2018

Kind of getting tired of debugging #268, so might as well just re-fresh install.

Just as FYI, originally done at #100 (comment)

@130s 130s added this to the 201812 milestone Dec 26, 2018
@130s 130s self-assigned this Dec 26, 2018
@130s
Copy link
Collaborator Author

130s commented Dec 26, 2018

https://www.openhab.org/docs/installation/rasppi.html

Install via NOOBS https://www.raspberrypi.org/documentation/installation/noobs.md

2 options for Ubuntu: MATE (this was chosen last time #100 (comment)), and Snappy Ubuntu Core. Going with Snappy this time as I've been interested in it for years but never had a chance.

@130s
Copy link
Collaborator Author

130s commented Dec 28, 2018

Copied an Ubuntu image to SD card. https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0     1K  0 part
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom
mmcblk0     179:0    0  14.4G  0 disk
├─mmcblk0p1 179:1    0    63M  0 part /media/n130s/PI_BOOT
└─mmcblk0p2 179:2    0   7.4G  0 part
$ umount /dev/mmcblk0
umount: /dev/mmcblk0: not mounted
$ umount /dev/mmcblk0/mmcblk0p1
umount: /dev/mmcblk0/mmcblk0p1: Not a directory
$ sudo umount /dev/mmcblk0
[sudo] password for n130s:
umount: /dev/mmcblk0: not mounted
$ sudo umount /dev/mmcblk0/mmcblk0p1
umount: /dev/mmcblk0/mmcblk0p1: Not a directory
$ sudo umount /media/n130s/PI_BOOT
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0     1K  0 part
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom
mmcblk0     179:0    0  14.4G  0 disk
├─mmcblk0p1 179:1    0    63M  0 part
└─mmcblk0p2 179:2    0   7.4G  0 part
$ file /tmp/ubuntu-core-16-pi2.img
/tmp/ubuntu-core-16-pi2.img: DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x10,0,1), end-CHS (0x3ff,3,32), startsector 2048, 262144 sectors; partition 2 : ID=0x83, start-CHS (0x3ff,3,32), end-CHS (0x3ff,3,32), startsector 264192, 649000 sectors
$ sudo dd bs=4M if=/tmp/ubuntu-core-16-pi2.img of=/dev/mmcblk0 conv=fsync
111+1 records in
111+1 records out
467571712 bytes (468 MB, 446 MiB) copied, 36.1789 s, 12.9 MB/s

@130s
Copy link
Collaborator Author

130s commented Dec 28, 2018

Installation/Copying a Ubuntu image file on to the SD card is done #327 (comment), so going back to https://www.openhab.org/docs/installation/rasppi.html

Insert the SD card to RPi2 then turned it on. I see the following error repeats and doesn't seem to end:

mmc0: error -110
[  242.936702] mmc0: error -110 whilst initialising SD card
[  (timestamp)] mmc0: card neveer left busy state

@130s
Copy link
Collaborator Author

130s commented Dec 30, 2018

I went to bed before #327 (comment) reached a point where no more progress occurs.

Simply rebooted and now I see:

[ (timestamp)] EXT-4fs error (device mmcblk0p2): ext4_mb_mark_diskspace_used:2942: comm kworker/u8:3: Allcating blocks 79872-81920 which overlap fs metadata
[ (timestamp)] EXT-4fs (mmcblk0p2): Delayed block allocation failed for inode 410 at logical offset 12288 with max blocks 2048 with error 117
[ (timestamp)] EXT-4fs (mmcblk0p2): This should not happen!! Data will be lost

Similar output keeps printed on and on.

@130s
Copy link
Collaborator Author

130s commented Dec 30, 2018

I just re-restored SD card, knowing the last time I didn't get to see where #327 (comment) ended up being.

After restoration I compared the img restored on the SD card (following https://www.raspberrypi.org/documentation/installation/installing-images/linux.md). Looks ok, not much diff.

$ sudo dd bs=4M if=/dev/mmcblk0 of=/tmp/sdcard_dd_verif/foo.img count=111

$ ll
total 445M
-rw-r--r--  1 root  root  444M Dec 30 08:21 foo.img
drwxrwxr-x  2 n130s n130s 4.0K Dec 30 08:21 ./
drwxrwxrwt 35 root  root  456K Dec 30 08:20 ../
$ ll /tmp/ubuntu-core-16-pi2.img
-rw-rw-r-- 1 n130s n130s 446M Dec 26 02:47 /tmp/ubuntu-core-16-pi2.img

Also ran sync command at the end as suggested.

Still, plugging the SD card in to rpi2, I see the same #327 (comment). Not sure though, this answer on askubuntu.com suggests it's a kernel issue and a set of commands to fix. That might not be helpful for me as I can't even start Linux yet.

I think I give up using Snappy and go back to the other option Mate at #327 (comment).

@130s
Copy link
Collaborator Author

130s commented Dec 31, 2018

Formatting, copying(/installing?) Mate into Sd card seems to have failed.
(ref: http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/ via https://www.raspberrypi.org/documentation/installation/noobs.md)

$ sudo fdisk /dev/mmcblk0
[sudo] password for nfoo:

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m

Help:

  DOS (MBR)
     a   toggle a bootable flag
     b   edit nested BSD disklabel
     c   toggle the dos compatibility flag

  Generic
     d   delete a partition
     F   list free unpartitioned space
     l   list known partition types
     n   add a new partition
     p   print the partition table
     t   change a partition type
     v   verify the partition table
     i   print information about a partition

  Misc
     m   print this menu
     u   change display/entry units
     x   extra functionality (experts only)

  Script
     I   load disk layout from sfdisk script file
     O   dump disk layout to sfdisk script file

  Save & Exit
     w   write table to disk and exit
     q   quit without saving changes

  Create a new label
     g   create a new empty GPT partition table
     G   create a new empty SGI (IRIX) partition table
     o   create a new empty DOS partition table
     s   create a new empty Sun partition table

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x68c4443d

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *      2048   264191   262144  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      264192 30253055 29988864 14.3G 83 Linux

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x68c4443d

Device         Boot Start    End Sectors  Size Id Type
/dev/mmcblk0p1 *     2048 264191  262144  128M  c W95 FAT32 (LBA)

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x68c4443d

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
   Select (default p): p
   Partition number (1-4, default 1): 1
   First sector (2048-30253055, default 2048):
   Last sector, +sectors or +size{K,M,G,T,P} (2048-30253055, default 30253055):

Created a new partition 1 of type 'Linux' and of size 14.4 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x68c4443d

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       2048 30253055 30251008 14.4G 83 Linux

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT
 10  OPUS55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
 11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b
 12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor
 14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor
 16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary
 17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS
 18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE
 1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto
 1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep
 1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT
 Partition type (type L to list all types): b
 Changed type of partition 'Linux' to 'W95 FAT32'.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x68c4443d

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       2048 30253055 30251008 14.4G  b W95 FAT32

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0     1K  0 part
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom
mmcblk0     179:0    0  14.4G  0 disk
├─mmcblk0p1 179:1    0   128M  0 part /media/nfoo/system-boot
└─mmcblk0p2 179:2    0  14.3G  0 part /media/nfoo/writable
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
/dev/mmcblk0p1: Permission denied
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ sudo mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.28 (2015-05-16)
mkfs.vfat: /dev/mmcblk0p1 contains a mounted filesystem.
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ ll
total 2.1G
drwxrwxr-x  2 nfoo nfoo 4.0K Dec 30 08:41 ./
-rw-rw-r--  1 nfoo nfoo 1.9G Dec 30 08:41 ubuntu-mate-18.04.1-desktop-amd64.iso
drwxrwxr-x 22 nfoo nfoo 4.0K Dec 26 02:45 ../
-rw-rw-r--  1 nfoo nfoo 218M Dec 26 02:44 ubuntu-core-16-pi2.img.xz
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ md5sum ubuntu-mate-18.04.1-desktop-amd64.iso
1de1ccaa1e57eee6e753849998449185  ubuntu-mate-18.04.1-desktop-amd64.iso
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ mount | grep -i mmcblk0p1
/dev/mmcblk0p1 on /media/nfoo/system-boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
nfoo@foo-kudu1:~/data/Dropbox/pg/ubuntu$ cd /media/nfoo/system-boot/
nfoo@foo-kudu1:/media/nfoo/system-boot$ ll ~/data/Dropbox/pg/ubuntu/ubuntu-
ubuntu-core-16-pi2.img.xz              ubuntu-mate-18.04.1-desktop-amd64.iso
nfoo@foo-kudu1:/media/nfoo/system-boot$ cp ~/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso .
cp: error writing './ubuntu-mate-18.04.1-desktop-amd64.iso': No space left on device
nfoo@foo-kudu1:/media/nfoo/system-boot$ du -h
74K     ./pi2-kernel_56.snap/dtbs
8.5M    ./pi2-kernel_56.snap
127M    .
nfoo@foo-kudu1:/media/nfoo/system-boot$ ll ~/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso
-rw-rw-r-- 1 nfoo nfoo 1.9G Dec 30 08:41 /home/nfoo/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso

@130s 130s modified the milestones: 201812, 201901 Jan 1, 2019
@130s
Copy link
Collaborator Author

130s commented Jan 1, 2019

In #327 (comment) obviously the disk space is too small for writing in the .iso. Then switched to the larger mout point assuming system-boot is boot loader section. But still no good with an error message I've unheard of.

cp: error writing './ubuntu-mate-18.04.1-desktop-amd64.iso': Structure needs cleaning
noodle@oodle-kudu1:/media/noodle/system-boot$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0     1K  0 part
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom
mmcblk0     179:0    0  14.4G  0 disk
├─mmcblk0p1 179:1    0   128M  0 part /media/noodle/system-boot
└─mmcblk0p2 179:2    0  14.3G  0 part /media/noodle/writable
noodle@oodle-kudu1:/media/noodle/system-boot$ cd /media/noodle/writable
noodle@oodle-kudu1:/media/noodle/writable$ cp ~/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso .
cp: cannot create regular file './ubuntu-mate-18.04.1-desktop-amd64.iso': Permission denied
noodle@oodle-kudu1:/media/noodle/writable$ ll
total 28K
drwxr-x---+ 4 root root 4.0K Dec 30 08:40 ../
drwxr-xr-x  4 root root 4.0K Aug  6 01:07 ./
drwx------  2 root root  16K Aug  6 01:07 lost+found/
drwxr-xr-x  5 root root 4.0K Aug  6 01:07 system-data/
noodle@oodle-kudu1:/media/noodle/writable$ sudo cp ~/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso .
[sudo] password for noodle:
cp: error writing './ubuntu-mate-18.04.1-desktop-amd64.iso': Structure needs cleaning
noodle@oodle-kudu1:/media/noodle/writable$

@130s
Copy link
Collaborator Author

130s commented Jan 1, 2019

Without not sure about the issue #327 (comment), I noticed that I didn't unmount as the same page qdosmsq.dunbar-it.co.uk mentioned.

Now we need to mount the SD card, so eject it and put it back in again.

So I did unmount before copying but the result was the same? (now I don't remember any more, but didn't work any way).

Switched to just simply using dd.

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk           
├─sda1        8:1    0     1K  0 part           
├─sda2        8:2    0     4G  0 part [SWAP]    
└─sda5        8:5    0 461.8G  0 part /         
sr0          11:0    1  1024M  0 rom            
mmcblk0     179:0    0  14.4G  0 disk           
├─mmcblk0p1 179:1    0   1.9G  0 part /media/n130s/Ubuntu-MATE 18.04.1 LTS amd64
└─mmcblk0p2 179:2    0   2.3M  0 part                                           
$ sudo umount /dev/mmcblk0p1                                                    
[sudo] password for n130s:                                                      
$ sudo dd bs=4M if=~/data/Dropbox/pg/ubuntu/ubuntu- of=/dev/mmcblk0 conv=fsync  
ubuntu-core-16-pi2.img.xz              ubuntu-mate-18.04.1-desktop-amd64.iso    
$ sudo dd bs=4M if=~/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso of=/dev/mmcblk0p1 conv=fsync

Then dd never finishes.

Once, I forced to kill the dd process then found the SD card was filled with files that look like that of Ubuntu Mate, so thought copying was successful but plugging in SD card to the raspberry pi 2 OS didn't seem to boot (red light remained on).

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

Rebooted, then formatted the SD card by fdisk as FAT32 as instructed in the same page qdosmsq.dunbar-it.co.uk, then dd reaches the 1.9GB point quickly then never returns.

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk 
├─sda1        8:1    0     1K  0 part 
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom  
mmcblk0     179:0    0  14.4G  0 disk 
└─mmcblk0p1 179:1    0  14.4G  0 part 
$ sudo dd bs=4M if=ubuntu-mate-18.04.1-desktop-amd64.iso of=/dev/mmcblk0p1 conv=fsync status=progress
1895825408 bytes (1.9 GB, 1.8 GiB) copied, 4.00838 s, 473 MB/s

Killing the sudo dd process then I still see dd process separately.

130s@130s-kudu1:~$ ps -ef|grep -i dd
:
root      3545     1  0 14:35 pts/10   00:00:01 dd bs=4M if=/home/n130s/data/Dropbox/pg/ubuntu/ubuntu-mate-18.04.1-desktop-amd64.iso of=/dev/mmcblk0p1 conv=fsync status=progress
n130s     3726  3549  0 14:54 pts/11   00:00:00 grep --color=auto -i dd

sync command also never seems to return.

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

ddrescue as suggested in https://ubuntu-mate.org/raspberry-pi/ resulted in the same, non-active boot on RPi2. a option in fdisk as suggested in http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/ was also tried.

Then, I just noticed that RPi2 is 32bit while I've been trying to install 64bit image (on Mate page there's even an explicit RPi images listed).

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

Using rpi Mate image, RPi2 boots (finally)!.

However upon boot, I see a lot of errors. Some of them are:

[FAILED] Failed to start Remount Root and Kernel File Systems.
[FAILED] Failed to start udev Coldplug all Devices.
[FAILED] Failed to start Flush Journal to Persistent Storage.
:
[ (timestamp)] EXt4-fs error (device mmcblk0p2): ext4_find_entry:1450: inode #130312: comm (lymouthd): reading directory lblock 0
[FAILED] Failed to start Show Plymouth Boot Screen
[FAILED] Failed to start Set console font and keymap.
[FAILED] Failed to start LSB: AppArmor initialization.
[FAILED] Failed to start Create olatile Files and Directories
[FAILED] Failed to start Network Time Synchronization.
[FAILED] Failed to start Update UTMP about System Boot/Shutdown.

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

"Safe mode" for RPi (this worked for RPi2).

  1. Unplug and take the card out
  2. Mount it on a computer
  3. Open the drive, edit the cmdline.txt file and add " init=/bin/bash" at the end of the existing command. Note: the space before init is required.

But suggested fsck didn't seem to run as expected, as it complains some files were not available or something (can't recall).

Tried the same SD card on a new RPi3B (not 2) but the output seems to look similar.

Although I'm now interested in trying out other SD cards but I can't find any. Ordered 32GB and 64GB from Sandisk.

SD card looks like this after ddrescue command when it's mounted.

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
:
mmcblk0     179:0    0  14.4G  0 disk 
├─mmcblk0p1 179:1    0    63M  0 part /media/nnoodle/PI_BOOT
└─mmcblk0p2 179:2    0  14.4G  0 part /media/nnoodle/PI_ROOT
$ 

@130s
Copy link
Collaborator Author

130s commented Jan 2, 2019

Going back to Ubuntu snappy core #327 (comment), then this time it seems to work! Only difference I can think of this time is to have run fdisk and formatted as FAT32.

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 465.8G  0 disk
├─sda1        8:1    0     1K  0 part
├─sda2        8:2    0     4G  0 part [SWAP]
└─sda5        8:5    0 461.8G  0 part /
sr0          11:0    1  1024M  0 rom
mmcblk0     179:0    0  14.4G  0 disk
├─mmcblk0p1 179:1    0    63M  0 part /media/n130s/PI_BOOT
└─mmcblk0p2 179:2    0  14.4G  0 part /media/n130s/PI_ROOT
$ sudo umount /media/n130s/PI_BOOT
$ sudo umount /media/n130s/PI_ROOT
$ sudo fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1d8c09f0

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   131071   129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      131072 30253055 30121984 14.4G 83 Linux

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1d8c09f0

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
      e   extended (container for logical partitions)
      Select (default p):

Using default response p.
Partition number (1-4, default 1):
First sector (2048-30253055, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-30253055, default 30253055):

Created a new partition 1 of type 'Linux' and of size 14.4 GiB.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): b
Changed type of partition 'Linux' to 'W95 FAT32'.

Command (m for help): p
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1d8c09f0

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *     2048 30253055 30251008 14.4G  b W95 FAT32

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

$ sudo mkfs.vfat /dev/mmcblk0
mkfs.fat 3.0.28 (2015-05-16)
$ sudo ddrescue -D --force /tmp/ubuntu-core-16-pi2.img /dev/mmcblk0
ubuntu-core-16-pi2.img
$ sudo ddrescue -D --force /tmp/ubuntu-core-16-pi2.img /dev/mmcblk0
GNU ddrescue 1.19
Press Ctrl-C to interrupt
rescued:   467571 kB,  errsize:       0 B,  current rate:   10261 kB/s
   ipos:   467533 kB,   errors:       0,    average rate:   10873 kB/s
      opos:   467533 kB, run time:      43 s,  successful read:       0 s ago
      Finished

@130s
Copy link
Collaborator Author

130s commented Jan 6, 2019

This doesn't seem to go well now that I see #330. Reopening and split subtasks:

@130s 130s reopened this Jan 6, 2019
@130s 130s added the Epic Meta issue that is typically used to list of action items label Jan 6, 2019
@130s 130s changed the title [130s-rpi2] Re-install OS [130s-rpi2] Re-install OS on 16GB sd card bought around 2016 Feb 2, 2019
@130s 130s removed this from the 201901 milestone Oct 12, 2019
@130s
Copy link
Collaborator Author

130s commented Jan 1, 2020

Closing same as #330 (comment)

@130s 130s closed this as completed Jan 1, 2020
@130s 130s added the comp_rpi RaspberryPi label Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp_rpi RaspberryPi comp_ubuntu Epic Meta issue that is typically used to list of action items space_smarthome
Projects
None yet
Development

No branches or pull requests

1 participant