0

Often I dd my raspbian image using:

sudo dd if=2021-01-11-raspios-buster-armhf-full.img of=/dev/sda bs=4M conv=fsync

I made a little script that changes some files, like /etc/shadow. However, it fails. Then, if I try to cat shadow:

lz@vm:~/Downloads$ cd /media/lz/rootfs/etc/
lz@vm:/media/lz/rootfs/etc$ sudo cat shadow

nothing happens. It's like it has an I/O problem. I always try to take off the SD card and reinsert it but the problem persists. I end up having to reboot the machine.

It didn't happen only on my notebook, it also happened on another one.

What could be causing this?

2 Answers 2

0
+100

It looks like you didn't unmount the SD card before you copied from the image. You can unmount using the command:

sudo umount /dev/sda?

Then do the dd command. You then may be able to re-mount using:

eject /dev/sda
eject -t /dev/sda
0

You are going about upgrading your Raspbian Pi operating system the wrong way. See:

To summarize you should be using:

sudo apt update
sudo apt dist-upgrade
sudo apt clean

Replacing the currently running OS with a new disk image will simply confuse things and having to reboot is no surprise.

You can also use lsblk to see what drives you are affecting by using dd:

NAME         FSTYPE LABEL            MOUNTPOINT               SIZE MODEL
nvme0n1                                                       477G Samsung SSD 960 PRO 512GB               
├─nvme0n1p9  swap                    [SWAP]                   7.9G 
├─nvme0n1p7  ext4   Old_Ubuntu_16.04 /mnt/old                23.1G 
├─nvme0n1p5  ntfs                                             859M 
├─nvme0n1p3                                                    16M 
├─nvme0n1p1  ntfs                                             450M 
├─nvme0n1p8  ntfs   Shared_WSL+Linux /mnt/e                     9G 
├─nvme0n1p10 ext4   Ubuntu_18.04     /mnt/clone              27.2G 
├─nvme0n1p6  ext4   New_Ubuntu_16.04 /                       45.1G 
├─nvme0n1p4  ntfs   NVMe_Win10       /mnt/c                 363.2G 
└─nvme0n1p2  vfat                    /boot/efi                 99M 
mmcblk0                                                     119.1G 
└─mmcblk0p1  vfat   SANDISK128       /media/rick/SANDISK128 119.1G 
sr0                                                          1024M DVD+/-RW DW316  
sda                                                         931.5G HGST HTS721010A9
├─sda4       ntfs   WINRETOOLS                                450M 
├─sda2                                                        128M 
├─sda5       ntfs   Image                                    11.4G 
├─sda3       ntfs   HGST_Win10       /mnt/d                   919G 
└─sda1       vfat   ESP                                       500M 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .