I recently had a problem with root access on my Beagleboard running Ubuntu 11.10 from an SD card. Basically I had accidentally removed my user account from the admin group. As it was the only user account I had set-up when installing Ubuntu: I was stuck!
The only option that I was aware of that would allow me to recover root access, was to boot Ubuntu in single user mode and add my user account back into the admin group.
I tried this by editing the UBoot bootargs parameter so I could enter Single user mode, setting it to:
OMAP3 beagleboard.org # setenv bootargs 'console=ttyS0,115200n8 root=1f01 rootfstype=jffs2 reboot=cold,hard S init=/bin/sh' OMAP3 beagleboard.org # boot
(NOTE This won't work!)
Note the addition of 'S' to the kernel parameters, which should instruct Ubuntu to enter into single user mode. AFAIK 'emergency' can also be used, but that brings you into a more basic environment.
This should have worked! But Ubuntu wasn't booting into single user mode. I didn't understand it until I looked at the complete bootcmd UBoot was using, which was the following:
setenv bootcmd 'mmc init; fatload mmc 0 0x82000000 boot.scr; source 0x82000000'; setenv autostart yes; saveenv; boot
Ahh, so the boot.scr script was being loaded from the boot partition on the SD card. I had a look at that file by mounting the SD card on my MAc and found that that script was overriding the bootargs parameter that I had manually set in UBoot.
Simple solution was to run the following commands in UBoot that bypassed the script on the boot partition of the SD card:
mmc init; mmc rescan 0; fatload mmc 0 0x82000000 fatload mmc 0:1 0x80000000 uImage fatload mmc 0:1 0x81600000 uInitrd setenv bootargs ro vram=12M omapfb.mode=dvi:1280x720MR-16@60 mpurate=auto root=UUID=76bfdd66-898d-4d50-be7a-4c8fd2691266 fixrtc console=ttyO2,115200n8 S bootm 0x80000000 0x81600000
Once booted into the command prompt I added my user to the admin group and restarted the board. Problem solved.
- Could I have mounted the SD card on my Linux PC and edited the appropriate file to re-add my user account to the admin group?
- Always a good idea to create a second user account that has admin access.