dpkg couldn`t execute in a read-only root filesystem

Asked by wally on 2012-10-02

Good day, everyone:
I used to install dpkg packages in my embedded arm board with a nand flash, and my initrd will mount all my entire root filesystem as aufs, and I can 'temporary' install dpkg packages.

And recently I change my kernel and removed initrd, so now I have to mount aufs after boot in linux, and "/" can`t be mounted as aufs after this change, but the others(etc, var, usr etc...) still can mounted as aufs, and cause a big problem --- It can`t install any dpkg packages!

When I type something like: "sudo dpkg -i udiskie_0.4.2-atrust1-1_armel.deb", and system will spill out the following:

dpkg: error processing udiskie_0.4.2-atrust1-1_armel.deb (--install):
unable to securely remove '//..dpkg-tmp': Read-only file system

This confuse me, I don`t think it need "/" writeable to install packages.Could someone please teach me why this happen? I will be so grateful.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
wally
Solved:
2012-10-02
Last query:
2012-10-02
Last reply:
2012-10-02

Try:

sudo mount -o remount,ro /

wally (wally-yeh) said : #2

to actionparsnip:
    Thanks for help, and I tried, but no luck, still get the same error:

user@atrust-004CC8:/tmp$ sudo mount -o remount,ro /
user@atrust-004CC8:/tmp$ sudo dpkg -i udiskie_0.4.2-atrust1-1_armel.deb
(Reading database ... 25296 files and directories currently installed.)
Preparing to replace udiskie 0.4.2-atrust1-1 (using udiskie_0.4.2-atrust1-1_armel.deb) ...
Unpacking replacement udiskie ...
dpkg: error processing udiskie_0.4.2-atrust1-1_armel.deb (--install):
 unable to securely remove '//..dpkg-tmp': Read-only file system
Errors were encountered while processing:
 udiskie_0.4.2-atrust1-1_armel.deb

and I cat /proc/mounts:
user@atrust-004CC8:/tmp$ cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / squashfs ro,relatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=308564k,nr_inodes=77141,mode=755 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /wfs/aufs tmpfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,relatime 0 0
/aufs /usr aufs rw,relatime,si=55617531 0 0
/aufs /var aufs rw,relatime,si=55617231 0 0
/aufs /etc aufs rw,relatime,si=55617331 0 0
/aufs /home aufs rw,relatime,si=55617031 0 0
/aufs /sbin aufs rw,relatime,si=55617131 0 0
/aufs /bin aufs rw,relatime,si=55617e31 0 0
/aufs /lib aufs rw,relatime,si=55617f31 0 0
/aufs /opt aufs rw,relatime,si=55617c31 0 0
/aufs /root aufs rw,relatime,si=55617d31 0 0
/aufs /boot aufs rw,relatime,si=55617a31 0 0
/aufs /selinux aufs rw,relatime,si=55617b31 0 0
/aufs /srv aufs rw,relatime,si=55617831 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
none /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /var/run tmpfs rw,nosuid,relatime,mode=755 0 0
none /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0
none /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
none /proc/bus/usb usbfs rw,relatime,devgid=1002,devmode=664,busgid=1002,busmode=775,listgid=1002,listmode=664 0 0
ubi1_0 /.profile ubifs rw,relatime 0 0
ubi2_0 /opt/ubi_atb ubifs rw,relatime 0 0
ubi2_0 /lib/modules/2.6.37 ubifs rw,relatime 0 0
ubi1_0 /home/user/.config ubifs rw,relatime 0 0
ubi1_0 /home/user/.icons ubifs rw,relatime 0 0
svn:/ngtc /mnt nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.4,mountvers=3,mountproto=tcp,local_lock=none,addr=192.168.0.4 0 0

It seems have two "/" mounted, one is rw, and another is ro, could it be the cause of my problem? if you have some idea, please let me know, and any advise will be appreciate.

Did you install with Wubi, or is it a true install?

wally (wally-yeh) said : #4

to actionparsnip:
    Sorry, but I don`t understand what you mean, my ubuntu 10.04 file system is a squashfs, and I nand write to a nand flash.

    I use "root=/dev/mtdblock10 ro noswap rootfstype=squashfs mtdbadskip=root-fs" as kernel command line to boot.

    And below is my fstab in my squashfs :
user@atrust-004CC8:~$ cat /etc/fstab
# ACS Modified by auto-generation process
# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
tmpfs /tmp tmpfs defaults 0 0
/dev/mtdblock10 / squashfs ro 0 0
#ubi1_0 /.profile ubifs defaults 0 0
none /proc/bus/usb usbfs auto,listuid=0,listgid=1002,listmode=0664,busuid=0,busgid=1002,busmode=0775,devuid=0,devgid=1002,devmode=0664 0 0

wally (wally-yeh) said : #5

I very appreciate actionparsnip`s help.it inspire me more clues

I found a work arround, plus "--instdir=/tmp" will solve this issue, below is what I do:

user@atrust-004CC8:/tmp$ sudo dpkg -i --instdir=/tmp ./udiskie_0.4.2-atrust1-1_armel.deb
(Reading database ... 25296 files and directories currently installed.)
Preparing to replace udiskie 0.4.2-atrust1-1 (using .../udiskie_0.4.2-atrust1-1_armel.deb) ...
Unpacking replacement udiskie ...
Setting up udiskie (0.4.2-atrust1-1) ...
user@atrust-004CC8:/tmp$

but apt still need to find a way to set instdir like dpkg does.