-
Notifications
You must be signed in to change notification settings - Fork 17
YaST Tips and Tricks
Here are some Tips and Tricks related to YaST. Currently this is just a place for dumping your ideas and knowledge. We should sort, move, ... etc later when we have enough data.
To build packages faster you can build them in RAM. The speed up is bigger with rotational disks, on the other hand with SSD you can save quite a lot of writing (less wear off):
# use bigger size if needed
sudo mount -t tmpfs tmpfs -o size=1G,mode=0777 /var/tmp/build-root/
osc build
sudo umount /var/tmp/build-root/1GB is enough for vast majority of YaST packages but in some cases you might need to use a bigger RAM disk.
If you change several YaST packages at once and you need to build the RPMs
with the new packages use -k (keep) and -p (prefer) osc options for each package:
rake osc:build["-k /tmp/new_packages -p /tmp/new_packages"]
You need to build the packages in the correct build dependency.
YAST_SUBMIT=sle12sp1 rake osc:build
See the targets.yml for the complete list of the supported targets.
mkdud --create dud.cpio.gz --dist sle12 my_updated_package.rpm
To include a new control.xml put it into inst-sys directory and then use
mkdud --create dud.cpio.gz --dist sle12 my_updated_package.rpm inst-sys
Expanding the RPM %macros in a specfile:
rpmspec --parse *.specUnfortunately there are some YaST class names which conflict with the native Ruby classes.
If you need to use the Ruby classes you usually need to fully qualify the name with a double colon, e.g. ::String.
Be careful when referring to these classes:
StringFileUtils- ???
Using the YaST installation theme in a running system:
Y2STYLE=installation.qss yast2 repositories- Using SMT or other registration server
- AutoYaST extension identifiers for SLES
- Loading registration codes from an USB flash disc
- OpenSSL certificates
- Testing registration codes
See more at Registration Wiki
- Install the VirtualBox Extension Pack
- Enable remote access in the VM setup (Display➔Remote Display➔Enable Server)
- Make sure
krdcpackage is installed - Connect to the VM using command
krdc rdp://localhost:3389
- Install the
socatutility (zypper in socat) in the host system - Create a new virtual machine in VirtualBox, configure it for installing the requested product (i.e. add the selected ISO image as a virtual CD drive)
- In "Settings" -> "Serial Ports" set "Enable Serial Port", "Port Number": COM1,
"Port Mode": "Host Pipe" Select "Create Pipe" checkbox, enter path to the created pipe file in
"Port/File Path" (e.g.
/home/user/com1) - Boot the machine
- In the host run command
socat unix-connect:/home/user/com1 stdio,raw,echo=0,icanon=0in a terminal (replace/home/userby the path set in the serial port config) - In the VM boot prompt add
console=ttyS0,115200option (or you can enter that using the text menu in the serial console) - Start the installation
- You should see the boot process and then textmode YaST installer in the serial console terminal. Install the system as usually, there is nothing specific to serial console installation (besides it is in textmode).
If you need to quickly run a web server to serve a testing AutoYaST profile or installation repository at http://localhost:8000/
ruby -run -ehttpd . -p8000To use HTTPS (https://localhost:8000/) run
# generate a random SSL certificate at every start
ruby -r webrick/https -e 'WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: ".", SSLEnable: true, SSLCertName: [["CN", "localhost", OpenSSL::ASN1::PRINTABLESTRING]]).start'
# use a custom certificate and key
ruby -r webrick/https -e 'WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: ".", SSLEnable: true, SSLCertificate: OpenSSL::X509::Certificate.new(File.read("cert.pem")), SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read("key.pem"))).start'- Signed empty RPM repository suitable for testing in YaST
Print time stamp for each STDOUT line to see how long does it take to print some line from program start or since printing the previous line.
Install the moreutils package(zypper in moreutils).
# time from start
<command> | ts -s %.s
# time for each line
<command> | ts -i %.s
# if the <command> uses STDOUT buffering you might disable
# that with some command line option or you might try the `unbuffer` tool
unbuffer <command> | ts -s %.sExample to find long running unit tests:
rake test:unit | ts -i %.sSee these blog posts:
- http://blog.ladslezak.cz/2016/01/18/recording-screencast-in-linux/
- http://blog.ladslezak.cz/2016/09/08/editing-screencast/
You can attach images and screenshots to GitHub README and Wiki. The problem is where to store the images. You can store them directly in the Git repository, but the problem is that these images will be included in every clone and the Git repository size can grow up pretty quickly.
The solution is to attach the assets into a GitHub issue and link them from elsewhere. See this article for the details.
- New kbd Package vs. kbd-legacy
- GitHub keyboard shortcuts
- NCurses debugging script
- Libzypp solver flags in
y2log
- image - root filesystem with some additional attributes (e.g. the default environment variables), changes done by a container are local
- container - running instance using a Docker image, each instance has its own writable overlay so they cannot change the original image or affect the other containers using the same image
- volume - special directory in the container tree which is mapped to a host directory (outside the Docker image), can be used for persistent data or for sharing data between several containers
See more in the Docker Glossary.
- Docker Home Page
- Dockerfile reference
- Docker Run reference
- Docker Hub - the default image repository
- Install Docker:
sudo zypper in docker - Start the Docker service
sudo systemctl start docker - Start it at boot
sudo systemctl enable docker - Add yourselves into the
dockeruser groups otherwise you will need to run all commands below as therootuser:sudo usermod -a -G docker `whoami`
-
docker build -t <tag> .build an image fromDockerfile, the last argument is a directory withDockerfile. The build steps are cached, repeated builds use the previous results if possible. -
docker imagesprints the locally available images (built or downloaded) -
docker pulldownlod an image from a server -
docker run -it --rm <image> <command>start a new container (-iinteractive,-tuse a TTY,--rmremove the container after exiting, see the Docker Run reference) -
docker psprints containers (-aalso stopped)
-
docker run -it -p 8080:80 nginxdownload and run the nginx container (to check open http://localhost:8080) -
docker run -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123 mysqlstart an MySQL server, connect withmysql -h 127.0.0.1 -u root -pshutdown using themysqladmin -h 127.0.0.1 -u root -p shutdowncommand
-
CTRL-pCTRL-qdetach from terminal (in TTY mode) -
docker attach <container>attach back docker top <container>docker stats <container>-
docker commitsave result of a stopped container, make the changes permanent
-
docker rm <container>remove a container -
docker rmi <image>remove an image -
docker images -q --filter "dangling=true" | xargs docker rmiremove unused images
Be careful when running these:
-
docker rm `docker ps -a -q`removes all containers -
docker rm `docker ps -f "status=exited" -q`removes all exited containers -
docker rmi `docker images -q`removes all images