You are not logged in.
Pages: 1
hi there !
you know those little enclosures to have ssd or nvme storage attached via usb ?
some are great ... some fail ...
long story, short ending ...
most times it's the RTL9210 built in firmware doing AUTOSUSPEND ... wtf ...
so .. keep that thingee alive ... ;-)
my solution:
# SysVinit
# --------
cat << 'EOF' > /etc/init.d/rtl9210-fix
#!/bin/sh
### BEGIN INIT INFO
# Provides: rtl9210-fix
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Prevent autosuspend for Realtek RTL9210 adapters
# Description: Read SMART every 10 seconds to prevent autosuspend
### END INIT INFO
DAEMON=/usr/local/sbin/rtl9210-fix.sh
INTERVAL=10
case "$1" in
start)
echo "Starting RTL9210 Autosuspend Fix ..."
# Background Loop
nohup /bin/bash -c \
"while true; do $DAEMON; sleep $INTERVAL; done" >/dev/null 2>&1 &
# remember PID
echo $! > /var/run/rtl9210-fix.pid
PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
echo "Service rtl9210-fix active, PID: $PID"
;;
stop)
echo "Stopping RTL9210 Autosuspend Fix ..."
PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
if [ -n "$PID" ]; then
echo "Service rtl9210-fix PID: $PID stopping"
kill $PID
rm -f /var/run/rtl9210-fix.pid
fi
;;
status)
echo "Status RTL9210 Autosuspend Fix ..."
PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
if [ -z "$PID" ]; then
echo "Service rtl9210-fix not active, no PID found"
else
echo "Service rtl9210-fix active, PID: $PID "
smartctl --scan 2>/dev/null | grep -i realtek
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
# eof
EOF
chmod +x /etc/init.d/rtl9210-fix# DAEMON
# ------
cat << 'EOF' > /usr/local/sbin/rtl9210-fix.sh
#!/bin/bash
# get all Storage Devices with Realtek Controller
disks=$(sudo smartctl --scan 2>/dev/null | grep -i realtek | sed 's/ .*$//')
if [ -z "$disks" ]; then
exit 0
fi
for disk in $disks; do
# read SMART Data to keep Realtek Device(s) "alive"
smartctl -a $disk >/dev/null 2>&1
done
# eof
EOF
chmod +x /usr/local/sbin/rtl9210-fix.sh# activate Service for all Runlevels
# ----------------------------------
update-rc.d rtl9210-fix defaultsany reactions are welcome ... ;-)
greets
Last edited by vi.joe (2026-10-29 14:06:42)
Offline
Interesting approach / hack around. I did some research out of interest but couldn't find anything that useful. There was some indication that a newer kernel might improve things.
Offline
OP, please update OP to utilize code block. tia.
Be Excellent to each other and Party On!
https://www.youtube.com/watch?v=rph_1DODXDU
https://en.wikipedia.org/wiki/Bill_%26_Ted%27s_Excellent_Adventure
Do unto others as you would have them do instantaneously back to you!
Offline
This kind of service script might be improved with the use of start-stop-daemon which can internally handle PIDfiles. It's used in other standard service scripts.
Offline
thanks for this info, will provide improved code with "start-stop-daemon" in the next days
Offline
this rtl9210 controller bug is in the firmware: autosuspend after some idle time, so not a matter of the kernel.
can be testet with:
watch -n 10 'smartctl -a | grep -i temp'Offline
I have a cheap noname m2 ssd case with this controller chip but in my experience the problem isn't really keeping it awake but rather that it stops and disconnects even during a large file copy, during which it shouldn't be necessary to keep it awake (the active file copy should keep it awake already).
I had planned to try some firmware update (there are many firmware images for these controllers floating around on github and other places) but I haven't gotten around to do it yet as I read that the firmware update requires a windows PC.
If anybody has managed to update the firmware on Linux then please let us know how you did it.
Last edited by tux_99 (2026-10-29 16:04:42)
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
i also had disconnects while data transfer. by default, uas driver is used. my solution: force using usb-storage driver for rtl9210:
lsusb | grep -i 9210
# ...
# Bus 004 Device 005: ID 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2 NVME Adapter
# ...
cat << EOF > /etc/modprobe.d/uas.conf
options usb-storage quirks=0bda:9210:u
EOF
cat /etc/modprobe.d/uas.conf
update-initramfs -cuk all
update-grub
rebootabout firmware update ...
1.) you need the correct firmware for the specific enclosure brand or you have risc of bricking it.
2.) if you have multiple differenct brands you have to play the game like in 1.) again
i have several diffent brands with rtl9210 and they now run fine with the "uas.conf" and the "rtl9210-fix"
greets
Last edited by vi.joe (Yesterday 12:40:16)
Offline
... and here is rtl9210-fix ... v2 ... with start-stop-daemon ... ;-)
# SysVinit
# --------
cat << 'EOF' > /etc/init.d/rtl9210-fix
#!/bin/sh
### BEGIN INIT INFO
# Provides: rtl9210-fix
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Prevent autosuspend for Realtek RTL9210 adapters
# Description: Read SMART every 10 seconds to prevent autosuspend
### END INIT INFO
DAEMON=/usr/local/sbin/rtl9210-fix.sh
PIDFILE=/var/run/rtl9210-fix.pid
NAME=rtl9210-fix
case "$1" in
start)
echo "Start RTL9210 Autosuspend Fix"
start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile "$PIDFILE" \
--startas "$DAEMON"
PID=$(cat "$PIDFILE" 2>/dev/null)
echo "Service $NAME active, PID: $PID"
;;
stop)
echo "Stop RTL9210 Autosuspend Fix"
PID=$(cat "$PIDFILE" 2>/dev/null)
if [ -n "$PID" ]; then
echo "Service $NAME PID: $PID stopping"
start-stop-daemon --stop --quiet \
--pidfile "$PIDFILE" 2>/dev/null
rm -f "$PIDFILE"
fi
;;
restart)
$0 stop
echo "Stop RTL9210 Autosuspend Fix"
$0 start
echo "Start RTL9210 Autosuspend Fix"
;;
status)
echo "Status RTL9210 Autosuspend Fix"
PID=$(cat "$PIDFILE" 2>/dev/null)
if [ -z "$PID" ]; then
echo "Service $NAME not active, no PID found"
else
echo "Service $NAME active, PID: $PID "
smartctl --scan 2>/dev/null | grep -i realtek
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
# eof
EOF
md5sum /etc/init.d/rtl9210-fix
# ...
# d859e88c31317f600e49ce4c4c609523 /etc/init.d/rtl9210-fix
# ...
chmod +x /etc/init.d/rtl9210-fix
# DAEMON
# ------
cat << 'EOF' > /usr/local/sbin/rtl9210-fix.sh
#!/bin/bash
INTERVAL=10
while true; do
# get all Storage Devices with Realtek Controller
disks=$(sudo smartctl --scan 2>/dev/null | grep -i realtek | sed 's/ .*$//')
if [ -n "$disks" ]; then
for disk in $disks; do
# read SMART Data to keep Realtek Device(s) "alive"
smartctl -a $disk >/dev/null 2>&1
done
fi
sleep "$INTERVAL"
done
# eof
EOF
md5sum /usr/local/sbin/rtl9210-fix.sh
# ...
# ac177d0919c625789a80ec64e9d8dfb9 /usr/local/sbin/rtl9210-fix.sh
# ...
chmod +x /usr/local/sbin/rtl9210-fix.sh
# activate Service for all Runlevels
# ----------------------------------
update-rc.d rtl9210-fix defaultsLast edited by vi.joe (Yesterday 12:32:11)
Offline
i also had disconnects while data transfer. by default, uas driver is used. my solution: force using usb-storage driver for rtl9210
Thanks, that solved it for me too, all I did was create the /etc/modprobe.d/uas.conf file with the quirks as per your instructions, no need to reboot or re-do initramfs as I don't use the drive during boot.
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
Pages: 1