Page MenuHomeVyOS Platform

Improve rootfs directory variable
Closed, ResolvedPublicFEATURE REQUEST

Description

First commit to enable an environmental variable that points to current rootfs directory can be improved to avoid risk of selecting the wrong partition/path when user have added additional partitions to be used with for example containers.

Suggestion to use the same method as "image_name" in /src/init/vyos-router which also is less likely to select wrong path because the source will now be cmdline.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Improvement (missing useful functionality)

Event Timeline

Viacheslav changed the task status from Open to Needs testing.Aug 14 2023, 11:24 AM

Looks like its working as expected in VyOS 1.4-rolling-202308140557:

vyos@vyos:~$ export | grep -i rootfs
declare -rx vyos_rootfs_dir="/usr/lib/live/mount/rootfs/1.4-rolling-202308140557.squashfs"
vyos@vyos:~$ cd ${vyos_rootfs_dir}
vyos@vyos:/usr/lib/live/mount/rootfs/1.4-rolling-202308140557.squashfs$ ls -la
total 4
drwxr-xr-x  17 root root  308 Aug 14 07:57 .
drwxr-xr-x   3 root root 4096 Aug 14 22:20 ..
lrwxrwxrwx   1 root root    7 Aug 14 07:57 bin -> usr/bin
drwxr-xr-x   3 root root  197 Aug 14 07:57 boot
drwxr-xr-x   4 root root  191 Aug 14 07:57 dev
drwxr-xr-x 134 root root 4352 Aug 14 07:57 etc
drwxr-xr-x  18 root root  261 Aug 14 07:57 home
lrwxrwxrwx   1 root root    7 Aug 14 07:57 lib -> usr/lib
lrwxrwxrwx   1 root root    9 Aug 14 07:57 lib32 -> usr/lib32
lrwxrwxrwx   1 root root    9 Aug 14 07:57 lib64 -> usr/lib64
lrwxrwxrwx   1 root root   10 Aug 14 07:57 libx32 -> usr/libx32
drwxr-xr-x   2 root root    3 Aug 14 07:57 media
drwxr-xr-x   2 root root    3 Aug 14 07:57 mnt
drwxr-xr-x   3 root root   29 Aug 14 07:57 opt
drwxr-xr-x   2 root root    3 Jul 14 18:00 proc
drwx------   4 root root   72 Aug 14 07:57 root
drwxr-xr-x  28 root root  436 Aug 14 07:57 run
lrwxrwxrwx   1 root root    8 Aug 14 07:57 sbin -> usr/sbin
drwxr-xr-x   4 root root   42 Aug 14 07:57 srv
drwxr-xr-x   2 root root    3 Jul 14 18:00 sys
drwxrwxrwt   2 root root    3 Aug 14 07:57 tmp
drwxr-xr-x  14 root root  217 Aug 14 07:57 usr
drwxr-xr-x  13 root root  183 Aug 14 07:57 var
vyos@vyos:/usr/lib/live/mount/rootfs/1.4-rolling-202308140557.squashfs$ cat /etc/default/vyatta | grep -i rootfs
    if test -z "$vyos_rootfs_dir" ; then
        declare -x -r vyos_rootfs_dir="/usr/lib/live/mount/rootfs/${IMAGE_NAME}.squashfs"
vyos@vyos:/usr/lib/live/mount/rootfs/1.4-rolling-202308140557.squashfs$