ecdye / zram-config

A complete zram-config utility for swap, directories, and logs to reduce SD, NAND and eMMC block wear.
MIT License
460 stars 53 forks source link

Not all /dev/zramN devices go away when doing Stop #24

Closed GenTarkin closed 4 years ago

GenTarkin commented 5 years ago

For some reason everytime I run: "systemctl stop zram-config -> systemctl start zram-config" On the first time doing this sometime after the system boots up ... Ill notice a /dev/zram just left around and getting written to but not mounted, when I run "zramctl" I look in logs and when I stop it, it shows the appropriate zram devices removed. I can even run zramctl when zram-config is stopped and it wont show any zram devices ... but for some reason on that next start, it will just show a rogue zram device ... and still gettin written to ... it will also show the correct devices after that start. It should be noticed any attempt to do "stop" -> "start" after that first one works fine and no more rogue devices are added ... but that original first one always comes back...after the start.

mstormi commented 5 years ago

Just noticed the same. In my case, it is the first 'dir' line (after swap) in /etc/ztab. zramctl -r /dev/zram1 fails with a 'in use' error, but using 'fuser' I don't find any processes to run off those dirs.

Not sure if the line on xattr is related.

[12:39:27] root@openhabianpi:/# The program cannot write trusted.* xattr. Try run again as root.
+ return 1
ztab remove swap /zram0 zram-config0
/dev/zram0 removed
'/usr/local/share/zram-config/zram-device-list.rev' wurde entfernt
'/usr/local/share/zram-config/zram-device-list' wurde entfernt
zram-config stop 2019-09-08-12:37:12
'/usr/local/share/zram-config/zram-device-list.rev' wurde entfernt
zram-config stop 2019-09-08-12:38:54
'/usr/local/share/zram-config/zram-device-list.rev' wurde entfernt

[12:53:37] root@openhabianpi:/var/lib/openhab2# zramctl
NAME       ALGORITHM DISKSIZE   DATA  COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram2 lzo           300M  28,8M   2,8M  3,3M       4
/dev/zram1 lz4           500M 336,8M 299,1M  300M       4 /opt/zram/zram1
[12:53:42] root@openhabianpi:/var/lib/openhab2# zramctl -r /dev/zram1
zramctl: /dev/zram1: failed to reset: Das Gerät oder die Ressource ist belegt
[12:53:55] root@openhabianpi:/var/lib/openhab2# zramctl -r /dev/zram2
zramctl: /dev/zram2: failed to reset: Das Gerät oder die Ressource ist belegt
[12:53:56] root@openhabianpi:/var/lib/openhab2#
[12:39:33] root@openhabianpi:/# /usr/local/bin/zram-config stop
+ ZSHARE=/usr/local/share/zram-config
+ ZLOG=/usr/local/share/zram-config/log/zram-config.log
+ ZDIR=/opt/zram
+ grep -q init=/bin/ro-root.sh /boot/cmdline.txt
+ ZEPHEMERAL=false
+ case "$1" in
++ date +%Y-%m-%d-%H:%M:%S
+ echo 'zram-config stop 2019-09-08-12:39:41'
zram-config stop 2019-09-08-12:39:41
+ tac /usr/local/share/zram-config/zram-device-list
tac: '/usr/local/share/zram-config/zram-device-list' konnte nicht zum Lesen geöffnet werden: Datei oder Verzeichnis nicht gefunden
+ file=/usr/local/share/zram-config/zram-device-list.rev
+ read -r line
+ rm -fv /usr/local/share/zram-config/zram-device-list.rev /usr/local/share/zram-config/zram-device-list
'/usr/local/share/zram-config/zram-device-list.rev' wurde entfernt
[12:39:41] root@openhabianpi:/# df -k /opt/zram/zram1
Dateisystem    1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
/dev/zram1        479560  328888    114832   75% /opt/zram/zram1
[12:39:44] root@openhabianpi:/#