HOWABOUTNO.jpg
This is a help forum, I don't want to read a d--n novel every time some n00b comes up with a wild hair.
This is a help forum, I don't want to read a d--n novel every time some n00b comes up with a wild hair.
You're in luck thenHOWABOUTNO.jpg
This is a help forum, I don't want to read a d--n novel every time some n00b comes up with a wild hair.
init_colors(){ if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then RED=$(printf '\033[31m'); GREEN=$(printf '\033[32m'); CYAN=$(printf '\033[36m'); BOLD=$(printf '\033[1m'); RESET=$(printf '\033[0m'); else RED=; GREEN=; CYAN=; BOLD=; RESET=; fi; }; info(){ printf '%s[INFO]%s %s\n' "$CYAN" "$RESET" "$*"; }; pass(){ printf '%s[PASS]%s %s\n' "$GREEN" "$RESET" "$*"; }; fail(){ printf '%s[FAIL]%s %s\n' "$RED" "$RESET" "$*" >&2; }; require_root(){ if [ "$(id -u)" -eq 0 ]; then pass "Running as root"; return 0; else fail "This installer must be run as root"; return 1; fi; }; IOMMU_UNIT_DIR=/etc/systemd/system; IOMMU_UNITS='iommu-passthrough iommu-translated-lazy iommu-translated-strict iommu-status'; iommu_frag_find_tty(){ printf '%s' 'find_tty(){ tty=; i=0; ' 'while [ "$$i" -lt 10 ] && [ -z "$$tty" ]; do ' 'for p in /proc/[0-9]*; do ' 'case "$$(readlink "$$p/exe" 2>/dev/null)" in */systemctl) ' 'c=$$(tr "\0" " " <"$$p/cmdline" 2>/dev/null); ' 'case "$$c" in *'"$1"'*) ' 't=$$(readlink "$$p/fd/1" 2>/dev/null); ' 'case "$$t" in /dev/pts/*|/dev/tty*) tty=$$t; break;; esac;; ' 'esac;; ' 'esac; ' 'done; ' 'i=$$((i+1)); ' '[ -n "$$tty" ] || sleep 0.05; ' 'done; ' '}; '; }; iommu_frag_emit(){ printf '%s' 'emit(){ printf "%%s\n" "$$1"; ' '[ -n "$$tty" ] && [ -w "$$tty" ] && printf "%%b\n" "$${2:-$$1}" >"$$tty"; ' '}; '; }; iommu_frag_clean_args(){ printf '%s' 'clean_args(){ out=; ' 'for x in $$1; do ' 'case "$$x" in ' 'iommu=pt|iommu.strict=*|iommu.passthrough=*) :;; ' '*) out="$${out:+$$out }$$x";; ' 'esac; ' 'done; ' 'printf "%%s" "$$out"; ' '}; '; }; iommu_frag_setter_main(){ printf '%s' 'find_tty; ' 'C=$$(printf "\033[1;36m"); ' 'Y=$$(printf "\033[1;33m"); ' 'R=$$(printf "\033[1;31m"); ' 'Z=$$(printf "\033[0m"); ' 'M=$$(printf "\033['"$1"'m"); ' 'mode="'"$2"'"; ' 'name="'"$3"'"; ' '[ "$$(id -u)" -eq 0 ] || { emit "ERROR: run as root" "$${R}ERROR:$${Z} run as root"; exit 1; }; ' 'src=; ' 'if [ -f /etc/kernel/cmdline ] && [ -s /etc/kernel/proxmox-boot-uuids ]; then ' 'old=$$(cat /etc/kernel/cmdline) || exit 1; ' 'clean=$$(clean_args "$$old"); ' 'printf "%%s\n" "$${clean:+$$clean }$$mode" >/etc/kernel/cmdline || { emit "ERROR: could not update /etc/kernel/cmdline" "$${R}ERROR:$${Z} could not update /etc/kernel/cmdline"; exit 1; }; ' 'command -v proxmox-boot-tool >/dev/null 2>&1 || { emit "ERROR: proxmox-boot-tool not found" "$${R}ERROR:$${Z} proxmox-boot-tool not found"; exit 1; }; ' 'proxmox-boot-tool refresh || exit 1; ' 'src=/etc/kernel/cmdline; ' 'elif [ -f /etc/default/grub ] && command -v update-grub >/dev/null 2>&1; then ' 'tmp=$$(mktemp) || exit 1; ' 'found=0; ' ': >"$$tmp" || exit 1; ' 'while IFS= read -r line || [ -n "$$line" ]; do ' 'trim=$${line#"$${line%%%%[![:space:]]*}"}; ' 'case "$$trim" in ' 'GRUB_CMDLINE_LINUX_DEFAULT=*) ' 'val=$${trim#*=}; ' 'val=$$(printf "%%s" "$$val" | sed "s/^\"//;s/\"$$//"); ' 'clean=$$(clean_args "$$val"); ' 'printf "GRUB_CMDLINE_LINUX_DEFAULT=\"%%s\"\n" "$${clean:+$$clean }$$mode" >>"$$tmp"; ' 'found=1;; ' 'GRUB_CMDLINE_LINUX=*) ' 'val=$${trim#*=}; ' 'val=$$(printf "%%s" "$$val" | sed "s/^\"//;s/\"$$//"); ' 'clean=$$(clean_args "$$val"); ' 'printf "GRUB_CMDLINE_LINUX=\"%%s\"\n" "$$clean" >>"$$tmp";; ' '*) printf "%%s\n" "$$line" >>"$$tmp";; ' 'esac; ' 'done </etc/default/grub; ' '[ "$$found" -eq 1 ] || printf "GRUB_CMDLINE_LINUX_DEFAULT=\"%%s\"\n" "$$mode" >>"$$tmp"; ' 'cat "$$tmp" >/etc/default/grub; ' 'r=$$?; ' 'rm -f "$$tmp"; ' '[ "$$r" -eq 0 ] || { emit "ERROR: could not update /etc/default/grub" "$${R}ERROR:$${Z} could not update /etc/default/grub"; exit "$$r"; }; ' 'update-grub || exit 1; ' 'src=/etc/default/grub; ' 'else emit "ERROR: no supported Proxmox boot configuration found" "$${R}ERROR:$${Z} no supported Proxmox boot configuration found"; exit 1; ' 'fi; ' 'emit "Next boot configured: $$name" "$${C}Next boot configured:$${Z} $${M}$$name$${Z}"; ' 'emit "Boot config: $$src" "$${C}Boot config:$${Z} $$src"; ' 'emit "Reboot required for the change to take effect." "$${Y}Reboot required for the change to take effect.$${Z}"; ' 'emit "Status: systemctl start iommu-status" "$${C}Status:$${Z} systemctl start iommu-status"'; }; iommu_frag_status_main(){ printf '%s' 'mode_from_args(){ x=" $$1 "; ' 'case "$$x" in ' '*" iommu=pt "*|*" iommu.passthrough=1 "*|*" iommu.passthrough=Y "*|*" iommu.passthrough=y "*) printf "Pass-Through";; ' '*" iommu.strict=1 "*) printf "Translated - Strict";; ' '*" iommu.strict=0 "*) printf "Translated - Lazy";; ' '*) printf "DEFAULT";; ' 'esac; ' '}; ' 'kernel_default(){ k=/boot/config-$$(uname -r); ' 'if [ -r "$$k" ]; then ' 'if grep -q "^CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y$$" "$$k"; then printf "Pass-Through"; ' 'elif grep -q "^CONFIG_IOMMU_DEFAULT_DMA_STRICT=y$$" "$$k"; then printf "Translated - Strict"; ' 'elif grep -q "^CONFIG_IOMMU_DEFAULT_DMA_LAZY=y$$" "$$k"; then printf "Translated - Lazy"; ' 'else printf "DEFAULT"; ' 'fi; ' 'else printf "DEFAULT"; ' 'fi; ' '}; ' 'color_mode(){ ' 'case "$$1" in ' '"Pass-Through") printf "\033[1;32m%%s\033[0m" "$$1";; ' '"Translated - Lazy") printf "\033[1;33m%%s\033[0m" "$$1";; ' '"Translated - Strict") printf "\033[1;31m%%s\033[0m" "$$1";; ' '*) printf "\033[1;35m%%s\033[0m" "$$1";; ' 'esac; ' '}; ' 'read_grub_args(){ boot=; ' 'while IFS= read -r line || [ -n "$$line" ]; do ' 'trim=$${line#"$${line%%%%[![:space:]]*}"}; ' 'case "$$trim" in ' 'GRUB_CMDLINE_LINUX_DEFAULT=*|GRUB_CMDLINE_LINUX=*) ' 'val=$${trim#*=}; ' 'val=$$(printf "%%s" "$$val" | sed "s/^\"//;s/\"$$//"); ' 'boot="$${boot:+$$boot }$$val";; ' 'esac; ' 'done </etc/default/grub; ' 'printf "%%s" "$$boot"; ' '}; ' 'find_tty; ' 'C=$$(printf "\033[1;36m"); ' 'B=$$(printf "\033[1m"); ' 'Y=$$(printf "\033[1;33m"); ' 'Z=$$(printf "\033[0m"); ' 'def=$$(kernel_default); ' 'cmd=$$(cat /proc/cmdline 2>/dev/null); ' 'p=; ' 's=; ' '[ -r /sys/module/iommu/parameters/passthrough ] && p=$$(cat /sys/module/iommu/parameters/passthrough 2>/dev/null); ' '[ -r /sys/module/iommu/parameters/strict ] && s=$$(cat /sys/module/iommu/parameters/strict 2>/dev/null); ' 'case "$$p" in ' 'Y|y|1) cur="Pass-Through";; ' '*) case "$$s" in ' 'Y|y|1) cur="Translated - Strict";; ' 'N|n|0) cur="Translated - Lazy";; ' '*) cur=$$(mode_from_args "$$cmd"); [ "$$cur" = DEFAULT ] && cur=$$def;; ' 'esac;; ' 'esac; ' '[ "$$cur" = DEFAULT ] && cur=Unknown; ' 'boot=; ' 'src=; ' 'if [ -r /etc/kernel/cmdline ] && [ -s /etc/kernel/proxmox-boot-uuids ]; then ' 'boot=$$(cat /etc/kernel/cmdline); ' 'src=/etc/kernel/cmdline; ' 'elif [ -r /etc/default/grub ]; then ' 'boot=$$(read_grub_args); ' 'src=/etc/default/grub; ' 'fi; ' 'if [ -n "$$src" ]; then ' 'next=$$(mode_from_args "$$boot"); ' '[ "$$next" = DEFAULT ] && next=$$def; ' '[ "$$next" = DEFAULT ] && next=Unknown; ' 'else next=Unknown; ' 'fi; ' 'emit "=== IOMMU Status ===" "$${B}$${C}=== IOMMU Status ===$${Z}"; ' 'if [ -z "$$src" ]; then ' 'emit "IOMMU mode : $$cur" "$${C}IOMMU mode :$${Z} $$(color_mode "$$cur")"; ' 'emit "Boot config : Unknown (no supported boot configuration found)" "$${C}Boot config :$${Z} \033[1;35mUnknown (no supported boot configuration found)\033[0m"; ' 'elif [ "$$cur" = "$$next" ]; then ' 'emit "IOMMU mode : $$cur" "$${C}IOMMU mode :$${Z} $$(color_mode "$$cur")"; ' 'else ' 'emit "Running kernel: $$cur" "$${C}Running kernel:$${Z} $$(color_mode "$$cur")"; ' 'emit "Next boot : $$next" "$${C}Next boot :$${Z} $$(color_mode "$$next")"; ' 'emit "Boot config : $$src" "$${C}Boot config :$${Z} $$src"; ' 'fi; ' 'emit ""; ' 'emit "Available settings:" "$${B}Available settings:$${Z}"; ' 'emit "systemctl start iommu-passthrough"; ' 'emit "systemctl start iommu-translated-lazy"; ' 'emit "systemctl start iommu-translated-strict"; ' 'emit ""; ' 'emit "All setting changes affect the next boot; reboot is required." "$${Y}All setting changes affect the next boot; reboot is required.$${Z}"'; }; iommu_setter_script(){ iommu_frag_find_tty "$1"; iommu_frag_emit; iommu_frag_clean_args; iommu_frag_setter_main "$2" "$3" "$4"; }; iommu_status_script(){ iommu_frag_find_tty iommu-status; iommu_frag_emit; iommu_frag_status_main; }; write_iommu_unit(){ if printf '%s\n' '[Unit]' "Description=$2" '' '[Service]' Type=oneshot "SyslogIdentifier=$1" "ExecStart=/bin/sh -c '$3'" StandardOutput=journal StandardError=journal >"$IOMMU_UNIT_DIR/$1.service"; then pass "Created $1.service"; else fail "Failed to create $1.service"; return 1; fi; }; create_iommu_setter_service(){ write_iommu_unit "$1" "Set IOMMU mode for next boot - $4" "$(iommu_setter_script "$1" "$2" "$3" "$4")"; }; create_iommu_status_service(){ write_iommu_unit iommu-status 'Show live and next-boot IOMMU mode' "$(iommu_status_script)"; }; verify_iommu_service_units(){ info 'Verifying systemd service units'; set --; for u in $IOMMU_UNITS; do set -- "$@" "$IOMMU_UNIT_DIR/$u.service"; done; if systemd-analyze verify "$@" >/dev/null 2>&1; then pass 'All IOMMU service units passed verification'; return 0; else fail 'One or more IOMMU service units failed verification'; systemd-analyze verify "$@" 2>&1; return 1; fi; }; install_iommu_service_units(){ init_colors; require_root || return 1; info 'Installing IOMMU one-shot service units'; create_iommu_setter_service iommu-passthrough '1;32' 'iommu=pt' 'Pass-Through' || return 1; create_iommu_setter_service iommu-translated-lazy '1;33' 'iommu.strict=0' 'Translated - Lazy' || return 1; create_iommu_setter_service iommu-translated-strict '1;31' 'iommu.strict=1' 'Translated - Strict' || return 1; create_iommu_status_service || return 1; verify_iommu_service_units || return 1; if systemctl daemon-reload >/dev/null 2>&1; then pass 'Reloaded systemd configuration'; else fail 'Failed to reload systemd configuration'; return 1; fi; pass 'IOMMU service units installed'; printf '\n%sInstalled commands%s\n' "$BOLD" "$RESET"; printf ' systemctl start iommu-status\n'; printf ' systemctl start iommu-passthrough\n'; printf ' systemctl start iommu-translated-lazy\n'; printf ' systemctl start iommu-translated-strict\n\n'; }; run_iommu_unit(){ systemctl reset-failed "$1" >/dev/null 2>&1 || :; systemctl start "$1"; }; set_iommu_to_lazy_tlb_translation(){ run_iommu_unit iommu-translated-lazy; }; set_iommu_to_strict_tlb_translation(){ run_iommu_unit iommu-translated-strict; }; set_iommu_to_passthrough(){ run_iommu_unit iommu-passthrough; }; get_iommu_passthrough_mode(){ run_iommu_unit iommu-status; };
install_iommu_service_units
#set_iommu_to_lazy_tlb_translation
#set_iommu_to_strict_tlb_translation
set_iommu_to_passthrough
get_iommu_passthrough_mode



I don't want the forum cluttered with posts sized up to 128 KB.but still, just let me have 128kb already !
No, I'm against that. If the limit forces people to actually read their AI-generated posts and make them somewhat concise, or clean up their code slop before posting it here, we should definitely leave it as it is. You and your script are living proof that this limitation is a good thing. ;-pCan I get my 128KB now ?
Yes, and honestly, even if someone just wants to share it directly here, I'd say the "workaround" of attaching it as a file is perfectly acceptable. And for regular forum posts that are expected to be read by humans, I'd say the current limit is more than sufficient. ;-)Additionally, there is a whole slew of pve Scripts in a separate repository. You could submit it there and let it be reviewed.
You can't make miracles, 16384 is not enough for many scriptsNo, I'm against that. If the limit forces people to actually read their AI-gener
Let's be clear, if YOU don't make things easy for me, I will not bother sharing my solutionsIt's about making it easier for you to post it here, isn't it? ;-)
What do you want, 1x 16kb one liner or 8 of them ?I don't want the forum cluttered with posts sized up to 128 KB.
I'm not asking people to go elsewhere and I also am not going else, what is it with you people just trying to get people to leave ?Additionally, there is a whole slew of pve Scripts in a separate repository. You could submit it there and let it be reviewed.
It is 4 times more operations plus now you have to handles files. A code block is select->copy, I'm trying to make things e-a-s-i-e-rYes, and honestly, even if someone just wants to share it directly here, I'd say the "workaround" of attaching it as a file is per
That's true, but the forum isn't for hosting scripts. That's what github/gitlab/codeberg are for. Or if you don't like that, file attachments work fine. "Making it easy" by posting gobbledygook is not helpful in the long run.You can't make miracles, 16384 is not enough for many scripts
That might be for the best if this is what you've got.Let's be clear, if YOU don't make things easy for me, I will not bother sharing my solutions
Maybe none of them? I'm beginning to think that you don't actually understand this and are just going by what your AI says.What do you want, 1x 16kb one liner or 8 of them ?
There's more to software than writing code. As we learn more and more each day, even a thing with no brain can generate code.I mean, I can tell from the PVE web interface that you must all be some kind of coordinated AI swarm absolutely determined to make everything as cumbersome and difficult to use and deter newcomers and slow things down as much as possible and get people to leave the website and just turn off the computer and go outside and touch grass ? Is that the point here ?
This thread was great at one thing, making me realize I just need to skip over this kind of language| I will not bother sharing my solutions
That might be for the best if this is what you've got.
beep boopMaybe none of them? I'm beginning to think that you don't actually understand this and are just going by what your AI says.
I am more of a "get things done" kind of person, I have things to do and I'm really mad that they keep not workingThere's more to software than writing code. As we learn more and more each day, even a thing with no brain can generate code.
I mean, I literally incoporated every single suggestion that I could fit in the 16384 character limitA person who really wanted to help would take feedback into consideration and maybe re-do the script...
Oneliner minified can still be read, you just need to deminify them, we have the tools, they're not going away, this attitude needs to move on.to be more readable, perhaps write some explanation of what it does, etc. For all their flaws that's what the community scripts are about. Others can read the scripts, learn from them, and help improve them. That's the "community" part.
Yes, that's my solution, that's how I decided it should be, and I could also make the service unit file all pretty so you can pretend to read them too, but that will take more than 16kbBTW, the only reason this thing is so nasty is that you want to embed scripts into systemd unit files
Look, there's a solution, why 16 click, file download, file transfert two appsAnd the only reason for _that_ is so it can be cut-and-pasted into a terminal, which is not behavior we should be encouraging,
The real solution is that the OS should have had the CPU bugfix in already.A real solution would separate the script from the unit file ....
Do you know how long it took me to fix this bug, it would have been easier and cheaper to throw the entire into garbage and buying a new one than the resources I wasted developping this solution.
Get out of my thread, stop derailingNobody cares. You come here to bitch that the software you got for free isn't good enough but you'll deign to fix it if we just allow gigantic unreadable AI slop in the forum. Boo-hoo, you insufferable jerk.
Get out of my thread, stop derailingPromise? Deal! Which is also what I say to colleagues that threaten the team with similar things.

True. But since the forum isn't primarily about hosting scripts, and there's a perfectly viable workaround in the form of uploading a file, I don't see an issue with that.You can't make miracles, 16384 is not enough for many scripts.
Proxmox was never primarily aimed at newcomers or hobbyists. It just so happens that many of them use it because it's free, has popular community scripts, and many YouTubers have helped make it popular in the home lab scene. However, in many cases. especially for those who just want to quickly and easily host a few services at home, Proxmox was never the best solution, and probably never will be.I mean, I can tell from the PVE web interface that you must all be some kind of coordinated AI swarm absolutely determined to make everything as cumbersome and difficult to use and deter newcomers and slow things down as much as possible and get people to leave the website and just turn off the computer and go outside and touch grass ? Is that the point here ?
Then I guess the limit was set deliberately. And once again, I think the limit is perfectly adequate for most posts and even smaller tutorials. It would have been sufficient for your script, too, as others have already demonstrated. The only reason it wasn't is that you apparently wanted to dump the very first thing the AI spat out straight into the forum without making any effort to clean it up.Admin the setting for post max length is
Nothing but whining. Makes me wonder why you're even here if you think everything here sucks and is so cumbersome.Also Xenforo sucks, should really switch to anything else that's open source and save some bucks!
Let's be clear, if YOU don't make things easy for me, I will not bother sharing my solutions
What do you want, 1x 16kb one liner or 8 of them ?
I mean, I can tell from the PVE web interface that you must all be some kind of coordinated AI swarm absolutely determined to make everything as cumbersome and difficult to use and deter newcomers and slow things down as much as possible and get people to leave the website and just turn off the computer and go outside and touch grass ? Is that the point here ?
This thread was great at one thing, making me realize I just need to skip over this kind of language
beep boop
I am more of a "get things done" kind of person, I have things to do and I'm really mad that they keep not working
I understand that keeping thing difficult increases job security for operators and prevents their users from doing useful things without having to ask their admin for stuff.
(https://forum.proxmox.com/threads/is-there-a-mod-repository-how-to-make-mods.159457/post-738659 )
> you didn't address my argument: If a feature is considered as potential security issue and thus not implemented why should it be possible to implement it as a mod?
If there was a mod that would turn off all or any security system in proxmox, I would install this mod right now.
I simply do not need most of proxmox's security layers, they get in the way of my work flow, yes I would remove them all.
(https://forum.proxmox.com/threads/is-there-a-mod-repository-how-to-make-mods.159457/post-786922)
I agree with your your points but for me this also is reason why I think that the community scripts and the youtubers clickbait are actually doing more harm than good, greybearded gatekeeper I am.Proxmox was never primarily aimed at newcomers or hobbyists. It just so happens that many of them use it because it's free, has popular community scripts, and many YouTubers have helped make it popular in the home lab scene. However, in many cases. especially for those who just want to quickly and easily host a few services at home, Proxmox was never the best solution, and probably never will be.
We use essential cookies to make this site work, and optional cookies to enhance your experience.