bfabiszewski / kterm

gtk+ terminal emulator with embedded virtual keyboard for Kindle
GNU General Public License v3.0
216 stars 21 forks source link

Help #26

Closed Zucker-jex closed 8 months ago

Zucker-jex commented 2 years ago

I installed debian with container on Kindle, when I use Kterm in debian system, it will report the following error

VTE : Failed to load terminal capabilities from '/etc/termcap'

bfabiszewski commented 2 years ago

You probably don't have termcap installed in your container? You could probably use the one shipped with kterm kindle package.

Zucker-jex commented 2 years ago

I will try again. thanks for your reminder.

Zucker-jex commented 2 years ago

This is my file, he still can't run in my container.

kterm.zip

bfabiszewski commented 2 years ago

This version of libvte seems to need termcap file. Modern ones rely on terminfo. Do you have /etc/termcap folder in your debian container? The library probably also looks for /usr/share/vte/termcap directory. You need this folder with xterm file inside. If you don't have it, install it or link to termcap from kterm package.

Zucker-jex commented 2 years ago

I have tried it, but it didn't work. You can try installing this(https://github.com/Zucker-jex/Debian-System-in-Kindle) on kindle before using Kterm.

bfabiszewski commented 2 years ago

So you have /etc/termcap/xterm file in your debian chroot and you still see this error: *** VTE ***: Failed to load terminal capabilities from '/etc/termcap'?

Zucker-jex commented 2 years ago

yes 屏幕截图 2022-07-24 214125

Zucker-jex commented 2 years ago

IMG_20220724_220834

bfabiszewski commented 2 years ago

Make sure to run kterm with kterm.sh script, as it sets TERM=xterm environment variable. Other than that I have no clues.

Zucker-jex commented 2 years ago

屏幕截图 2022-07-24 222855 Thanks for your reminder.

Zucker-jex commented 2 years ago

It still doesn't work.

Zucker-jex commented 2 years ago

I solved the error, but a new problem appeared.

I moved the file /etc/termcap in the Kindle (note that this is a file) to the /etc/ directory of the debian container. Solved the ' VTE : Failed to load terminal capabilities from '/etc/termcap' error.

But after I run it it quits very quickly, this is the new problem.

Zucker-jex commented 2 years ago

https://user-images.githubusercontent.com/98502190/180653200-8b59e2f3-8e65-4ff7-a1ce-1973d4dbfb67.mp4

bfabiszewski commented 2 years ago

Ok. So the termcap in /etc is just a file. Probably default termcap? Try to run kterm from terminal directly without the script. Maybe you will see any error in the console.

Zucker-jex commented 2 years ago

Nothing happens, just a flash and it's gone 屏幕截图 2022-07-24 231921 .

bfabiszewski commented 2 years ago

You may try with -d to see some debugging output. Also set the environment variables, like in the script. You may also try to run it from standard kindle path: /mnt/us/extensions/kterm. I don't remember now, but some paths might be hard coded in the kindle package.

Zucker-jex commented 2 years ago

First of all, the first question, I don't think it has a hard directory requirement on software. 屏幕截图 2022-07-24 222855 I modified the directory specified in Kterm.sh in the debian container, and modified it to EXTENSION=/mnt/debian/root/kterm pointing to the debian container Kterm. 屏幕截图 2022-07-25 104813 ![IMG_20220725_104958](https://user- After this modification, it can run in Kindle Linux. 屏幕截图 2022-07-25 104940 IMG_20220725_104958 Then I entered the debian container, changed back to the directory of kterm.sh and ran kterm.sh again. It's still the same as before, just a flash and it's gone. 屏幕截图 2022-07-25 105325 In the debian container, I used the -d parameter and its output is as follows.

click to show log ``` root@Debian[~/kterm/bin]# ./kterm -d Dbus connection failed: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory Dbus connection failed: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory Layout path from config: /root/kterm/layouts/keyboard-300dpi.xml attribute id = "kt keyboard 299" attribute fill = "true" attribute display = "image:img-300dpi/esc.png" attribute action = "escape" key width: 45 end name: default end name: key attribute display = "1" key width: 27 end name: default attribute display = "!" key width: 17 end name: shifted attribute display = "image:img-300dpi/f1.png" attribute action = "f1" key width: 32 end name: mod1 attribute display = "?" key width: 17 end name: mod2 end name: key attribute display = "2" key width: 27 end name: default attribute display = "@" key width: 42 end name: shifted attribute display = "image:img-300dpi/f2.png" attribute action = "f2" key width: 32 end name: mod1 attribute display = "?" key width: 17 end name: mod2 end name: key attribute display = "3" key width: 27 end name: default attribute display = "#" key width: 35 end name: shifted attribute display = "image:img-300dpi/f3.png" attribute action = "f3" key width: 32 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "4" key width: 27 end name: default attribute display = "$" key width: 27 end name: shifted attribute display = "image:img-300dpi/f4.png" attribute action = "f4" key width: 32 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "5" key width: 27 end name: default attribute display = "%" key width: 40 end name: shifted attribute display = "image:img-300dpi/f5.png" attribute action = "f5" key width: 32 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "6" key width: 27 end name: default attribute display = "^" key width: 35 end name: shifted attribute display = "image:img-300dpi/f6.png" attribute action = "f6" key width: 32 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "7" key width: 27 end name: default attribute display = "&" key width: 33 end name: shifted attribute display = "image:img-300dpi/f7.png" attribute action = "f7" key width: 32 end name: mod1 attribute display = "?" key width: 17 end name: mod2 end name: key attribute display = "8" key width: 27 end name: default attribute display = "*" key width: 21 end name: shifted attribute display = "image:img-300dpi/f8.png" attribute action = "f8" key width: 32 end name: mod1 attribute display = "?" key width: 22 end name: mod2 end name: key attribute display = "9" key width: 27 end name: default attribute display = "(" key width: 16 end name: shifted attribute display = "image:img-300dpi/f9.png" attribute action = "f9" key width: 32 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "0" key width: 27 end name: default attribute display = ")" key width: 16 end name: shifted attribute display = "image:img-300dpi/f10.png" attribute action = "f10" key width: 50 end name: mod1 attribute display = "¡ì" key width: 21 end name: mod2 end name: key attribute display = "-" key width: 15 end name: default attribute display = "_" key width: 21 end name: shifted attribute display = "image:img-300dpi/f11.png" attribute action = "f11" key width: 50 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute display = "=" key width: 35 end name: default attribute display = "+" key width: 35 end name: shifted attribute display = "image:img-300dpi/f12.png" attribute action = "f12" key width: 50 end name: mod1 attribute display = "¡ã" key width: 21 end name: mod2 end name: key attribute width = "2000" attribute display = "image:img-300dpi/back.png" attribute action = "backspace" key width: 0 end name: default attribute display = "image:img-300dpi/del.png" attribute action = "delete" key width: 0 end name: mod1 end name: key end name: row attribute width = "1500" attribute fill = "true" attribute display = "image:img-300dpi/tab.png" attribute action = "tab" key width: 0 end name: default end name: key attribute obey-caps = "true" attribute display = "q" key width: 27 end name: default attribute display = "Q" key width: 33 end name: shifted attribute display = "¨¤" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "w" key width: 34 end name: default attribute display = "W" key width: 41 end name: shifted attribute display = "¨¢" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "e" key width: 26 end name: default attribute display = "E" key width: 26 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "r" key width: 17 end name: default attribute display = "R" key width: 29 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "t" key width: 16 end name: default attribute display = "T" key width: 26 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "y" key width: 25 end name: default attribute display = "Y" key width: 26 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "u" key width: 27 end name: default attribute display = "U" key width: 31 end name: shifted attribute display = "?" key width: 23 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "i" key width: 12 end name: default attribute display = "I" key width: 12 end name: shifted attribute display = "?" key width: 23 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "o" key width: 26 end name: default attribute display = "O" key width: 33 end name: shifted attribute display = "¨¨" key width: 26 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "p" key width: 27 end name: default attribute display = "P" key width: 25 end name: shifted attribute display = "¨¦" key width: 26 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute display = "[" key width: 16 end name: default attribute display = "{" key width: 27 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute display = "]" key width: 16 end name: default attribute display = "}" key width: 27 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute display = "\" key width: 14 end name: default attribute display = "|" key width: 14 end name: shifted end name: key end name: row attribute width = "1500" attribute fill = "true" attribute display = "image:img-300dpi/capslk.png" attribute action = "modifier:caps" key width: 0 end name: default end name: key attribute obey-caps = "true" attribute display = "a" key width: 26 end name: default attribute display = "A" key width: 29 end name: shifted attribute display = "¨¬" key width: 12 end name: mod1 attribute display = "?" key width: 12 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "s" key width: 22 end name: default attribute display = "S" key width: 27 end name: shifted attribute display = "¨ª" key width: 12 end name: mod1 attribute display = "?" key width: 12 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "d" key width: 27 end name: default attribute display = "D" key width: 32 end name: shifted attribute display = "?" key width: 12 end name: mod1 attribute display = "?" key width: 12 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "f" key width: 15 end name: default attribute display = "F" key width: 24 end name: shifted attribute display = "?" key width: 12 end name: mod1 attribute display = "?" key width: 24 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "g" key width: 27 end name: default attribute display = "G" key width: 32 end name: shifted attribute display = "?" key width: 27 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "h" key width: 27 end name: default attribute display = "H" key width: 31 end name: shifted attribute display = "?" key width: 27 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "j" key width: 12 end name: default attribute display = "J" key width: 12 end name: shifted attribute display = "¨®" key width: 26 end name: mod1 attribute display = "?" key width: 33 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "k" key width: 24 end name: default attribute display = "K" key width: 27 end name: shifted attribute display = "¨°" key width: 26 end name: mod1 attribute display = "?" key width: 33 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "l" key width: 12 end name: default attribute display = "L" key width: 23 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 33 end name: mod2 end name: key attribute display = ";" key width: 14 end name: default attribute display = ":" key width: 14 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 33 end name: mod2 end name: key attribute display = "'" key width: 12 end name: default attribute display = """ key width: 19 end name: shifted attribute display = "?" key width: 22 end name: mod1 attribute display = "?" key width: 27 end name: mod2 end name: key attribute width = "2000" attribute display = "image:img-300dpi/return.png" attribute action = "return" key width: 0 end name: default end name: key end name: row attribute width = "1500" attribute fill = "true" attribute display = "image:img-300dpi/shift.png" attribute action = "modifier:shift" key width: 0 end name: default end name: key attribute display = "`" key width: 21 end name: default attribute display = "~" key width: 35 end name: shifted end name: key attribute obey-caps = "true" attribute display = "z" key width: 22 end name: default attribute display = "Z" key width: 29 end name: shifted attribute display = "?" key width: 26 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "x" key width: 25 end name: default attribute display = "X" key width: 29 end name: shifted attribute display = "¨´" key width: 27 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "c" key width: 23 end name: default attribute display = "C" key width: 29 end name: shifted attribute display = "¨²" key width: 27 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "v" key width: 25 end name: default attribute display = "V" key width: 29 end name: shifted attribute display = "?" key width: 27 end name: mod1 attribute display = "?" key width: 31 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "b" key width: 27 end name: default attribute display = "B" key width: 29 end name: shifted attribute display = "¨¹" key width: 27 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "n" key width: 27 end name: default attribute display = "N" key width: 31 end name: shifted attribute display = "?" key width: 25 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute obey-caps = "true" attribute display = "m" key width: 41 end name: default attribute display = "M" key width: 36 end name: shifted attribute display = "?" key width: 25 end name: mod1 attribute display = "?" key width: 26 end name: mod2 end name: key attribute display = "," key width: 13 end name: default attribute display = "<" key width: 35 end name: shifted attribute display = "?" key width: 22 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute display = "." key width: 13 end name: default attribute display = ">" key width: 35 end name: shifted attribute display = "?" key width: 22 end name: mod1 attribute display = "?" key width: 29 end name: mod2 end name: key attribute display = "/" key width: 14 end name: default attribute display = "?" key width: 22 end name: shifted end name: key attribute display = "image:img-300dpi/up.png" attribute action = "up" key width: 27 end name: default attribute display = "image:img-300dpi/pgup.png" attribute action = "pageup" key width: 27 end name: mod1 end name: key attribute display = "image:img-300dpi/shift.png" attribute action = "modifier:shift" key width: 27 end name: default end name: key end name: row attribute width = "1500" attribute fill = "true" attribute display = "image:img-300dpi/ctrl.png" attribute action = "modifier:ctrl" key width: 0 end name: default end name: key attribute display = "image:img-300dpi/alt.png" attribute action = "modifier:alt" key width: 38 end name: default end name: key attribute display = "image:img-300dpi/sym1.png" attribute action = "modifier:mod1" key width: 43 end name: default end name: key attribute width = "7000" attribute display = " " attribute action = "space" key width: 0 end name: default end name: key attribute display = "image:img-300dpi/sym2.png" attribute action = "modifier:mod2" key width: 48 end name: default end name: key attribute display = "image:img-300dpi/left.png" attribute action = "left" key width: 27 end name: default attribute display = "image:img-300dpi/home.png" attribute action = "home" key width: 27 end name: mod1 end name: key attribute display = "image:img-300dpi/down.png" attribute action = "down" key width: 27 end name: default attribute display = "image:img-300dpi/pgdn.png" attribute action = "pagedown" key width: 27 end name: mod1 end name: key attribute display = "image:img-300dpi/right.png" attribute action = "right" key width: 27 end name: default attribute display = "image:img-300dpi/end.png" attribute action = "end" key width: 54 end name: mod1 end name: key end name: row end name: layout end name: keyboard Parsed 63 keys in 5 rows wmin: 58, wmax: 0 => 58 window size: 1x1 screen size: 1072x1448 (301 dpi) hmin: 53, hmax: 96, pref: 94 => 94 keyboard size: 1x470 font_name: Monospace 6 grab focus: termBox set keyboard size: 1072x470 wmin: 58, wmax: 71 => 71 window size: 1072x1448 screen size: 1072x1448 (301 dpi) hmin: 53, hmax: 96, pref: 94 => 94 keyboard size: 1072x470 cleanup the end root@Debian[~/kterm/bin]# ```

According to this error, I think dbus is not started. So I used /etc/init.d/dbus start /etc/init.d/dbus start to start dbus and run the daemon. Then its error message becomes as follows. Dbus reply error: org.freedesktop.DBus.Error.ServiceUnknown: The name com.lab126.winmgr was not provided by any .service files

bfabiszewski commented 2 years ago

Generally the problem is you are using kterm version that was built for Kindle OS, but you are using it in Debian OS.

I don't know exactly what the problem is. The dbus issue should not be fatal. It is just a warning. Dbus is used to change terminal orientation on Kindle. It communicates with Kindle framework on dbus. You may try different orientation setups in config to see what happens, but that should not matter. From debug log it seems the application immediately exits main GTK loop, as if it received some termination signal.

Please run kterm -v. This should show GTK version. Maybe there is some mismatch?

Ideally you should just rebuild kterm for pure Linux without Kindle tweaks and for your exact environment. I thought the Kindle version might still work, but it seems not so easy.

Zucker-jex commented 2 years ago

屏幕截图 2022-07-25 165425 The reason I use the Kindle OS version is that I really don't cross-compile.

Zucker-jex commented 2 years ago

Since I don't cross-compile, I will build Kterm directly in the debian container, but the following problems occur during the process

屏幕截图 2022-07-25 171432

bfabiszewski commented 2 years ago

Probably missing or too old version of pkg-config?

One thing is not clear to me. Are you going to use kterm in Debian window manager or in Amazon GUI? If you only want to use default Kindle window manager and not start X server in Debian chroot you will still need Kindle version of kterm. You can still rebuild it and see if it helps.

Zucker-jex commented 2 years ago

I want to implement lightweight code writing work on Kindle, but you also know that Kindle's Linux is a crippled, so I tried to use container technology to run debian's complete Linux environment. But because the Amazon GUI still exists and takes up a lot of system resources, there is no way to use the debian operating system well. So I want to use UpStart to directly start the debian environment. The specific process is to write a system startup configuration file in the /etc/upstart directory, similar to the following.

################################################################# pre-start script echo "Log from $(date)" > /mnt/us/debian.log exec >>/mnt/us/debian.log 2>&1 echo "# Debian ::: pre-start script" echo "Starting debian linux" mount -o loop -t ext3 /mnt/us/extensions/linux/sys/debian.ext3 /mnt/debian mount -o bind /dev /mnt/debian/dev mount -o bind /proc /mnt/debian/proc mount -o bind /sys /mnt/debian/sys cp /etc/hosts /mnt/debian/etc/hosts cp /etc/resolv.conf /mnt/debian/etc/resolv.conf chmod a+w /dev/shm end script

script exec >>/mnt/us/debian.log 2>&1 echo "# Debian ::: script" sleep 1 stop lab126_gui su -c "chroot /mnt/debian /bin/login" kill $(pgrep Xephyr) end script

post-stop script exec >>/mnt/us/debian.log 2>&1 echo "# Debian ::: post-stop script" echo "Unmounting Debian rootfs" LOOPDEV="$(mount | grep loop | grep /mnt/debian | cut -d" " -f1)" umount /mnt/debian/sys sleep 1 umount /mnt/debian/dev umount /mnt/debian/proc

Sync beforehand so umount doesn't fail due to the device being busy still

sync
umount /mnt/debian || true
# Sometimes it fails still and only works by trying again
while [ "$(mount | grep /mnt/debian)" ]
do
    echo "Debian is still mounted, trying again shortly.."
    sleep 3
    umount /mnt/debian || true
done
echo "Debian unmounted"
echo "Disassociating loop device >>$LOOPDEV<<"
losetup -d $LOOPDEV
echo "All done, starting kindle's gui."
start lab126_gui

end script #################################################################

But I want to use Kterm as GUI interface after it starts, unfortunately it doesn't work. So I should start Kterm in debian system environment. 屏幕截图 2022-07-25 210125 The following is the log after I use the above configuration file to start. 屏幕截图 2022-07-25 210159 屏幕截图 2022-07-25 210224 For the specific content of this container, you can go and see this. https://github.com/Zucker-jex/Debian-System-in-Kindle

bfabiszewski commented 2 years ago

Read how to run GUI programs in chroot to solve "cannot open display" issue. You seem to stop Amazon window manager, so you don't need kterm version made for Kindle.

Zucker-jex commented 2 years ago

So,What should I do?

bfabiszewski commented 2 years ago

I can help you with kterm, but I cannot solve all the issues with your project. You will have to dig yourself. You need to find out how to run GUI programs in chroot. You surely need to export DISPLAY variable, but more steps may be needed in your case. As you copied your scripts from internet, try to find out more about what the original authors did. If you want to run kterm in Debian window manager, it would be best to rebuild it. Kindle version might also work, but it is hard to say without trying.

Zucker-jex commented 2 years ago

Thank you very much.

Zucker-jex commented 2 years ago

I solved this problem in a weird way.