TransWikia.com

systemd: Failed to disable unit: Read-only file system

Unix & Linux Asked by Alex Ryan on November 13, 2020

I have an embedded system with an operating system built by yocto (Automotive Grade Linux: Halibut 8.0) that has 2 competing dhcp clients: connman and systemd-networkd.

sa8155:~# systemctl --type=service

  connman.service                                        loaded active running Connection service
  systemd-networkd.service                               loaded active running Network Service

I want to disable connman, but I get this strange error when I try:

sa8155:~# systemctl disable connman.service
Failed to disable unit: File /etc/systemd/system/multi-user.target.wants/connman.service: Read-only file system

I am root. So I’m not sure why it will not allow me to delete this file.

sa8155:~# ls -l /etc/systemd/system/multi-user.target.wants/connman.service
lrwxrwxrwx 1 root root 35 Nov 27  2019 /etc/systemd/system/multi-user.target.wants/connman.service -> /lib/systemd/system/connman.service
sa8155:~# 

Does anyone know why?
What would be the correct way to disable this service?

There seems to be an unusual number of file systems:

sa8155:~# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/root     ext4    1.4G  504M  812M  39% /
devtmpfs  devtmpfs    291M     0  291M   0% /dev
tmpfs        tmpfs    443M     0  443M   0% /dev/shm
tmpfs        tmpfs    443M   18M  425M   4% /run
tmpfs        tmpfs    443M     0  443M   0% /sys/fs/cgroup
tmpfs        tmpfs    443M   18M  425M   4% /etc/machine-id
/dev/sde4     vfat    180M   53M  128M  30% /firmware
/dev/sde5     vfat     64M  512K   64M   1% /bluetooth
/dev/sde9     ext4     59M   21M   38M  36% /dsp
/dev/sda2     ext4    122M   12M  108M  10% /var
/dev/sda2     ext4    122M   12M  108M  10% /etc/bluetooth
/dev/sda2     ext4    122M   12M  108M  10% /persist
/dev/sda2     ext4    122M   12M  108M  10% /etc/build.prop
/dev/sda2     ext4    122M   12M  108M  10% /etc/usb
/dev/sda2     ext4    122M   12M  108M  10% /etc/misc/wifi
/dev/sda2     ext4    122M   12M  108M  10% /etc/smack/accesses.d
/dev/sda2     ext4    122M   12M  108M  10% /etc/adb_devid
tmpfs        tmpfs    443M  416K  442M   1% /var/volatile
tmpfs        tmpfs    443M  416K  442M   1% /persist/volatile
/dev/sda8     ext4    108G  6.4G  101G   6% /data
/dev/sda8     ext4    108G  6.4G  101G   6% /home
tmpfs        tmpfs    755M  4.0K  755M   1% /run/user/0
/dev/sda8     ext4    108G  6.4G  101G   6% /home/root/adas/dev
/dev/sda8     ext4    108G  6.4G  101G   6% /data/root/adas/dev
sa8155:~# 

One Answer

Sometimes on embedded systems the / filesystem is mounted readonly, usually because it's on a storage type that degrades with many writes, and longevity is a priority.

A temporary solution to this particular issue is to remount the filesystem as rw, make the necessary change, and then remount again to `ro. This will likely only be temporary because the change probably hasn't been made to the persistent storage.

Sometimes, the image will come with a way to make the changes persistent, e.g., by writing to a configuration file in the persistent storage that gets read during boot (in your case, the first place I would look would be in /persist, but also in the documentation of the image, if there is some).

If this is truly an incompatible set of services, the proper solution is probably to fix the underlying image by only enabling the services that are needed, and then reflashing your device.

Correct answer by einfeyn496 on November 13, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP