gdraheim / docker-systemctl-replacement

docker systemctl replacement - allows to deploy to systemd-controlled containers without starting an actual systemd daemon (e.g. centos7, ubuntu16)
European Union Public License 1.2
1.4k stars 401 forks source link

systemctl start virtstoraged.service Startup exception #181

Closed AppleOfGray closed 4 months ago

AppleOfGray commented 4 months ago

env:

https://hub.docker.com/r/kasmweb/ubuntu-jammy-desktop install cape https://capev2.readthedocs.io/en/latest/installation/host/installation.html#automated-installation-read-the-full-page-before-you-start sudo ./kvm-qemu.sh virtmanager cape

error info

$ systemctl start virtstoraged.service

exe=/usr/sbin/virtstoraged $VIRTSTORAGED_ARGS
 env={'SHELL': '/bin/bash', 'SESSION_MANAGER': 'local/f46937458fa9:@/tmp/.ICE-unix/76,unix/f46937458fa9:/tmp/.ICE-unix/76', 'WINDOWID': '31462342', 'VNCOPTIONS': '-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7 -DLP_ClipDelay=0 -select-de manual -UnixRelay printer:/tmp/printer', 'COLORTERM': 'truecolor', 'XDG_CONFIG_DIRS': '/etc/xdg', 'XDG_MENU_PREFIX': 'xfce-', 'PULSE_RUNTIME_PATH': '/var/run/pulse', 'HOSTNAME': 'f46937458fa9', 'LANGUAGE': 'en_US:en', 'SDL_GAMECONTROLLERCONFIG': '030000005e040000be02000014010000,XInput Controller,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b16,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7', 'DISTRO': 'ubuntu', 'INST_DIR': '/dockerstartup/install', 'SSH_AUTH_SOCK': '/tmp/ssh-XXXXXXn6O5oE/agent.147', 'START_PULSEAUDIO': '1', 'DESKTOP_SESSION': 'xfce', 'SSH_AGENT_PID': '148', 'PWD': '/home/cape/modules/CAPEv2/installer', 'VNC_RESOLUTION': '1280x720', 'LOGNAME': 'cape', 'NVIDIA_DRIVER_CAPABILITIES': 'graphics,compat32,utility', 'TZ': 'Etc/UTC', 'OMP_WAIT_POLICY': 'PASSIVE', 'HOME': '/home/cape', 'LANG': 'en_US.UTF-8', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'XDG_CURRENT_DESKTOP': 'XFCE', 'AUDIO_PORT': '4901', 'VTE_VERSION': '6800', 'DONT_PROMPT_WSL_INSTALL': 'No_Prompt_please', 'STARTUPDIR': '/dockerstartup', 'SKIP_CLEAN': 'true', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'TERM': 'xterm-256color', 'LESSOPEN': '| /usr/bin/lesspipe %s', 'GOMP_SPINCOUNT': '0', 'USER': 'cape', 'KASMVNC_AUTO_RECOVER': 'true', 'VNC_COL_DEPTH': '24', 'START_XFCE4': '1', 'DISPLAY': ':1.0', 'SHLVL': '2', 'HTTPS_PROXY': 'http://192.168.0.118:45600', 'HTTP_PROXY': 'http://192.168.0.118:45600', 'MAX_FRAME_RATE': '24', 'KASM_VNC_PATH': '/usr/share/kasmvnc', 'KASM_RX_HOME': '/dockerstartup/kasmrx', 'PS1': '\\[\\e]0;\\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ', 'LC_ALL': 'en_US.UTF-8', 'INST_SCRIPTS': '/ubuntu/install/tools/install_tools_deluxe.sh                   /ubuntu/install/misc/install_tools.sh                   /ubuntu/install/chrome/install_chrome.sh                   /ubuntu/install/chromium/install_chromium.sh                   /ubuntu/install/firefox/install_firefox.sh                   /ubuntu/install/sublime_text/install_sublime_text.sh                   /ubuntu/install/vs_code/install_vs_code.sh                   /ubuntu/install/nextcloud/install_nextcloud.sh                   /ubuntu/install/remmina/install_remmina.sh                   /ubuntu/install/only_office/install_only_office.sh                   /ubuntu/install/signal/install_signal.sh                   /ubuntu/install/gimp/install_gimp.sh                   /ubuntu/install/zoom/install_zoom.sh                   /ubuntu/install/obs/install_obs.sh                   /ubuntu/install/ansible/install_ansible.sh                   /ubuntu/install/terraform/install_terraform.sh                   /ubuntu/install/telegram/install_telegram.sh                   /ubuntu/install/thunderbird/install_thunderbird.sh                   /ubuntu/install/gamepad_utils/install_gamepad_utils.sh                   /ubuntu/install/cleanup/cleanup.sh', 'XDG_DATA_DIRS': '/usr/local/share:/usr/share', 'VNC_PORT': '5901', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin', 'NO_VNC_PORT': '6901', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-N1iLyTicTD,guid=5a28662cd8098872309445176694f0a2', 'MAIL': '/var/mail/cape', 'DEBIAN_FRONTEND': 'noninteractive', 'OLDPWD': '/home/cape', '_': '/usr/bin/systemctl', 'VIRTSTORAGED_ARGS': '"--timeout'}
 conf=<__main__.SystemctlConf object at 0x7f8136350370>
Traceback (most recent call last):
  File "/usr/bin/systemctl", line 6852, in <module>
    sys.exit(run(command, *modules))
  File "/usr/bin/systemctl", line 6602, in run
    exitcode = is_not_ok(systemctl.start_modules(*modules))
  File "/usr/bin/systemctl", line 2914, in start_modules
    return self.start_units(units, init) and found_all
  File "/usr/bin/systemctl", line 2924, in start_units
    if not self.start_unit(unit):
  File "/usr/bin/systemctl", line 2942, in start_unit
    return self.start_unit_from(conf)
  File "/usr/bin/systemctl", line 2957, in start_unit_from
    return self.do_start_unit_from(conf)
  File "/usr/bin/systemctl", line 2960, in do_start_unit_from
    return self.do_start_service_from(conf)
  File "/usr/bin/systemctl", line 2974, in do_start_service_from
    okee = self.exec_check_unit(conf, env, Service, "Exec") # all...
  File "/usr/bin/systemctl", line 5344, in exec_check_unit
    mode, newcmd = self.exec_newcmd(cmd, env, conf)
  File "/usr/bin/systemctl", line 2290, in exec_newcmd
    newcmd = self.expand_cmd(exe, env, conf)
  File "/usr/bin/systemctl", line 2321, in expand_cmd
    for part in shlex.split(cmd3):
  File "/usr/lib/python3.10/shlex.py", line 315, in split
    return list(lex)
  File "/usr/lib/python3.10/shlex.py", line 300, in __next__
    token = self.get_token()
  File "/usr/lib/python3.10/shlex.py", line 109, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.10/shlex.py", line 191, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

If it is an environmental issue, please ignore the current issue

gdraheim commented 4 months ago

it is as the expanded variable needs to be properly quoted - do you see it?

 'VIRTSTORAGED_ARGS': '"--timeout'
AppleOfGray commented 4 months ago

it is as the expanded variable needs to be properly quoted - do you see it?

 'VIRTSTORAGED_ARGS': '"--timeout'

Yes, after modifying this value, the program is working properly. Thank you. vim /usr/bin/systemctl

def exec_newcmd(self, cmd, env, conf):
2285         mode, exe = exec_path(cmd)
2286         if mode.noexpand:
2287             newcmd = self.split_cmd(exe)
2288         else:
2289             # env['VIRTSTORAGED_ARGS'] = "--timeout"
2290             # print("exe="+str(exe)+"\n env="+str(env)+"\n -----------------")
2291             newcmd = self.expand_cmd(exe, env, conf)
2292         if mode.argv0:
2293             if len(newcmd) > 1:
2294                 del newcmd[1] # TODO: keep but allow execve calls to pick it up
2295         return mode, newcmd