I want to mount the second partition of my SD card at boot time for Link2SD's benefit, but I have been having a hard time.
I copied Link2SD's script in /data/adb/service.d/ and made some small changes:
Code:
#!/system/bin/sh
LOG=/data/link2sd-11link2sd.log
echo >> $LOG
date >> $LOG
sleep 10
mount -t ext4 -o rw,noatime /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
My log shows: "/data/adb/service.d/link2sd.sh: line 6: mount: Permission denied".
I have therefore tried to use su -c, and my log then shows: "/data/adb/service.d/link2sd.sh: line 7: su: Permission denied".
What am I doing wrong?
If it's useful, the log is also not showing the date.
noticed similar strange behavior guess Magisk is kinda broken
Related
I am using CyanogenMod v3.6.8.1 and I decided I wanted a swap partition.
I partitioned my 2GB SD with a 32MB swap partition and formatted using gparted.
From the shell (using adb) I remounted /dev/block/mtdblock3 with rw and edited /system/etc/fstab and added a line for the swap. Here is what the entire file looks like now:
Code:
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mmcblk0p1 /sdcard vfat rw
/dev/block/mmcblk0p2 /system/sd auto rw
/dev/block/mmcblk0p3 none swap sw
/system/modules/modules.sqf /system/modules squashfs ro,loop
/system/xbin/xbin.sqf /system/xbin squashfs ro,loop
I can turn on the swap with 'swapon -a' which works and shows up in /proc/swaps and with the 'free' command, but upon boot, swap isn't activating.
I'm not really familiar with the android init scripts, so I'm not sure how I can enable the swap automatically upon boot. Any advice would be appreciated.
Okay I fixed it.
I downloaded one of Drizzy's roms that I know use swap, extracted, and searched for 'swap' in all the files. I found it in /system/bin/a2sd at the end. Here is what's there:
Code:
if [ -n /dev/block/mmcblk0p3 ];
then
mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then
echo 30 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
The first if doesn't make sense to me as it's a string test which will always be true, so I got rid of it and just kept the test for the file existing, but I changed it to -b to be a little more specific (to see if it's a block device), and I commented out the swappiness change to leave it at default.
Im using same rom and i woild love to do this but is there any other way as im totally unfamiliar with adb
turboyo said:
Im using same rom and i woild love to do this but is there any other way as im totally unfamiliar with adb
Click to expand...
Click to collapse
I just used adb because I can use the copy/paste function of my gnome terminal and it's easier than using the shell on the phone itself.
Here is what is needed:
Get into a root shell, either on the phone or using adb.
Code:
mount -t yaffs2 -o rw,remount /dev/block/mtdblock3 /system
vi /system/bin/a2sd
press capital G which will take you to the bottom of the file
press lower case o which will open a line below your cursor for editing.
type in the following:
Code:
if [ -b /dev/block/mmcblk0p3 ];
then
echo 30 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
press escape to exit insert mode (I read that in the terminal emulator you have to hold the trackball and press 1 for esc)
type :wq and press enter.
exit terminal and reboot. To see if it's working, get back into a terminal and use the command 'free'
you can also do 'swapon -a' instead of specifying the swap partition itself. Note that the above example uses the third partition of the SD card as the swap.
This also assumes you have already created the swap partition and formatted it as swap.
You can omit the swappiness line to leave it at the linux default of 60.
I'm not the original author of this, but I changed a few commands to make it work with the Vibrant. I found it here:
http://android.modaco.com/content/htc-hero-hero-modaco-com/295691/easy-system-remount-script/
Requires busybox.
Take this and save it as a file named "remount" or unzip it from attached archive
#!/system/bin/sh
#
# Remount /system partition
case "$1" in
ro)
echo "Setting /system to RO (read only)"
mount -o ro,remount -t rfs /dev/block/stl9 /system
echo ""
echo "Current status of /system mount:"
mount |busybox grep "/system rfs"
echo ""
;;
rw)
echo "Setting /system to RW (read write)"
mount -o rw,remount -t rfs /dev/block/stl9 /system
echo ""
echo "Current status of /system mount:"
mount |busybox grep "/system rfs"
echo ""
;;
status)
echo ""
echo "Current status of /system mount:"
mount |busybox grep "/system rfs"
echo ""
;;
*)
echo "Valid input format:"
echo " remount [ro|rw|status]"
echo " ro = read only (default)"
echo " rw = read write (to make modifications)"
echo " status = current mount mode"
echo ""
echo "Current status of /system mount:"
mount |busybox grep "/system rfs"
echo ""
exit 1
esac
Click to expand...
Click to collapse
From Windows:
adb push c:\path\to\remount /sdcard/
adb shell
su
mount -o rw,remount -t rfs /dev/block/stl9 /system
busybox mv /sdcard/remount /system/bin/
chmod 755 /system/bin/remount
remount ro
Ctrl+C. Tada!
So I decided to try JVH because it looked cool. I got Tweaky's JVH rom and flashed that up. Converted to EXT4 and was everything worked. Somehow I flashed an update of his rom that had voodoo's kernel in there and it converted my internal memory to EXT4 on top of it being EXT4 already. I just flashed voodoo's kernel and it has said it disabled the lag fix, but EXT4 tools still can't access my sd card (everything is grayed out) so I can't confirm anything at all, and the phone acts erratically some times (apps are downloaded and installed but don't show up at all)
TLDR:
Something weird happened and now im on JVH without being able to confirm whether or not a lagfix is enabled (voodoo said it disabled a lagfix and CF Root can't read my internal memory)
Any help?
I think if you open up an adb shell and type 'mount' it should tell you what filesystem you're using.
i get some weird segmentation fault error
Code:
* daemon not running. starting it now *
* daemon started successfully *
$ mount
mount
Segmentation fault
$ help
help
help: not found
$ /?
/?
/d: permission denied
$ ?
?
d: not found
$ #
#
$ #mount
#mount
$ #mount
#mount
$ su
su
#su
#su
su
su
#su
#su
Permission denied
$ #su
$ su
# #su
# mount
mount
Segmentation fault
# umount
umount
Segmentation fault
# mount
mount
Segmentation fault
# echo /dev/block/mmcblk0 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file
echo /dev/block/mmcblk0 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file
cannot create /sys/devices/platform/s3c-usbgadget/gadget/lun1/file: directory no
nexistent
# dd if=/dev/zero of=/dev/mmcblk0p1
dd if=/dev/zero of=/dev/mmcblk0p1
ddd: writing '/dev/mmcblk0p1': No space left on device
336617+0 records in
336616+0 records out
172347392 bytes (164.4MB) copied, 4.479194 seconds, 36.7MB/s
# mount
dmount
dmount: not found
# mount
mount
Segmentation fault
# umount /dev/block/mmcblk0p1
umount /dev/block/mmcblk0p1
Segmentation fault
# mount /dev/block/mmcblk0p1
mount /dev/block/mmcblk0p1
Segmentation fault
# mount
mount
Segmentation fault
# ls
ls
Segmentation fault
# dd if=/dev/zero of=/dev/mmcblk0p1
dd if=/dev/zero of=/dev/mmcblk0p1
dd: writing '/dev/mmcblk0p1': No space left on device
336617+0 records in
336616+0 records out
172347392 bytes (164.4MB) copied, 2.161554 seconds, 76.0MB/s
# fdisk -l /dev/block/mmcblk0
fdisk -l /dev/block/mmcblk0
Segmentation fault
#
hey can u tell me how to convert the file system to ext4. Please i m desparate...
supershailz said:
hey can u tell me how to convert the file system to ext4. Please i m desparate...
Click to expand...
Click to collapse
I think it would be a really good help if you provided some details.
What kernal have you used?
I would go for clean ezbase flash, that will get you back and working, then just flash kernel, then rom and try again
Sent from gt i9000 insanity 8.5/fugumod
heya guys.
is it possible to unload/unmount the external sd (mounted in /mnt/sdcard/external_sd) via command like unmounting it via settings?
i knew that the card is mounted as mmcblk1(p1).
how about to mount it to another place via command?
is it even possible?
trying via terminal emulator says always that the device is still busy and cannot unmounted. even with -f
cheers ~
current state is as following:
/etc/init.d/S01init
Code:
#!/system/bin/sh
# remount
busybox mount -o rw,remount /
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
chmod 0775 /mnt/sdcard_ext
#duplicate, delete and linking original files
cp /init.rc /init.rc_original
cp /etc/voId.fstab /etc/voId.fstab_original
rm /init.rc
rm /etc/voId.fstab
ln -s /etc/init.d/scripts/init.rc /init.rc
ln -s /etc/init.d/scripts/voId.fstab /etc/voId.fstab
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
busybox mount -o ro,remount /
### end
custom init.rc
Code:
on early-init
start ueventd
on init
sysclktz 0
loglevel 3
# setup the global environment
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export EXTERNAL_STORAGE /mnt/sdcard
export EXTERNAL_STORAGE2 /mnt/sdcard_ext
export USBHOST_STORAGE /mnt/sdcard/usbStorage
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
# Backward compatibility
symlink /system/etc /etc
symlink /sys/kernel/debug /d
# Right now vendor lives on the same filesystem as system,
# but someday that may change.
symlink /system/vendor /vendor
# create mountpoints
mkdir /mnt 0775 root system
mkdir /mnt/sdcard 0000 system system
mkdir /mnt/sdcard_ext 0000 system system
# Create cgroup mount point for cpu accounting
mkdir /acct
mount cgroup none /acct cpuacct
mkdir /acct/uid
#add booting sound property
setprop audioflinger.bootsnd 1
# Backwards Compat - XXX: Going away in G*
symlink /mnt/sdcard /sd/sdcard
mkdir /system
mkdir /dbdata 0771 system system
mkdir /data 0771 system system
mkdir /cache 0770 system cache
mkdir /config 0500 root root
mkdir /efs 0771 system system
chown system system /efs
chmod 0771 /efs
.
.
.
custom voId.fstab
Code:
## Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################
# sdcard mount for the P1
# internal sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun0/file
discard = disable
asec = disable
}
dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0
# externel sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun1/file
asec = enable
}
dev_mount sdcard1 /mnt/sdcard_ext auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2
#end line ## keep this line
after rebooting:
- the custom voId.fstab is completely ignored...
- init.rc is changed to custom init.rc
- folders and linkings are correct
but it also links to /sdcard and /sdcard/external_sd
i dont want my external sd-card on /sdcard/external_sd and the internal on /sdcard
is there no way to fix that?
Look at this thread. May be it will be helpful for you.
swapping won't help.
problem is to fix the /proc/mounts - paths for the external card.
it wont let me modify it
1. I think you have to put name vold.fstab (little L, not big I)
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
I can be wrong because I don't know about changes in the Darky's Extreme Edition v10.1 ROM. but my words are true for stock rom for i9003
falex007 said:
1. I think you have to put name vold.fstab (little L, not big I)
Click to expand...
Click to collapse
that would explain whats going wrong by replacing the old with the new file.
falex007 said:
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
Click to expand...
Click to collapse
/sdcard isnt the problem.
its the external sd-card, which i want to mount on an other path (e.g. /mnt/sdcard_ext) and symlink it to /sd/sdcard_ext
symlinking isnt the problem. seperating both cards is all i want.
my desired goal is as following:
internal sd: /mnt/sdcard & symlink to /sd/sdcard
external sd: /mnt/sdcard_ext & symlink /sd/sdcard_ext
I understood what you want by reading /etc/init.d/S01init And I think that if you replace old vold.fstab with new one, the problem with mounting external card will be solved too
if i replace the vold.fstab manually and reboot the phone, external sd wont be recognized. it won't load any or mount it on the right place. both folders, original and desired, stay still empty. if I try to mount it manually, it says that the desired path is not recognized by /proc/mounts. changing the mounts file wont change the mount-paths
UPDATE:
ok, i'm now on this:
Code:
#!/system/bin/sh
FSTAB=/system/etc/vold.fstab
FSTAB_O=/system/etc/vold.fstab_original
# remount rw
busybox mount -o rw,remount /
busybox mount -o rw,remount /system
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
#duplicate, delete and replace original files
if [ ! -e $FSTAB_O ]; then
cp $FSTAB $FSTAB_O
reboot
fi
rm /init.rc
rm $FSTAB
cp /etc/init.d/scripts/init.rc /init.rc
cp /etc/init.d/scripts/vold.fstab $FSTAB
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
# remount ro
busybox mount -o ro,remount /
busybox mount -o ro,remount /system
### end
this script ended in fully ignoring the new vold.fstab after reboot.
now the external sd is mounted at the old mount-point /sdcard/external_sd...
any suggestions?
btw: does anyone knows where the real /proc/mounts is?
it links to self/mounts... what does that mean?
UPDATE:
after replacing vold.fstab i cant install apps at all.
installing ends in forced hotboot.
There are threads on this site and elsewhere showing the steps to boot ubuntu on android phones. Our Ideos X6 comes with a powerful hardware so i believe we can run ubuntu on it. But it seems that the kernel must support loop devices. Can anyone make a custom kernel supporting loop devices.
Or has anyone successful in running Ubuntu on Ideos X6.
Our kernel have support for loop device. Take this little instruction how install ubuntu oneiric, also the same process for debian just write distribution name and correct url in debootstrap.
1. this stage you must complete on your linux pc.
Code:
#debootstrap part on PC
sudo apt-get install debootstrap
sudo dd if=/dev/zero of=ubuntu.img seek=838860800 bs=1 count=1
sudo mke2fs -F ubuntu.img
sudo mkdir ubuntu
sudo mount -o loop ubuntu.img ubuntu/
sudo debootstrap --arch armel --foreign oneiric ubuntu http:/ports.ubuntu.com/ubuntu-ports/
sudo umount ubuntu
sudo rm -r ubuntu
2. push this ubuntu.img to sdcard on your phone.
Code:
adb push ubuntu.img /sdcard/ubuntu.img
3. create this script as ubuntu.sh on your sdcard too
Code:
echo "Setting some stuff up.."
export bin=/system/bin
export img=/mnt/sdcard/ubuntu.img
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mkdir $mnt
echo "Mounting the Linux Image"
busybox losetup /dev/block/loop7 $img
mount -t ext2 -o noatime,nodiratime /dev/block/loop7 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Setting Up Networking"
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Mounting sdcard in /mnt"
mkdir $mnt/mnt/sdcard
busybox mount --bind /mnt/sdcard/ $mnt/mnt/sdcard
echo "Entering CHROOT "
echo " "
busybox chroot $mnt /bin/bash
echo " "
echo "Shutting down CHROOT"
umount $mnt/mnt/emmc
umount $mnt/mnt/sdcard
busybox sysctl -w net.ipv4.ip_forward=0
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
busybox losetup -d /dev/block/loop7
4. So now we connect to device, run superuser permission, and chroot to ubuntu
Code:
sudo adb shell
su
sh /sdcard/ubuntu.sh
5.run continue deboostrap
Code:
/debootstrap/debootsrap --second-stage
6. setup apt
Code:
echo 'deb http:/ports.ubuntu.com/ubuntu-ports/ oneiric main' >/etc/apt/sources.list
apt-get clean
apt-get update
7. add root password
Code:
passwd root
8. exit from ubuntu shell with 'exit' and run it again sh /sdcard/ubuntu.sh from terminal emulator on your device or via adb shell.
So, now ubuntu install successfully on your phone and you may install openssh and vnc server.
P.S. http:/ correct it with two //, I can't push correct link to forum. its denied post urls.
Error
I followed your steps exactly as given and changed / to // in http i am getting the following output when i ran ubuntu.sh. kindly help
# sh ubuntu.sh
Setting some stuff up..
mkdir failed for /data/local/ubuntu, File exists
Mounting the Linux Image
losetup: /dev/block/loop7
mount: Device or resource busy
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
Setting Up Networking
net.ipv4.ip_forward = 1
ubuntu.sh: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
ubuntu.sh: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
ubuntu.sh: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
Mounting sdcard in /mnt
mkdir failed for /data/local/ubuntu/mnt/sdcard, No such file or directory
mount: mounting /mnt/sdcard/ on /data/local/ubuntu/mnt/sdcard failed: No such file or directory
Entering CHROOT
chroot: can't execute '/bin/bash': No such file or directory
Shutting down CHROOT
failed.
failed.
net.ipv4.ip_forward = 0
failed.
failed.
failed.
failed.
losetup: /dev/block/loop7: Device or resource busy
Possbile what loop7 device already busy on your phone.
ry this command to see it
Code:
busybox losetup
And try manual steps which in script to see which step is failed.
When I type
Code:
#busybox losetup
nothing happens
when i type
Code:
#busybox losetup /dev/block/loop7 /mnt/sdcard/ubuntu.img
losetup: /dev/block/loop7
Code:
#mount -t ext2 -o noatime,nodiratime /dev/block/loop7 /data/local/ubuntu
mount: Device or resource busy
the second line is the outputfrom the command.
Do you phone have block devices in /dev/block/ ?
just checked using root explorer. there are many loop# files in /dev/block folder
You may try with UC kernel, or try with ext3 file system. I suppose what your kernel without support ext2.
i tried with UC v5. It supports ext2,ext3 and ext4. Still getting same error.
Should i convert my android filesystem to ext2,3,0r 4. If yes how to do it?
No, you don't need do converting. Problem with loop device or mount, try to see busybox losetup after mount image to block device, it's must show what image mounted to block device. If it's ok, try different option for mount.
I don't have anymore ideas why it doesn't work.
This scenario successful work on my phone.
Can you tell me what ROM you are using
Sent from my CSL-MI410 using XDA App
Last rom from wellcom (2.3-V318E)
now it works. Installed ubuntu. But i am now unable to install any package. when i try to install tightvncserver i get error message
E: Unable to locate package tightvncserver
actally i am not able to install any package
i have checked the /etc/apt/sourcels.list and it contains the required entry and i also did
apt-get clean
apt-get update
and it updates without any error
You need add another repositories to /etc/sources.list such as universe, multiverse, restricted with the same path.