2021年9月23日 星期四

Pipeline failed after changing the desktop machine and upgrading Ubuntu

Background

Recently I have changed my desktop to a mini PC and update the Ubuntu system from v18 to v20, which cause the gitlab runner failed to run.








The annoying part is that it only outputs "Job failed! exit status 1" which provides no clue for my debugging.


Troubleshooting and Solutions

Retrieve more debugging information using "journalctl -u gitlab-runner", which did provides some clues with the following





But it still is not enough for my debugging, I then find out with the help of the reference links, stated that the ".bash_logout" script of the user "gitlab-runner" is the cause of the issue. Every time when the runner use user gitlab-runner and exit (logout) the account, under the logout script, clear_console script 






is being called which gitlab-runner user does not have any privileges. Commenting the clear console script and re-run the runner solved the issue.


References

2021年9月12日 星期日

Printing image in non POSIX system

Background

In a project which needs to print receipt using heat sensitive printer, I successfully print out the receipt for each take away ordering, like below

Existing version of the receipt contains only text, using node module printer I was able to print the text properly, but recently a new request requires to print the qr code, which is in the form of an image, which this node module is not supported.








Somehow only CUPS printer support image printing which is not what Windows is supporting...


Solutions

So luckily I keep searching in the issue thread of the node printer plugin, and found this thread









So from the reply, I agree that there is no need for me to use time for finding node plugins, instead I follow the path to use a Windows application "printhtml" to first generate a HTML file and then print it.


Although it is quite a bit complicated, as I need to create a child process in my node application and execute the remote command, but it finally works.


Steps

  1. In loopback application, send socket message to the remote node daemon which that PC is connecting to the printer.

  2. The node daemon received the socket message and generate the HTML file (with the QR code image)

  3. Execute the child process and run the printhtml executable and print success.
References

2021年9月3日 星期五

Clone system disk from larger to smaller size HDD

Items

  1. Windows 10 USB (for fixing MBR)
  2. Gparted USB

Procedure

  1. Bootup the GParted USB
  2. Shrink the volume of the large HDD enough for the smaller HDD to save to
  3. Copy all the partitions of the source HDD to destination HDD
  4. Reboot the system
  5. Boot up the Windows 10 USB
  6. Repair Windows MBR partition
    1. Choose troubleshoot > command prompt
    2. Type Diskpart
    3. List disk > sel disk X, where X is the one of the new HDD
    4. List vol 
    5. Sel vol X, where X is the EFI partition (the one with ~500MB volume)
    6. assign letter=V:
    7. Type "exit"
    8. Type "V:"
    9. Type "bcdboot X:\windows /s V: /f UEFI"

References