rpi-clone icon indicating copy to clipboard operation
rpi-clone copied to clipboard

Don't work on osmc

Open fmarzocca opened this issue 6 years ago • 9 comments

I am trying to use the script with osmc (www.osmc.tv) but I get this error: Error: Could not stat device /dev/systemd

Any tip?

fmarzocca avatar Mar 14 '19 16:03 fmarzocca

Same issue here. Did you ever find a solution? I also have two OSMC installs, one with rpi-clone working and the other without. However, both are at the same version (july 2019) , the only difference is that one is a fresh install vs. the other one is an old install that has been upgraded over time. The difference must be some package missing in the fresh install that rpi clone depends on and is not documented (my guess)

arigit avatar Aug 24 '19 21:08 arigit

I found the issue.

In the OSMC fresh install, rpi-clone fails to determine the source disk, which rpi-clone tries to guess by finding which device hosts the /boot directory, by using findmnt.

This is strange thing: in the fresh install,

mount |grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

There is the strange first line showing "systemd-1". This is also reflected by the command that rpi-clone uses:

/home/osmc/rpi-clone# findmnt /boot -o source -n
systemd-1
/dev/mmcblk0p1

So the quick hack to solve this is: look for the following line:

src_boot_dev=`findmnt /boot -o source -n`

and replace it with

src_boot_dev=`findmnt /boot -o source -n | grep -v -e "systemd"`

After this rpi-clone worked perfectly in my system

arigit avatar Aug 24 '19 21:08 arigit

Great! Thank you very much!!

fmarzocca avatar Aug 25 '19 07:08 fmarzocca

@fmarzocca Hi, can you reopen this issue? we need a developer to take a look, I found a quick workaround but this, however this change did not get merged into rpi-clone script yet and there may be much better solutions than mine to the problem.

Bottom line this Issue should stay open until the problem is solved in the rpi-clone source code here.

arigit avatar Aug 26 '19 16:08 arigit

Yes, you are right!

fmarzocca avatar Aug 26 '19 16:08 fmarzocca

src_boot_dev=findmnt /boot -o source -n | grep -v -e "systemd"

That excludes the systemd, but I'm not confident about why that line is there or if somewhere else or down the road there might be something else extra besides systemd. I think matching /dev/ would be more general.

So will this work as well on osmc?

src_boot_dev=findmnt /boot -o source -n | grep "/dev/"

billw2 avatar Aug 26 '19 16:08 billw2

@billw2 Yes - this works, and it's a better approach. That way you are guaranteed to catch always the physical device which is the one you need for rpi-clone

Just for context, I've been doing a little research on the systemd mount on /boot, it's brought up by a systemd service called 'automount' that OSMC appears to have tweaked for their own specific reasons. In most other distros, the automount of /boot is done only if there was no line in fstab covering it, and in that case it is a temporary mount that is only kept during boot, and then gets unmounted. OSMC seems to behave a little different than other distros on this.

arigit avatar Aug 26 '19 17:08 arigit

On Mon, 26 Aug 2019 10:28:23 -0700 Ari [email protected] wrote:

@billw2 Yes - this works, and it's a better approach. That way you are guaranteed to catch always the physical device which is the one you need for rpi-clone

Thanks for the feedback. I've pushed the change to filter findmnt results for /dev/

billw2 avatar Aug 26 '19 22:08 billw2

src_boot_dev=findmnt /boot -o source -n | grep "/dev/"

I confirm this is working on my osmc too...

fmarzocca avatar Aug 27 '19 06:08 fmarzocca