Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

OverlayFS & /usr

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
oneiro
Posts: 2
Joined: 2024-01-21 17:24

OverlayFS & /usr

#1 Post by oneiro »

Hello.

I have problem to set/usr as overlayFS using fstab config file.
Error say about try mount /usr into /root/usr but in fstab I do not have such patch.
How to fix the issue?

My fstab file is:

Code: Select all

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/mmcblk0p2 during installation
UUID=8ff7288e-80d8-41a4-a218-bc10c3ad7e73 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/mmcblk0p1 during installation
UUID=AC69-A29E  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/mmcblk0p3 during installation
#UUID=8c547504-27bb-447a-a52d-6c13ebdf6272 none            swap    sw              0       0
UUID=cd3c4889-2593-425f-892f-4ee67efba905       /vm     ext4    defaults        0       1
UUID=588ff93a-8c1b-417c-ae33-371db0ff7f77       /overlay        ext4    defaults        0       1
overlay /root   overlay x-systemd.requires=/overlay,lowerdir=/root,upperdir=/overlay/upper/root,workdir=/overlay/work 0 0
overlay /var    overlay x-systemd.requires=/overlay,lowerdir=/var,upperdir=/overlay/upper/var,workdir=/overlay/work2    0       0
#overlay /usr   overlay x-systemd.requires=/overlay,lowerdir=/usr,upperdir=/overlay/upper/usr,workdir=/overlay/work3    0       0
UUID=87a0ce74-6f2f-409e-ab52-883054d907a2       /backup         ext4    defaults        0       1
As you see overlay for /usr is commented and system working fine with above fstab file but after uncomment the line I got below error and jump into initramfs cmd. The error is:

Code: Select all

Begin: Mounting root file system ... Begin: Running /scripts/local-top .... done
Begin: Running /scripts/local-premount ... [ timestamp]  Btrfs loaded, crc32c-intel, zoned=yes, fseverity
Scanning for Btrfs filesystems
done.
Begin: Will now check root file system ... fsck from util-linux 2.23.1
[/sbin/fsck.ext4 (1) -- /dev/mmcblk0p2] fsck.ext4 -a -C0 /dev/mmcblk0p2
/dev/mmcblk0p2: recovering journal
/dev/mmcblk0p2: clean, 270739/866656 files, 2264529/3465472 blocks
done.
[   timestap EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: none.
done.
Begin: Mounting /usr file system ... mount: mounting overlay on /root/usr failed: No such device.
Failed to mount overlay as /usr file system
BTW, found similar issue from 2016 not resolved:

https://www.linuxquestions.org/question ... 175572525/

oneiro
Posts: 2
Joined: 2024-01-21 17:24

Re: OverlayFS & /usr

#2 Post by oneiro »

Trying to resolver my issue decide use systemd but due to wrong order mounting points cannot jump it.

In my cause to working overlayFS under /usr first is need to have mount /overlay dir. Tested and below working fine, overlayFS is creating under /usr

Code: Select all

mount -t overlay overlay -o,lowerdir=/usr,upperdir=/overlay/upper/usr/,workdir=/overlay/workdir/usr/ /usr
Therefore move two entries from /etc/fstab regarding /overlay dir and /usr overlayFS into systemd units however get error:

Code: Select all

mar 06 01:16:34 debian kernel: overlayfs: failed to resolve '/overlay/upper/usr': -2


Reason is above error appear before /overlay directory is mounted.

My unit files are:

/etc/systemd/system/overlay.mount

Code: Select all

[Unit]
Description=Mount /overlay ext4
Before=local-fs.target
Wants=local-fs.target

[Mount]
What=/dev/disk/by-uuid/d09bf587-a6c9-4116-bdb9-df7a33117f9a
Where=/overlay
Type=ext4
Options=errors=remount-ro
#TimeoutSec=seconds

[Install]
WantedBy=local-fs-pre.target
and

/etc/systemd/system/usr.mount

Code: Select all

[Unit]
Description=Mount OverlaFS /usr
Wants=local-fs.target
After=overaly.mount

[Mount]
What=overlay
Where=/usr
Type=overlay
Options=x-systemd.requires=/overlay,lowerdir=/usr,upperdir=/overlay/upper/usr,workdir=/overlay/workdir/usr
#TimeoutSec=seconds

[Install]
WantedBy=local-fs-pre.target
Can someone help me fix systemd unit files and set properly order of mounting, 1st /overlay and next /usr overlayFS?

Post Reply