CHDK Forum

Using CHDK => General Help and Assistance on using CHDK stable releases => Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) => Topic started by: mayid on 08 / December / 2011, 12:51:56

Title: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 08 / December / 2011, 12:51:56
My CANON Powershot S3 IS won't boot from the SD card.

I created a partition (FAT16 - 50mb) in a SD card, and copied the main CHDK files in the root folder. Then i made the partition bootable using this commands as described in the wiki:
Code: [Select]
sudo umount /dev/sdc2
echo -n BOOTDISK | sudo dd bs=1 count=8 seek=64 of=/dev/sdc2

I also added a CHDK folder in the "big" partition (my sd card is a 2gb storage device).

Maybe i should set the little partition as "sdc1" instead od "sdc2"? I'm quite experienced with computers, and i'm using Ubuntu 11.04 on these days. So, i managed to make the second partition quite fine, even when the wiki doesn't specify much about it (how much space should it have, by example).

So, turning on the machine i just get a "card locked" message. No new features  ;)

By other hand, if i copy the files in the big partition and then i turn on the machine, then the firmware item appears. But this will not happen if i only have the main files in the bootable partition.

Any clue? I'll try formating the card and making first the little bootable partition. And post the result.   
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 08 / December / 2011, 13:07:21
Very nice. Removing and creating the partitions agains in the way i mentioned worked. Maybe this should be mentioned in the wiki. I mean, not all linux users will figure this out if not mentioned.

Cheers,
Mayid.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 08 / December / 2011, 14:31:46
I agree that "not all Linux users will figure this out", which is why I wrote LICKS - see http://www.zenoshrdlu.com/licks/licks.html (http://www.zenoshrdlu.com/licks/licks.html)

It's still in alpha and needs more testing, perhaps you could give a try?
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 08 / December / 2011, 15:53:50
Thanks for the reply. Yes, maybe i'll try it. Because right now i figured out that my 2gb partitioned card is not working as expected. See, i just can take 7 raw images... because my Canon is saving the images in the bootable partition!

So, about the wiki info: it says that 2gb memory cards should be partitioned, but it's not clear at least for me if by "making a partition" it means to make really a little partition to copy the bootable files. I ended up with the little bootable partition and the big one (fat16 both) but the camera saving images in the bootable section :O\

zeno: i'll try to give you feedback about the script. By the way, i used "acid" to choose my CHDK and download the right distribution. It's nice to have these ui tools. However, i don¡t think acid downloads more than the two main files (no subfolders).

Kind regards,
Mayid.

Quote
By default, cards less than 4GB in size can only be formatted as a single partition
Oh, i see. This is the info that's quite ambiguos in the wiki. I mean here, when it says Case 1. http://chdk.wikia.com/wiki/Bootable_SD_card#Linux: (http://chdk.wikia.com/wiki/Bootable_SD_card#Linux:)
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 08 / December / 2011, 16:03:11
I agree that "not all Linux users will figure this out", which is why I wrote LICKS - see http://www.zenoshrdlu.com/licks/licks.html (http://www.zenoshrdlu.com/licks/licks.html)

It's still in alpha and needs more testing, perhaps you could give a try?

zeno: i'm testing licks. Running this from console, i write my password, and the ui opens:
sudo java -jar licks.jar

However, i can't select the device. Maybe beacuse it's partitioned. But you say licks should alert me about this.

Anyway, in the bottom i read: no sudo permission - can't continue. Why? I do run with sudo, being in the right folder by the way.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 08 / December / 2011, 17:19:19
Quote
By default, cards less than 4GB in size can only be formatted as a single partition
Oh, i see. This is the info that's quite ambiguos in the wiki. I mean here, when it says Case 1. http://chdk.wikia.com/wiki/Bootable_SD_card#Linux: (http://chdk.wikia.com/wiki/Bootable_SD_card#Linux:)
This is wrong. 

Cards 4G in size and smaller that you wish to make bootable (SD Card lock method) can be formatted with either :

8G cards need to be formatted with two partitions  - either FAT16/FAT16 or FAT16/FAT32

Cards larger than 8G cards  need to be formatted with two partitions FAT16/FAT32

Cards used with only the firmware update boot method can be formatted with a single partiion of either FAT16 ( 4G or less ) or FAT 32 (any size).



Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 08 / December / 2011, 17:38:16
Guru Member: Sorry, it's me that toke Zeno's words out of context. :(  I realized that he referred to the software he wrote, no to the cards being converted in bootable devices (for CHDK to launch automatically). He says that Licks just do what it does, but he's not talking about requirements.

Quote
Cards used with only the firmware update boot method can be formatted with a single partiion of either FAT16 ( 4G or less ) or FAT 32 (any size).

This is the same concept that confused me in the wiki. I mean, if we are talking about a single partition, actually we are talking about no partition at all. For me (not being amused to partitions), "one partition" reffers to a divided storage device. That's why i made a little partition in my 2gb SD and i got the issue i mentioned.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: outslider on 08 / December / 2011, 18:48:20
Quote
For me (not being amused to partitions), "one partition" reffers to a divided storage device.

In fact - no. Device is a device and partition is a partition. For example even when you have only one partition you still have first 512 bytes of your device reserved for MBR (and partition table). So your only-one partition is not exactly the same as device. And that's not the only and maybe not the main difference. You can see it especially on *nix system such as GNU/Linux -  asume you have a pendrive. The whole device will be for egzaple /dev/sdb while its only-one partition will be /dev/sdb1. And both these virtual files have a little bit different content. Especially it would be bad idea do dd partition to a device;)

@mayid
I have the same problem...
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 08 / December / 2011, 20:35:55
This is the same concept that confused me in the wiki. I mean, if we are talking about a single partition, actually we are talking about no partition at all. For me (not being amused to partitions), "one partition" reffers to a divided storage device. That's why i made a little partition in my 2gb SD and i got the issue i mentioned.
I understand - this is one of those frustrating moment when working in a foreign language.  The same word can have different meaning in different contexts.  This is from http://www.thefreedictionary.com/partition (http://www.thefreedictionary.com/partition)

par·ti·tion  (pär-tshn)

1. a. The act or process of dividing something into parts.
    b. The state of being so divided.

2. a. Something that divides or separates, as a wall dividing one room or cubicle from another.
...
6. Computer Science A section of storage space on a hard disk.

So it would seem strange that when you create a partition on a hard disk ( i.e. you partition it),  you are creating a single storage area, not dividing a storage area into two parts.


Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 09 / December / 2011, 04:27:37
@mayid
you are the second person to report a problem with LICKS. The "no sudo permission" message appears when LICKS issues an "fdisk -l" command which fails. The normal reason for this is that fdisk requires permission, but there's obviously some other reason. I'll try and build a new versio of LICKS which produces better debugging information.

Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 09 / December / 2011, 09:34:50
@mayid

There's a new version of LICKS (1.03A) http://www.zenoshrdlu.com/licks/licks.zip (http://www.zenoshrdlu.com/licks/licks.zip) - if you set the "debug on" option it should produce a bit more information about the failing "fdisk -l" command. Could you download it and give it a try? Either post the log here or send it to daveATzenoshrdluDOT.com
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 09 / December / 2011, 11:03:01
@outslider: Yes, i understand that now. But well, my issues are solved. Where are you stacked?

@waterwingz: that's the point. English is not my main language, so i got confused. I suggest a text like this for the wiki:

"Case 1: To start from zero, either format your card with the camera, or use GParted (or fdisk) to create a single partition in the SD card. But actually there's no need to format at all, because we can assume that the card is already usable. Make sure the format is FAT16 in any case. 
About Gparted: Note that making a single partition doesn't mean dividing the card in two parts, but creating a FAT16 (in this particullar case) formatted card."
 
@zeno: i'll give Licks a try and report the results by email.  8) Are you sure the only way to detect a flash disk is calculating the storage size, by the way?
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 09 / December / 2011, 11:45:45
Could you download it and give it a try?
I tried this as well - Fedora16 64bit.

First of all,  I successfully formatted a 4G card as a single partion CHDK card and then as a dual partition CHDK card.

Strange sudo behaviour though.  It asks me for my sudo password when I start up in a new terminal window and run licks.sh but if I close and then rerun the licks.sh file from the same window,  it opens the app without needing the password again.   However,  if in the same terminal window I try fdisk -l I get no response - just the prompt back.  If I try sudo fdisk -l  I get a listing but need to type in my password each time.  So lick.sh seems to get a persistent sudo enabled status after the first run but fdisk needs a password each time.   Does that make sense and provide any clues ?


Minor nags (repeated from before) : The default window size still does not draw all the text & label boxes correctly. You have to drag the window to a much larger size.  That may be a function of the default font / font size on my system ?  And I still have to manually edit the licks.properties file after first running and closing licks to tell it that its okay to put a single partition on a 4G card.  Not sure how you discovered that there is a problem with 4G cards but I have 4 different brands of 4G SD card and they all work properly as single partition CHDK cards in either of my Canon cameras.

Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 09 / December / 2011, 12:01:02
@mayid

LICKS uses several commands that require sudo permission, so avoiding fdisk wouldn't solve the permission problem. It uses a combination of mount, fdisk, df and file to discover the true size of the card, what partitions are present (and what type and size they are) as well as whether the card is read-only or read-write. Just as an example, it's perfectly possible for a wrongly formatted 4GB card to have just a single 2GB partition (i.e. only 2GB of usable space). LICKS will detect things like this (on my machine at any rate, if not on yours!) and let you put things right. 
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 09 / December / 2011, 12:22:35
@waterwingz
So my attempt to solve the window size problem didn't work. I'll have another look at the code. And I will alter the default value of max1size to 4000 in the next version so you get the choice for 4GB cards.

As I understand sudo, the permission is meant to last for some time (15 minutes by default?) so after a 'sudo somecommand' has asked for and been given a password, subsequent 'sudo somecommand' won't ask for it. The first version of LICKS tried to ask for a password and issue the sudo commands under the covers, but fell over because it sometimes tried to provide a password when one wasn't needed.

What LICKS does under the covers is use the exec method of the java Process class to run commands via bash. I think I don't need to use bash for most of the commands LICKS issues - I could pass them directly, but some commands (e.g. echo) do need bash. It may be that variations in bash environment variables are causing problems with sudo and fdisk.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 09 / December / 2011, 12:32:50
So my attempt to solve the window size problem didn't work. I'll have another look at the code. And I will alter the default value of max1size to 4000 in the next version so you get the choice for 4GB cards.
I tried changing my Gnome "default" system fonts & sizes but that did nothing.  Do you actually specify a font & size to use in your code ?

Quote
As I understand sudo, the permission is meant to last for some time (15 minutes by default?) so after a 'sudo somecommand' has asked for and been given a password, subsequent 'sudo somecommand' won't ask for it.
That's pretty much my understanding.  What's strange on my system is that fdisk runs without sudo but returns nothing.  With sudo it return what you would expect.  And when the sudo timeout window is active,  it still acts as if sudo is not there -  returning nothing.  Lick.sh will run in sudo mode (i.e. no password needed) so this suggests some sort of sudo setup - sudoers command comes to mind.  In previous systems, I used that to bypass the whole sudo password thing for my UUID but I seem to recall you an tailor it on a per command basis.  I wonder if other differences in that setup are causing your user problems ?
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: outslider on 09 / December / 2011, 16:56:52
Quote
That's pretty much my understanding.  What's strange on my system is that fdisk runs without sudo but returns nothing.  With sudo it return what you would expect.
- same here.

About sudo time - maybe it's better tu run at start sudo su and then all commands will be run by root user (not regular user acting as root). This way there should be no timeout.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: mayid on 09 / December / 2011, 18:19:04
Starting with sudo su session made no difference to me. Still don't have sudo permission, Licks says. And some buttons are disabled (refresh, by example).
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 09 / December / 2011, 18:48:16
Sound more and more like a sudoers problem.

@mayid : what happens if you go into a terminal window and use the su command to switch to root (rather than sudo su) ?
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: outslider on 09 / December / 2011, 19:28:20
@waterwingz
To use just su you'd have to know the root password and it's disabled on Ubuntu. The only way you get root terminal is sudo su. Of course, you could set the root password, but I think there's no difference between su and sudo su - both cause you to be logged as a root.

I'm pretty sure, that I have no problems with sudoers - I had no other problems when root is needed...

My sudoers:
Code: [Select]
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d

Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 09 / December / 2011, 19:34:34
@waterwingz

The fontname is in the properties file - it's SansSerif by default (java lets you use logical names like sanserif, serif or monospaced as well as actual physical names like Helvetica or Palatino). The font size is currently hardwired at 12 and Bold. Without Bold, the text looks unpleasant on my machine but that may be because I'm running Ubuntu in a window using VMWare Fusion on my iMac. I'll make these choices selectable via the properties file.
Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: waterwingz on 09 / December / 2011, 20:20:51
To use just su you'd have to know the root password and it's disabled on Ubuntu.

Now I remember now why I have never been interested in Ubuntu.  If I want my distro to handcuff me,  I'll switch to something made by Apple :)
 
The sudoer thing is just a suggestion - something is making licks work differently between distros and that seems an obvious candidate.



Title: Re: SD card won't boot from partition. CANON Powershot S3 IS
Post by: zeno on 13 / December / 2011, 12:24:19
see my post here http://chdk.setepontos.com/index.php?topic=7181.msg77909#msg77909 (http://chdk.setepontos.com/index.php?topic=7181.msg77909#msg77909) for details of the latest version of LICKS which may solve some of the problems reported here.