Safe Mode


46 posts   Page 2 of 2   1, 2
by dom » Tue Dec 04, 2012 5:29 pm
plugh wrote:Are you talking about putting something into the mainstream firmware release? (imho fwiw, I'd say remove the current 'pretend' hack from the firmware and just release a fix-it app.)
Anyway... Do you have "bad" samples to test against (it IS a OneTP), or are you looking for a volunteer?

Yes. It will be done from an updated start.elf.
The code for programming the board rev is already in place (and well tested). Currently you can program your board rev with:
program_board_rev=<board_rev>
in config.txt. But it only lets you if you currently have a zero board rev.

I'll change it so you can also program the board_rev if it currently differs from the reported board rev. I should push that out tonight.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4032
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by dom » Wed Dec 05, 2012 6:19 pm
@plugh
Latest "next" tree firmware can update your board revision. Update with:
Code: Select all
sudo rpi-update c6b0066396723a86f390f8330a679bbce8e99b9b

(you may need to "sudo rpi-update" first).

Then add:
program_board_rev=15
to config.txt and reboot. After that, safe mode should work as expected, and:
Code: Select all
vcgencmd otp_dump |grep 30:

should now be 15.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4032
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by plugh » Wed Dec 05, 2012 7:38 pm
The deed is done; OTP rev is now 0xF.

And vanilla 10-28 raspbian kit now boots kernel_emergency.img with GPIO3 (rev2 P1-5) pulled down.

Thanks!
Posts: 24
Joined: Sun Dec 02, 2012 6:58 pm
by sdjf » Thu Dec 06, 2012 6:39 am
The instruction to "Short Jumpers 5&6" in the wiki needs to be expanded to make sense to folks who have no clue what that means. It leaves me guessing that it means to connect the pins?

http://elinux.org/RPI_safe_mode

Also, does this apply to Arch as well, or to the Next firmware that Pepedog made available to Raspberry Pi Arch Linux users?
FORUM TIP: To view just one person's posting history, sign in, click on their user name, then click on "Search User's Posts." || This Pi owner is running Arch on 512MB Model B.
Posts: 1294
Joined: Fri Mar 16, 2012 5:20 am
Location: California
by bgirardot » Fri Dec 28, 2012 6:57 pm
sdjf wrote:The instruction to "Short Jumpers 5&6" in the wiki needs to be expanded to make sense to folks who have no clue what that means. It leaves me guessing that it means to connect the pins?

http://elinux.org/RPI_safe_mode

Also, does this apply to Arch as well, or to the Next firmware that Pepedog made available to Raspberry Pi Arch Linux users?


I edited that wiki page and added a photo. I think it clarifies what to do a fair amount.
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by Schuitz » Sun Jan 27, 2013 1:30 pm
I just wanted to add that I got into trouble and needed the emergency kernel as described. I also have the incorrect OTP as described.

With a set of sharp tweezers and good eyesight, you can, with care, pull s5 pin 13 to ground by using tweezers to short it to pin 10. A third hand is useful to power on the board, but not essential if you are steady.

Strictly speaking, hitting adjacent pins cam_clk or cam_gpio is probably not a great idea if they are set up as push-pull outputs early in the boot sequence, but is unlikely to be catastrophic. But don't hold me to it. You don't have to dwell there long, as the alternate kernel should come up immediately.

Best to have your second cup of coffee after doing this maneuver. But then, you're here because you're in the soup, right? If it weren't dicey it wouldn't be fun :mrgreen: .
Posts: 15
Joined: Sun Jan 27, 2013 1:17 pm
by Schuitz » Sun Jan 27, 2013 3:44 pm
...aaaand a guy should read to the end of the thread before posting. However, if you're like me and get stuck before you have updated to the latest and greatest, you still have to pull a move on S5. Or, if you're like me and tack-soldered some wires onto P1 pin 6 for an IR receiver, no jumper for you.

I will add that it's simpler just to short S5 pin 13 to the HDMI shield.

In my case, once I was in, I had to mount -t ext4 my root partition because I blew an fstab entry.
Posts: 15
Joined: Sun Jan 27, 2013 1:17 pm
by moreins » Thu Jan 31, 2013 2:45 am
hello
I configured a daemon that starts at runlevel 2. i messed up and ended up with a hung boot process.
i got to safe mode on my raspi but im struggling when mounting the mmc so i can fix this.

i tried

Code: Select all
mkdir /mnt
mount /dev/mmcblk0p2 /mnt


and i get
Code: Select all
mount: mounting /dev/mmcblk0p2 on /mnt failed: No such file or directory


can you kindly provide any ideas on how to fix this?
thanks
Posts: 6
Joined: Sat Dec 01, 2012 3:50 pm
by moreins » Thu Jan 31, 2013 3:30 am
moreins wrote:hello
I configured a daemon that starts at runlevel 2. i messed up and ended up with a hung boot process.
i got to safe mode on my raspi but im struggling when mounting the mmc so i can fix this.

i tried

Code: Select all
mkdir /mnt
mount /dev/mmcblk0p2 /mnt


and i get
Code: Select all
mount: mounting /dev/mmcblk0p2 on /mnt failed: No such file or directory


can you kindly provide any ideas on how to fix this?
thanks

update: this worked for me better
http://raspberrypi.org/phpBB3//viewtopi ... 06#p163706
Posts: 6
Joined: Sat Dec 01, 2012 3:50 pm
by rod_gilchrist » Thu Oct 10, 2013 1:50 am
To ask the same question again, how do you mount partition 2 of the SD card in safe mode?

by dom » Wed Aug 15, 2012 9:33 am
thektalin wrote:
Hello,how do i mount /dev/mmcblk0p2 in safe mode? because if i type: df, i can find it .


mount /dev/mmcblk0p2 /mnt
If /mnt doesn't exist then "mkdir /mnt" first.


This is what happens from safe mode:

    # ls -ld /mnt
    drwxr-xr-x 2 root root 0 Sep 19 2013 /mnt
    # ls -l /dev/mmcblk0p2
    brw-rw---- 1 root root 179, 2 Jan 1 00:00 /dev/mmcblk0p2
    # mount /dev/mmcblk0p2 /mnt
    mount: mounting /dev/mmcblk0p2 on /mnt failed: Invalid argument
    #
Posts: 2
Joined: Thu Oct 10, 2013 1:40 am
by rod_gilchrist » Fri Oct 11, 2013 3:22 am
To answer my own question, you don't mount partition 2 of the SD card when you are using NOOBS 1.3.
Partition 2 is the device for the entire disk. Presumably it used to be something useful to mount but it
no longer makes sense to do so.

What I was trying to do was to use safe mode to restore the old kernel after I installed one that didn't work.
See below for the answer to that question.

by rod_gilchrist » Wed Oct 09, 2013 9:50 pm

To ask the same question again, how do you mount partition 2 of the SD card in safe mode?

by dom » Wed Aug 15, 2012 9:33 am
thektalin wrote:
Hello,how do i mount /dev/mmcblk0p2 in safe mode? because if i type: df, i can find it .


mount /dev/mmcblk0p2 /mnt
If /mnt doesn't exist then "mkdir /mnt" first.
.
.
.
# mount /dev/mmcblk0p2 /mnt
mount: mounting /dev/mmcblk0p2 on /mnt failed: Invalid argument


In NOOBS 1.3 safe mode with Rasbian installed, an fdisk -l gives the following:

Code: Select all
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192     2505859     1248834    e  W95 FAT16 (LBA)
/dev/mmcblk0p2         2506752    15663103     6578176   85  Linux extended
/dev/mmcblk0p3        15663104    15728639       32768   83  Linux
/dev/mmcblk0p5         2514944     2637823       61440    c  W95 FAT32 (LBA)
/dev/mmcblk0p6         2646016    15663103     6508544   83  Linux


The partitions are:

/dev/mmcblk0p1 - this partition is the recovery file system containing the system images.
/dev/mmcblk0p5 - this partition is mounted as /boot when in normal operation of Raspian.
/dev/mmcblk0p6 - this partition is the / filesystem when in normal operation.

dom's answer above works fine for mounting any of these three file systems in safe mode or on another linux machine (e.g.)

mount /dev/mmcblk0p5 /mnt

Another useful and interesting answer is that if you plug the SD card into a Mac, partition 1 and 5 show up as
disks called RECOVERY and BOOT respectively.
Posts: 2
Joined: Thu Oct 10, 2013 1:40 am
by Tyguy7 » Mon Dec 16, 2013 1:50 am
Unfortunately, doing this fried my Pi. I made sure to use a jumper that hasn't been in a computer for many years, so it definitely carried no charge. I am not happy at all.
Posts: 1
Joined: Mon Dec 16, 2013 1:49 am
by texy » Mon Dec 16, 2013 7:36 am
A jumper doesn't carry any charge - it is just a short piece of wire/metal :o
Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2387
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by gmc » Wed Dec 18, 2013 9:04 pm
Great feature - this will really come in handy.
Posts: 100
Joined: Fri Mar 09, 2012 11:31 am
by Douglas6 » Fri Jan 03, 2014 6:09 pm
Well, this saved my cookies when i ended up with a 'halt' command in my /etc/rc.local (don't ask). Cool feature, thanks!
User avatar
Posts: 1025
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by dom » Tue Mar 18, 2014 6:20 pm
This feature is removed from default firmware as of 18th March 2014. NOOBS still supports a safe mode, using the same gpio pins.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4032
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by cleverca22 » Thu Mar 20, 2014 3:51 am
why was it removed?, could a config.txt parameter be used to turn it back on?
Posts: 168
Joined: Sat Aug 18, 2012 2:33 pm
by dom » Thu Mar 20, 2014 4:15 pm
cleverca22 wrote:why was it removed?, could a config.txt parameter be used to turn it back on?


It was an order from above. I think the view was that no one used it, and it was occasionally triggered accidently (when interfacing with hardware like Gert board).
It requires maintaining an additional kernel build (kernel_emergency.img), and the extra sdcard space / download time when updating.

(personally I'd have prefered to keep it, as I use it occasionally).
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4032
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Douglas6 » Thu Mar 20, 2014 5:16 pm
Awwwww. I've used it (see my post 3 or 4 back). There are work-arounds, and I can see the confusion it might cause, but personally I would have kept it too. :)
User avatar
Posts: 1025
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by rpdom » Thu Mar 20, 2014 5:31 pm
I would have kept it too, as it provided a good environment to make backup SD cards with just a USB card reader.

I agree that the number of false activations were becoming a bit of a problem though, but I'd probably make the "ignore_safe_mode" the default.

I can see that building a special kernel just for this (rarely used) mode isn't really justified.
Posts: 3562
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by cleverca22 » Fri Mar 21, 2014 12:33 am
it could be modified to only work if a config.txt entry enables it?
the config.txt could also select which gpio triggers safemode, so if you dont want it, just dont enable it

if the gertboard causes problems with the current pin and you have another pin that is safe and want it, just change it in config.txt

i had thought about using safe mode to boot into an OS menu, but letting start.elf run the 'selected' OS directly when your not holding that button
the kernel_emergency.img would rename kernel.img to match your choice, and then it would run the last item with zero middleman
Posts: 168
Joined: Sat Aug 18, 2012 2:33 pm