Issues with transmission after upgrading

yesterday I installed the latest mamba sysupgrade package from davidc's site (https://dc502wrt.org/)

|Firmware Version|OpenWrt SNAPSHOT r12121-2dc0a8c180 / LuCI Master git-20.025.58966-6f6f3e8 
|Kernel Version|4.19.98|

as usual i reinstalled my packages (transmission being one of them)

However transmissions is having problems starting. there is a vague error in sys log but it doesnt help me to fix it. any ideas where to go next for troubleshooting this?

Wed Feb  5 08:16:39 2020 user.notice transmission: Starting with 125516000 virt mem
Wed Feb  5 08:16:40 2020 daemon.err procd: unable to find /sbin/ujail: No such file or directory (-1)
Wed Feb  5 08:17:05 2020 daemon.info procd: Instance transmission::instance1 s in a crash loop 6 crashes, 0 seconds since last crash
config transmission
	option enabled 1
	option config_dir '/mnt/usb1/torrent/transmission/'
	option config_overwrite '1'
	option user 'transmission'
	option group 'transmission'
	option mem_percentage 50
	option nice 10
	option web_home ''
	option alt_speed_down 50
	option alt_speed_enabled false
	option alt_speed_time_begin  540
	option alt_speed_time_day 127
	option alt_speed_time_enabled false
	option alt_speed_time_end 1020
	option alt_speed_up 50
	option bind_address_ipv4 '0.0.0.0'
	option bind_address_ipv6 '::'
	option blocklist_enabled false
	option blocklist_url ''
	option cache_size_mb 2
	option dht_enabled true
	option download_dir '/mnt/usb1/shareroot/medialib/video/Arrivals/'
	option download_queue_enabled true
	option download_queue_size 5
	option encryption 1
	option idle_seeding_limit 30
	option idle_seeding_limit_enabled false
	option incomplete_dir '/mnt/usb1/torrent/transmission/incomplete/'
	option incomplete_dir_enabled true
	option lazy_bitfield_enabled true
	option lpd_enabled false
	option message_level 1
	option peer_congestion_algorithm ''
	option peer_limit_global 240
	option peer_limit_per_torrent 60
	option peer_port 51413
	option peer_port_random_high 65535
	option peer_port_random_low 49152
	option peer_port_random_on_start false
	option peer_socket_tos 'default'
	option pex_enabled true
	option port_forwarding_enabled true
	option preallocation 1
	option prefetch_enabled true
	option queue_stalled_enabled true
	option queue_stalled_minutes 30
	option ratio_limit 2.0000
	option ratio_limit_enabled false
	option rename_partial_files true
	option rpc_authentication_required false
	option rpc_bind_address '0.0.0.0'
	option rpc_enabled true
	option rpc_host_whitelist '127.0.0.1,192.168.1.*'
	option rpc_host_whitelist_enabled false
	option rpc_password ''
	option rpc_port 9091
	option rpc_url '/transmission/'
	option rpc_username ''
	option rpc_whitelist '127.0.0.1,192.168.1.*'
	option rpc_whitelist_enabled false
	option scrape_paused_torrents_enabled true
	option script_torrent_done_enabled false
	option script_torrent_done_filename ''
	option seed_queue_enabled false
	option seed_queue_size 10
	option speed_limit_down 100
	option speed_limit_down_enabled false
	option speed_limit_up 20
	option speed_limit_up_enabled false
	option start_added_torrents true
	option trash_original_torrent_files false
	option umask 0
	option upload_slots_per_torrent 14
	option utp_enabled true
	option scrape_paused_torrents true
	option watch_dir_enabled false
	option watch_dir ''

I found this post [Solved] Transmission 2.93 (3c5870d4f5) Problems
which showed me how to use the cli, ie transmission-daemon & transmission-daemon -e /mnt/usb1/torrent/transmission/log

i had it log to a file and this is that log
seems like maybe 2 instances are running?

[2020-02-06 08:31:50.022] Transmission 2.94 (d8e60ee44f) started (session.c:740)
[2020-02-06 08:31:50.023] RPC Server Adding address to whitelist: 127.0.0.1 (rpc-server.c:971)
[2020-02-06 08:31:50.023] RPC Server Serving RPC and Web requests on port 127.0.0.1:9091/transmission/ (rpc-server.c:1213)
[2020-02-06 08:31:50.023] RPC Server Whitelist enabled (rpc-server.c:1217)
[2020-02-06 08:31:50.024] Couldn't bind port 51413 on 0.0.0.0: Address in use (Is another copy of Transmission already running?) (net.c:379)
[2020-02-06 08:31:50.024] Couldn't bind port 51413 on ::: Address in use (Is another copy of Transmission already running?) (net.c:379)
[2020-02-06 08:31:50.024] UDP Couldn't bind IPv4 socket (tr-udp.c:271)
[2020-02-06 08:31:50.025] DHT Generating new id (tr-dht.c:311)
[2020-02-06 08:31:50.025] Using settings from "/root/.config/transmission-daemon" (daemon.c:528)
[2020-02-06 08:31:50.025] Saved "/root/.config/transmission-daemon/settings.json" (variant.c:1266)
[2020-02-06 08:31:50.025] Port Forwarding (NAT-PMP) initnatpmp succeeded (0) (natpmp.c:70)
[2020-02-06 08:31:50.026] Port Forwarding (NAT-PMP) sendpublicaddressrequest succeeded (2) (natpmp.c:70)

if i manually start the service and point it to my config directory it works!

transmission-daemon -e /mnt/usb1/torrent/transmission/log -g /mnt/usb1/torrent/transmission/

however rebooting, or using the restart button in luci>startup doesnt work

Im not sure how the startup page works (what it reads from). is it init.d directory?

in any case the files i have that i think would come into play is
/etc/config/transmission config file that is the same as posted above, as you can see it reference the config directory (see 3rd line)
there is also a file at /etc/init.d/transmission file:

#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org

START=99
USE_PROCD=1
PROG="/usr/bin/transmission-daemon"

LIST_SEP="
"

append_params() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && echo "\"$p\": $v," | sed -e 's|_|-|g'
		done
	done
	unset IFS
}

append_params_quotes() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && {
				printf "\"%s" "$p" | sed -e 's|/|\\/|g;s|_|-|g'; \
				echo "\": \"$v\","
			}
		done
	done
	unset IFS
}

transmission() {
	local cfg="$1"

	local enabled
	config_get_bool enabled "$cfg" enabled 0
	[ "$enabled" -gt 0 ] || return 1

	local config_dir
	config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission'
	local user
	config_get user "$cfg" 'user'
	local group
	config_get group "$cfg" 'group'
	local download_dir
	config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission'
	local incomplete_dir
	config_get incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission'
	local incomplete_dir_enabled
	config_get incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0
	local mem_percentage
	config_get mem_percentage "$cfg" 'mem_percentage' '50'
	local config_overwrite
	config_get config_overwrite "$cfg" config_overwrite 1
	local nice
	config_get nice "$cfg" nice 0
	local web_home
	config_get web_home "$cfg" 'web_home'

	local MEM
	MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
	local USE
	[ "$MEM" -gt 1 ] && USE=$((MEM * mem_percentage * 10))

	config_file="$config_dir/settings.json"
	[ -d "$config_dir" ] || {
		mkdir -p "$config_dir"
		chmod 0755 "$config_dir"
		touch "$config_file"
		mkdir -p "$config_dir/resume"
		mkdir -p "$config_dir/torrents"
		mkdir -p "$config_dir/blocklists"
		[ -e "$config_dir/stats.json" ] || touch "$config_dir/stats.json"
		[ -z "$user" ] || chown -R "$user:$group" "$config_dir"
	}

	[ -d "$download_dir" ] || {
		mkdir -p "$download_dir"
		chmod 0755 "$download_dir"
		[ -z "$user" ] || chown -R "$user:$group" "$download_dir"
	}

	[ "$incomplete_dir_enabled" = "0" ] || [ -d "$incomplete_dir" ] || {
		mkdir -p "$incomplete_dir"
		chmod 0755 "$incomplete_dir"
		[ -z "$user" ] || chown -R "$user:$group" "$incomplete_dir"
	}

	[ "$config_overwrite" = 0 ] || {

		echo "{"

		append_params "$cfg" \
			alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
			alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
			cache_size_mb download_queue_enabled download_queue_size \
			dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
			incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
			peer_id_ttl_hours peer_limit_global peer_limit_per_torrent peer_port \
			peer_port_random_high peer_port_random_low peer_port_random_on_start \
			pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
			ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
			rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \
			queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \
			seed_queue_enabled seed_queue_size \
			speed_limit_down speed_limit_down_enabled speed_limit_up \
			speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
			umask upload_slots_per_torrent utp_enabled \
			watch_dir_enabled rpc_host_whitelist_enabled

		append_params_quotes "$cfg" \
			blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
			peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
			rpc_username rpc_host_whitelist rpc_whitelist script_torrent_done_filename watch_dir

			echo "\"invalid-key\": false"
			echo "}"

	} > "$config_file"

	procd_open_instance
	procd_set_param command "$PROG"
	procd_append_param command -f -g "$config_dir"
	procd_set_param user "$user"
	procd_set_param group "$group"
	procd_set_param nice "$nice"
	procd_set_param stderr 1
	procd_set_param respawn
	procd_set_param seccomp "/etc/seccomp/transmission-daemon.json"

	if [ -z "$USE" ]; then
		procd_set_param limits core="0 0"
	else
		procd_set_param limits core="0 0" as="$USE $USE"
		logger -t transmission "Starting with $USE virt mem"
	fi

	[ -d "$web_home" ] && procd_set_param env TRANSMISSION_WEB_HOME="$web_home"

	procd_add_jail transmission log
	procd_add_jail_mount "$config_file"
	procd_add_jail_mount_rw "$config_dir/resume"
	procd_add_jail_mount_rw "$config_dir/torrents"
	procd_add_jail_mount_rw "$config_dir/blocklists"
	procd_add_jail_mount_rw "$config_dir/stats.json"
	procd_add_jail_mount_rw "$download_dir"
	procd_close_instance
}

start_service() {
	config_load 'transmission'
	config_foreach transmission 'transmission'
}

reload_service() {
	procd_send_signal "$PROG"
}

service_triggers() {
	procd_add_reload_trigger "transmission"
}

i see its overriding the config file path but at the same time ive never had to edit this file before. Plus i did try putting my config directory in there and it didnt help (still failed to startup).

It helps to ping the maintainer (me) when reporting issues. Or do so here: https://github.com/openwrt/packages/issues

In any case, this is a problem with this guy's firmware. The error is clear:

Wed Feb  5 08:16:40 2020 daemon.err procd: unable to find /sbin/ujail: No such file or directory (-1)

this is provided by the package procd-ujail, which is installable by opkg.

thank you unfortunetly procd-ujail isnt available in davidc repos as far as i can tell


root@Skittles:~# opkg update
Downloading https://dc502wrt.org/snapshots/r12121/targets/mvebu/cortexa9/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://dc502wrt.org/snapshots/r12121/targets/mvebu/cortexa9/packages/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/base/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/darkmatter/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_darkmatter
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/darkmatter/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/luci/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/opentomato/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_opentomato
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/opentomato/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/packages/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/routing/Packages.sig
Signature check passed.
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://dc502wrt.org/snapshots/r12121/packages/arm_cortex-a9_vfpv3/telephony/Packages.sig
Signature check passed.
root@Skittles:~# opkg install procd-ujail
Unknown package 'procd-ujail'.
Collected errors:

but also im not sure this fits the symptoms!
like i said when i
transmission-daemon -e /mnt/usb1/torrent/transmission/log -g /mnt/usb1/torrent/transmission/
(manually forcing the config directory) it works!

Yeah it does since with the init script it's trying to use ujail which is not available. It's an issue with this fork.

edit: if you're willing to play with the init script, remove the jail stuff near the end. The seccomp stuff too.

no luck but i feel like im close. any more suggestions? FYI i installed seccomp so i left that in there for now, but i have tried it without that as well

I also added the -e on line 77 but idk if that is suppose to be like that, my log file is empty
so either it doesnt log anything or its not working

i dont see the jail error any more though!

Fri Feb  7 13:58:50 2020 user.notice transmission: Starting with 0 virt mem
Fri Feb  7 13:58:50 2020 daemon.info procd: Instance transmission::instance1 s in a crash loop 12 crashes, 0 seconds since last crash
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org

START=99
USE_PROCD=1
PROG="/usr/bin/transmission-daemon"

LIST_SEP="
"

append_params() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && echo "\"$p\": $v," | sed -e 's|_|-|g'
		done
	done
	unset IFS
}

append_params_quotes() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && {
				printf "\"%s" "$p" | sed -e 's|/|\\/|g;s|_|-|g'; \
				echo "\": \"$v\","
			}
		done
	done
	unset IFS
}

transmission() {
	local cfg="$1"

	local enabled
	config_get_bool enabled "$cfg" enabled 0
	[ "$enabled" -gt 0 ] || return 1

	local config_dir
	config_get config_dir "$cfg" 'config_dir' '/mnt/usb1/torrent/transmission'

	local MEM
	MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
	local USE
	[ "$MEM" -gt 1 ] && USE=$((MEM * mem_percentage * 10))

	config_file="$config_dir/settings.json"
	[ -d "$config_dir" ] || {
		mkdir -p "$config_dir"
		chmod 0755 "$config_dir"
		touch "$config_file" 
		[ -e "$config_dir/stats.json" ] || touch "$config_dir/stats.json"
		[ -z "$user" ] || chown -R "$user:$group" "$config_dir"
	}
 
	[ "$config_overwrite" = 0 ] || {

		echo "{"

		append_params "$cfg"  

		append_params_quotes "$cfg"  

			echo "\"invalid-key\": false"
			echo "}"

	} > "$config_file"

	procd_open_instance
	procd_set_param command "$PROG"
	procd_append_param command -f -g "$config_dir" -e /mnt/usb1/torrent/transmission/log
	procd_set_param stderr 1
	procd_set_param respawn
	procd_set_param seccomp "/etc/seccomp/transmission-daemon.json"

	if [ -z "$USE" ]; then
		procd_set_param limits core="0 0"
	else
		procd_set_param limits core="0 0" as="$USE $USE"
		logger -t transmission "Starting with $USE virt mem"
	fi

	[ -d "$web_home" ] && procd_set_param env TRANSMISSION_WEB_HOME="$web_home"

 
	procd_close_instance
}

start_service() {
	config_load 'transmission'
	config_foreach transmission 'transmission'
}

reload_service() {
	procd_send_signal "$PROG"
}

service_triggers() {
	procd_add_reload_trigger "transmission"
}

Remove the USE if condition after the seccomp line. The log is saying transmission is starting with 0 virtual memory. I have no idea how that's happening.

edit: BTW it seems to be crashing because of an unandled malloc error. I've seen this before with 32MB devices where the memory percentage has to be increased.

thank you it seems to be working now; the only thing is i see 2 instances listed in processes?

FYI i had to remove some more stuff due to overwriting my config file every time on startup.


#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org

START=99
USE_PROCD=1
PROG="/usr/bin/transmission-daemon"

LIST_SEP="
"

append_params() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && echo "\"$p\": $v," | sed -e 's|_|-|g'
		done
	done
	unset IFS
}

append_params_quotes() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && {
				printf "\"%s" "$p" | sed -e 's|/|\\/|g;s|_|-|g'; \
				echo "\": \"$v\","
			}
		done
	done
	unset IFS
}

transmission() {
	local cfg="$1"

	local enabled
	config_get_bool enabled "$cfg" enabled 0
	[ "$enabled" -gt 0 ] || return 1

	local config_dir
	config_get config_dir "$cfg" 'config_dir' '/mnt/usb1/torrent/transmission'

	local MEM
	MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
	local USE
	[ "$MEM" -gt 1 ] && USE=$((MEM * mem_percentage * 10))
 
	procd_open_instance
	procd_set_param command "$PROG"
	procd_append_param command -f -g "$config_dir" -e /mnt/usb1/torrent/transmission/log
	procd_set_param stderr 1
	procd_set_param respawn
	procd_set_param seccomp "/etc/seccomp/transmission-daemon.json"
	
	[ -d "$web_home" ] && procd_set_param env TRANSMISSION_WEB_HOME="$web_home"

 
	procd_close_instance
}

start_service() {
	config_load 'transmission'
	config_foreach transmission 'transmission'
}

reload_service() {
	procd_send_signal "$PROG"
}

service_triggers() {
	procd_add_reload_trigger "transmission"
}

you removed too much.

The stock script allows you to stop overwriting the settings with config_overwrite in /etc/config/transmission.

As far as the seccomp issue is concerned, remove this:

	procd_set_param seccomp "/etc/seccomp/transmission-daemon.json"

@dangowrt added this non-default option that I have not tested.

Thanks for all the help Neheb, it seems to be working properly now
here is the config i settled on

#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org

START=99
USE_PROCD=1
PROG="/usr/bin/transmission-daemon"

LIST_SEP="
"

append_params() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && echo "\"$p\": $v," | sed -e 's|_|-|g'
		done
	done
	unset IFS
}

append_params_quotes() {
	local p; local v; local s="$1"; shift
	IFS="$LIST_SEP"
	for p in "$@"; do
		config_get v "$s" "$p"
		for v in $v; do
			[ -n "$v" ] && {
				printf "\"%s" "$p" | sed -e 's|/|\\/|g;s|_|-|g'; \
				echo "\": \"$v\","
			}
		done
	done
	unset IFS
}

transmission() {
	local cfg="$1"

	local enabled
	config_get_bool enabled "$cfg" enabled 0
	[ "$enabled" -gt 0 ] || return 1

	local config_dir
	config_get config_dir "$cfg" 'config_dir' '/mnt/usb1/torrent/transmission'

	local MEM
	MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
	local USE
	[ "$MEM" -gt 1 ] && USE=$((MEM * mem_percentage * 10))

	config_file="$config_dir/settings.json"
	[ -d "$config_dir" ] || {
		mkdir -p "$config_dir"
		chmod 0755 "$config_dir"
		touch "$config_file" 
		[ -e "$config_dir/stats.json" ] || touch "$config_dir/stats.json"
		[ -z "$user" ] || chown -R "$user:$group" "$config_dir"
	}
  

	procd_open_instance
	procd_set_param command "$PROG"
	procd_append_param command -f -g "$config_dir" -e /mnt/usb1/torrent/transmission/log
	procd_set_param stderr 1
	procd_set_param respawn

	

	[ -d "$web_home" ] && procd_set_param env TRANSMISSION_WEB_HOME="$web_home"

 
	procd_close_instance
}

start_service() {
	config_load 'transmission'
	config_foreach transmission 'transmission'
}

reload_service() {
	procd_send_signal "$PROG"
}

service_triggers() {
	procd_add_reload_trigger "transmission"
}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.