[FS#579] Rename failure when file both in rom and overlay in mvebu / wrt3200acm, due to kernel 4.9 or ubi?

LEDE Bugs lede-bugs at lists.infradead.org
Wed Mar 1 07:12:05 PST 2017


A new Flyspray task has been opened.  Details are below. 

User who did this - Hannu Nyman (hnyman) 

Attached to Project - LEDE Project
Summary - Rename failure when file both in rom and overlay in mvebu / wrt3200acm, due to kernel 4.9 or ubi? 
Task Type - Bug Report
Category - Base system
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - Critical
Priority - Very Low
Reported Version - Trunk
Due in Version - Undecided
Due Date - Undecided
Details - LEDE master r3623 mvebu WRT3200ACM

Router fails to rename files that are both in /rom and in /overlay, i.e. they were part of the original flash and have been modified later or were included in sysupgrade.

Rename fails.
Deleting the same file succeeds.
Copying is also ok.

(Deleting the file and copying a new one into its place does not enable rename, which still fails.)

I noticed this in mvebu / WRT3200ACM, but the bug may also concern all mvebu devices, all kernel 4.9 users and/or all ubi filesystem users.

I did originally build my settings with 17.01 with 4.4 and/or master with k4.4 and noticed no problems at that stage, so this may have surfaced at the bump to 4.9, or at the last bump to 4.9.13. (But I have only used mvebu for a few days, and haven't yet verified the 4.9.10 or lede-17.01 behaviour)

I originally noticed this when debugging the new opkg, but then realised that this is a wider file-system level problem. I verified the problem by flashing a pure buildbot snapshot image without any additional settings.

Rename fails
    * in console
    
    root at LEDE:~# mv /etc/dropbear/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key-x
    mv: can't rename '/etc/dropbear/dropbear_rsa_host_key': Invalid argument
    
    * in script:
    
    root at LEDE:/etc/config# /etc/init.d/luci_statistics restart
    mv: can't rename '/etc/collectd.conf': Invalid argument
    
    * "rename" function call in a C program (strace from opkg):
    
    rename("/etc/config/bcp38", "/etc/config/bcp38-opkg") = -1 EINVAL (Invalid argument)
    

No such problem in ar71xx device with the same r3623 build but with kernel 4.4 (and without NAND & ubi).


Steps to reproduce:

  - Try to rename a file that is both in firmware and in overlay. E.g. a config file related to a package included in the build

I used /etc/dropbear/dropbear_rsa_host_key in the next example, as that is a file included in the clean snapshot firmware.


Reboot (SNAPSHOT, r3623-339de82)

root at LEDE:~# mv /etc/dropbear/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key-x
mv: can't rename '/etc/dropbear/dropbear_rsa_host_key': Invalid argument

root at LEDE:~# ls -l /rom/etc/dropbear/dropbear_rsa_host_key
-rw-r--r--    1 root     root             0 Mar  1 06:10 /rom/etc/dropbear/dropbear_rsa_host_key

root at LEDE:~# ls -l /overlay/upper/etc/dropbear/dropbear_rsa_host_key
-rw-------    1 root     root           805 Mar  1 06:10 /overlay/upper/etc/dropbear/dropbear_rsa_host_key

root at LEDE:~# rm  /etc/dropbear/dropbear_rsa_host_key
root at LEDE:~# ls -l /overlay/upper/etc/dropbear/dropbear_rsa_host_key
c---------    1 root     root        0,   0 Mar  1 14:34 /overlay/upper/etc/dropbear/dropbear_rsa_host_key

root at LEDE:~# cp /etc/dropbear/dropbear_rsa_host_key-x /etc/dropbear/dropbear_rsa_host_key
root at LEDE:~# mv /etc/dropbear/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key-x
mv: can't rename '/etc/dropbear/dropbear_rsa_host_key': Invalid argument


Rename also fails for newly created files in /overlay. E.g. a file does not yet exist in /overlay, but is created there due to editing:

root at LEDE:/etc# ls /overlay/upper/etc/
board.json                dropbear                  firewall.user             switch_boot_partition.sh  urandom.seed
config                    ethers                    fw_env.config             uci-defaults
root at LEDE:/etc# nano /etc/opkg.conf
root at LEDE:/etc# mv /etc/opkg.conf /etc/opkg.conf2
mv: can't rename '/etc/opkg.conf': Invalid argument



More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=579



More information about the lede-bugs mailing list