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

Script breaks when using ROOT_PATH #117

Open
drhs opened this issue Sep 16, 2013 · 4 comments
Open

Script breaks when using ROOT_PATH #117

drhs opened this issue Sep 16, 2013 · 4 comments

Comments

@drhs
Copy link

drhs commented Sep 16, 2013

After long on-and-off tinkering with VideoCore Libraries/Utilities via direct "git clone firmware", I gave Rpi-update a shot on my Raspbmc install.
(which doesn't seem to support "apt-get install rpi-update", but that's another story)

I first want to test, I don't want to overwrite my current install, so I use an offline update:

  ROOT_PATH=/root/firmware BOOT_PATH=/root/firmware/boot SKIP_KERNEL=1 rpi-update

(And yes; I've unset RPI_UPDATE_UNSUPPORTED)

Issues with above settings:

  1. The rpi-update script uses internally WORK_PATH which as a subdir of ROOT_PATH.
    This subdir ($ROOT_PATH/root) must exist and should NOT be given as ROOT_PATH as in the README.md example.
    (script breaks on this issue)
Suggestion: change ROOT_PATH example in README.md  ( "ROOT_PATH=/media/root" should be "ROOT_PATH=/media")
Suggestion:  Force a mkdir of $ROOT_PATH/root in the script (if it doesn't exist)
  1. rpi-update script function "update_vc_libs" checks for a SoftFP/HardFP system.
    It uses "${ROOT_PATH}/bin/bash" as testfile, but in my case there's no /bin/bash under $ROOT_PATH
    (script breaks on this issue)
Suggestion: Change script, and always test for "/bin/bash"
  1. In the function "finalise" ldconfig is run (with -r option)
    It uses /etc/ld.so.cache~ as temp-file.
    If ROOT_PATH is used, there's no "etc" subdir under ROOT_PATH. It must be made by hand.
    (I'm not sure why this is run when SKIP_KERNEL=1)
    (script breaks on this issue)
Suggestion:  Force a mkdir of $ROOT_PATH/etc in the script (if it doesn't exist)

The 2nd issue forced me to temper with rpi-update and use UPDATE_SELF=0 (I could also have copied /bin/bash to ROOT_PATH)

gr,
Rob

@lurch
Copy link
Contributor

lurch commented Apr 14, 2014

Your problem seems to be that you're attempting to update the firmware into an empty directory - that's not what the offline mode is intended for, it's intended for updating an existing installation.

Perhaps the README doesn't explain it well enough, but offline-mode is intended for when e.g. your SD card has become unbootable, and so you want to use another Linux PC to update the firmware on the SD card. In this case the assumption is that BOOT_PATH is the location at which your distro auto-mounts the FAT partition of your SD card, and ROOT_PATH is the location at which your distro auto-mounts the EXT4 partition of your SD card. And so we need to check "${ROOT_PATH}/bin/bash" because we want to know what's actually on the SD card, whereas /bin/bash would be the x86 executable on the PC!

ldconfig is always run regardless of SKIP_KERNEL because we need to update ld.so.cache with the shared libraries that get installed into /opt/vc/lib. Maybe you're confusing ldconfig with depmod, which does indeed get skipped when SKIP_KERNEL=1.

TBH I'm not really sure what you expected to achieve with "I first want to test, I don't want to overwrite my current install" ?

@Ruffio
Copy link

Ruffio commented Jun 21, 2015

@lurch as there havn't been any response in a year, I suggest that this issue should be closed.

@popcornmix
Copy link
Collaborator

I've pushed an update that now allows rpi-update to an empty directory.
It's not directly useful, but does allow the files retrieved from rpi-update to be examined
before a real update.

I don't agree that the README.md is wrong. In:

sudo ROOT_PATH=/media/root BOOT_PATH=/media/boot rpi-update

/media/boot is a mount point for the boot partition (e.g. /dev/mmcblk0p0 or /boot on sdcard)
/media/root is a mount point for the root partition (e.g. /dev/mmcblk0p1 or / on sdcard)

@lurch
Copy link
Contributor

lurch commented Jun 21, 2015

Hmmm, interesting.
Rather than always blindly creating any missing directories (I feel that erroring on expected-but-missing-directories is always a useful sanity check for a script that's being run as the root user!), maybe it'd be better to have an explicit TEST_PATH= option? (or similar)
The TEST_PATH option would be mutually-exclusive with the ROOT_PATH and BOOT_PATH options, but then have the advantages that:

  • You'd only need to specify a single TEST_PATH, rather than both a ROOT_PATH and a BOOT_PATH (the script internally would set both ROOT_PATH and BOOT_PATH based on the value of TEST_PATH)
  • The script would know it'd be 'safe' to create any missing directories
  • There'd be no need to check for the readelf command (since we know in TEST_PATH mode it'd never be needed) - and we know ldconfig and depmod would never need to be called either
  • And finally and perhaps most importantly, when running under TEST_PATH mode there'd be no reason to check for the script being run as the root user i.e. you could just 'update' into an empty user-owned directory. (which perhaps implies that TEST_PATH mode should also disable the auto-self-update feature?)

Just my humble suggestion... ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants